27
27
import org .linkeddatafragments .datasource .tdb .JenaTDBDataSourceType ;
28
28
import org .linkeddatafragments .exceptions .DataSourceException ;
29
29
import org .linkeddatafragments .exceptions .DataSourceNotFoundException ;
30
+ import org .linkeddatafragments .exceptions .NoRegisteredMimeTypesException ;
30
31
import org .linkeddatafragments .fragments .LinkedDataFragment ;
31
32
import org .linkeddatafragments .fragments .LinkedDataFragmentRequest ;
32
33
import org .linkeddatafragments .fragments .LinkedDataFragmentRequestBase ;
@@ -87,10 +88,10 @@ public void init(ServletConfig servletConfig) throws ServletException {
87
88
}
88
89
89
90
// register content types
90
- mimeTypes . add (Lang .TTL .getHeaderString ());
91
- mimeTypes . add (Lang .JSONLD .getHeaderString ());
92
- mimeTypes . add (Lang .NTRIPLES .getHeaderString ());
93
- mimeTypes . add (Lang .RDFXML .getHeaderString ());
91
+ MIMEParse . register (Lang .TTL .getHeaderString ());
92
+ MIMEParse . register (Lang .JSONLD .getHeaderString ());
93
+ MIMEParse . register (Lang .NTRIPLES .getHeaderString ());
94
+ MIMEParse . register (Lang .RDFXML .getHeaderString ());
94
95
} catch (IOException | DataSourceException e ) {
95
96
throw new ServletException (e );
96
97
}
@@ -152,7 +153,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro
152
153
output .add ( fragment .getControls () );
153
154
154
155
// do conneg
155
- String bestMatch = MIMEParse .bestMatch (mimeTypes , request .getHeader ("Accept" ));
156
+ String bestMatch = MIMEParse .bestMatch (request .getHeader ("Accept" ));
156
157
Lang contentType = RDFLanguages .contentTypeToLang (bestMatch );
157
158
158
159
// serialize the output
@@ -161,7 +162,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro
161
162
response .setCharacterEncoding ("utf-8" );
162
163
163
164
RDFDataMgr .write (response .getOutputStream (), output , contentType );
164
- } catch (IOException e ) {
165
+ } catch (IOException | NoRegisteredMimeTypesException e ) {
165
166
throw new ServletException (e );
166
167
} catch (DataSourceNotFoundException ex ) {
167
168
try {
0 commit comments