@Test void testGetSyntax() { final List<MediaType> types = asList(APPLICATION_JSON_TYPE, TEXT_XML_TYPE, new MediaType("text", "turtle")); assertEquals(TURTLE, HttpUtils.getSyntax(ioService, types, null), "Cannot determine Turtle syntax!"); }
public static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes, final String mimeType) { if (acceptableTypes.isEmpty()) { return mimeType != null ? null : TURTLE; } if (mimeType != null) { final MediaType mt = MediaType.valueOf(mimeType); for (final MediaType type : acceptableTypes) { if (type.isCompatible(mt)) { return null; } } } for (final MediaType type : acceptableTypes) { final RDFSyntax syntax = ioService.supportedReadSyntaxes().stream() .filter(s -> MediaType.valueOf(s.mediaType()).isCompatible(type)) .findFirst().orElse(null); if (syntax != null) { return syntax; } } LOGGER.debug("Valid syntax not found among {} or {}", acceptableTypes, mimeType); throw new NotAcceptableException(); }
HttpUtils { public static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes, final String mimeType) { if (acceptableTypes.isEmpty()) { return mimeType != null ? null : TURTLE; } if (mimeType != null) { final MediaType mt = MediaType.valueOf(mimeType); for (final MediaType type : acceptableTypes) { if (type.isCompatible(mt)) { return null; } } } for (final MediaType type : acceptableTypes) { final RDFSyntax syntax = ioService.supportedReadSyntaxes().stream() .filter(s -> MediaType.valueOf(s.mediaType()).isCompatible(type)) .findFirst().orElse(null); if (syntax != null) { return syntax; } } LOGGER.debug("Valid syntax not found among {} or {}", acceptableTypes, mimeType); throw new NotAcceptableException(); } }
HttpUtils { public static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes, final String mimeType) { if (acceptableTypes.isEmpty()) { return mimeType != null ? null : TURTLE; } if (mimeType != null) { final MediaType mt = MediaType.valueOf(mimeType); for (final MediaType type : acceptableTypes) { if (type.isCompatible(mt)) { return null; } } } for (final MediaType type : acceptableTypes) { final RDFSyntax syntax = ioService.supportedReadSyntaxes().stream() .filter(s -> MediaType.valueOf(s.mediaType()).isCompatible(type)) .findFirst().orElse(null); if (syntax != null) { return syntax; } } LOGGER.debug("Valid syntax not found among {} or {}", acceptableTypes, mimeType); throw new NotAcceptableException(); } private  HttpUtils(); }
HttpUtils { public static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes, final String mimeType) { if (acceptableTypes.isEmpty()) { return mimeType != null ? null : TURTLE; } if (mimeType != null) { final MediaType mt = MediaType.valueOf(mimeType); for (final MediaType type : acceptableTypes) { if (type.isCompatible(mt)) { return null; } } } for (final MediaType type : acceptableTypes) { final RDFSyntax syntax = ioService.supportedReadSyntaxes().stream() .filter(s -> MediaType.valueOf(s.mediaType()).isCompatible(type)) .findFirst().orElse(null); if (syntax != null) { return syntax; } } LOGGER.debug("Valid syntax not found among {} or {}", acceptableTypes, mimeType); throw new NotAcceptableException(); } private  HttpUtils(); static Stream<IRI> ldpResourceTypes(final IRI ixnModel); static boolean matchIdentifier(final BlankNodeOrIRI subject, final IRI identifier); static Set<IRI> triplePreferences(final Prefer prefer); static Function<Triple, Triple> unskolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Triple, Triple> skolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Quad, Quad> skolemizeQuads(final ResourceService svc, final String baseUrl); static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes,
            final String mimeType); static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax); static IRI getDefaultProfile(final RDFSyntax syntax, final String identifier,
            final String defaultJsonLdProfile); static IRI getDefaultProfile(final RDFSyntax syntax, final IRI identifier,
            final String defaultJsonLdProfile); static boolean isContainer(final IRI ldpType); static void checkIfModifiedSince(final String method, final String ifModifiedSince,
            final Instant modified); static void checkIfUnmodifiedSince(final String ifUnmodifiedSince, final Instant modified); static void checkIfMatch(final String ifMatch, final EntityTag etag); static void checkIfNoneMatch(final String method, final String ifNoneMatch, final EntityTag etag); static void checkRequiredPreconditions(final boolean required, final String ifMatch,
            final String ifUnmodifiedSince); static boolean exists(final Resource resource); static void closeDataset(final Dataset dataset); static String buildResourceUrl(final TrellisRequest req, final String baseUrl); }
HttpUtils { public static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes, final String mimeType) { if (acceptableTypes.isEmpty()) { return mimeType != null ? null : TURTLE; } if (mimeType != null) { final MediaType mt = MediaType.valueOf(mimeType); for (final MediaType type : acceptableTypes) { if (type.isCompatible(mt)) { return null; } } } for (final MediaType type : acceptableTypes) { final RDFSyntax syntax = ioService.supportedReadSyntaxes().stream() .filter(s -> MediaType.valueOf(s.mediaType()).isCompatible(type)) .findFirst().orElse(null); if (syntax != null) { return syntax; } } LOGGER.debug("Valid syntax not found among {} or {}", acceptableTypes, mimeType); throw new NotAcceptableException(); } private  HttpUtils(); static Stream<IRI> ldpResourceTypes(final IRI ixnModel); static boolean matchIdentifier(final BlankNodeOrIRI subject, final IRI identifier); static Set<IRI> triplePreferences(final Prefer prefer); static Function<Triple, Triple> unskolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Triple, Triple> skolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Quad, Quad> skolemizeQuads(final ResourceService svc, final String baseUrl); static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes,
            final String mimeType); static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax); static IRI getDefaultProfile(final RDFSyntax syntax, final String identifier,
            final String defaultJsonLdProfile); static IRI getDefaultProfile(final RDFSyntax syntax, final IRI identifier,
            final String defaultJsonLdProfile); static boolean isContainer(final IRI ldpType); static void checkIfModifiedSince(final String method, final String ifModifiedSince,
            final Instant modified); static void checkIfUnmodifiedSince(final String ifUnmodifiedSince, final Instant modified); static void checkIfMatch(final String ifMatch, final EntityTag etag); static void checkIfNoneMatch(final String method, final String ifNoneMatch, final EntityTag etag); static void checkRequiredPreconditions(final boolean required, final String ifMatch,
            final String ifUnmodifiedSince); static boolean exists(final Resource resource); static void closeDataset(final Dataset dataset); static String buildResourceUrl(final TrellisRequest req, final String baseUrl);  }