This is an automated email from the ASF dual-hosted git repository. andy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/jena.git
commit 026b25762b2905e6f276ae5bd377a764d5bc82b9 Author: Andy Seaborne <[email protected]> AuthorDate: Fri Oct 24 17:29:09 2025 +0100 Remove alternatives (unregistered MIME types) --- .../java/org/apache/jena/riot/RDFLanguages.java | 3 --- .../main/java/org/apache/jena/riot/WebContent.java | 21 +++++++++++---------- .../org/apache/jena/riot/web/TestWebContent.java | 21 ++++++++++++++------- .../src/main/java/org/apache/jena/fuseki/DEF.java | 4 ---- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFLanguages.java b/jena-arq/src/main/java/org/apache/jena/riot/RDFLanguages.java index 908b0a847d..8d7f24202d 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/RDFLanguages.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFLanguages.java @@ -74,7 +74,6 @@ public class RDFLanguages /** <a href="http://www.w3.org/TR/turtle/">Turtle</a>*/ public static final Lang TURTLE = LangBuilder.create(strLangTurtle, contentTypeTurtle) .addAltNames("TTL") - .addAltContentTypes(contentTypeTurtleAlt) .addFileExtensions("ttl") .build(); @@ -90,8 +89,6 @@ public class RDFLanguages /** <a href="http://www.w3.org/TR/n-triples/">N-Triples</a>*/ public static final Lang NTRIPLES = LangBuilder.create(strLangNTriples, contentTypeNTriples) .addAltNames("NT", "NTriples", "NTriple", "N-Triple", "N-Triples") - // Remove? Causes more trouble than it's worth. - .addAltContentTypes(contentTypeNTriplesAlt) .addFileExtensions("nt") .build(); diff --git a/jena-arq/src/main/java/org/apache/jena/riot/WebContent.java b/jena-arq/src/main/java/org/apache/jena/riot/WebContent.java index e75b685392..6d0615953a 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/WebContent.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/WebContent.java @@ -25,13 +25,14 @@ import org.apache.jena.riot.system.ContentHeaderBuilder; public class WebContent { // Names for things. - // Some alternative, incorrect, MIME types are defined for convenience. These are "Alt" + // Some alternative, incorrect, MIME types are defined for convenience. + // These were "Alt*". Removed at Jena6. public static final String contentTypeTurtle = "text/turtle"; public static final ContentType ctTurtle = ContentType.create(contentTypeTurtle); - public static final String contentTypeTurtleAlt = "application/turtle"; - public static final ContentType ctTurtleAlt = ContentType.create(contentTypeTurtleAlt); +// public static final String contentTypeTurtleAlt = "application/turtle"; +// public static final ContentType ctTurtleAlt = ContentType.create(contentTypeTurtleAlt); public static final String contentTypeRDFXML = "application/rdf+xml"; public static final ContentType ctRDFXML = ContentType.create(contentTypeRDFXML); @@ -48,15 +49,15 @@ public class WebContent { public static final String contentTypeNTriples = "application/n-triples"; public static final ContentType ctNTriples = ContentType.create(contentTypeNTriples); - // N-Triples was text/pain in RDF 1.0. - public static final String contentTypeNTriplesAlt = "text/plain"; - public static final ContentType ctNTriplesAlt = ContentType.create(contentTypeNTriplesAlt); +// // N-Triples was text/plain in RDF 1.0. +// public static final String contentTypeNTriplesAlt = "text/plain"; +// public static final ContentType ctNTriplesAlt = ContentType.create(contentTypeNTriplesAlt); public static final String contentTypeXML = "application/xml"; public static final ContentType ctXML = ContentType.create(contentTypeXML); - public static final String contentTypeXMLAlt = "text/xml"; - public static final ContentType ctXMLAlt = ContentType.create(contentTypeXMLAlt); +// public static final String contentTypeXMLAlt = "text/xml"; +// public static final ContentType ctXMLAlt = ContentType.create(contentTypeXMLAlt); public static final String contentTypeTriG = "application/trig"; public static final ContentType ctTriG = ContentType.create(contentTypeTriG); @@ -85,8 +86,8 @@ public class WebContent { public static final String contentTypeMultipartFormData = "multipart/form-data"; public static final ContentType ctMultipartFormData = ContentType.create(contentTypeMultipartFormData); - public static final String contentTypeMultiAlt = "multipart/alternative"; - public static final ContentType ctMultiAlt = ContentType.create(contentTypeMultiAlt); + public static final String contentTypeMultipartAlternative = "multipart/alternative"; + public static final ContentType ctMultipartAlternative = ContentType.create(contentTypeMultipartAlternative); public static final String contentTypeN3 = "text/rdf+n3"; public static final ContentType ctTypeN3 = ContentType.create("text/rdf+n3"); diff --git a/jena-arq/src/test/java/org/apache/jena/riot/web/TestWebContent.java b/jena-arq/src/test/java/org/apache/jena/riot/web/TestWebContent.java index 5f52f2d6e7..d704c22754 100644 --- a/jena-arq/src/test/java/org/apache/jena/riot/web/TestWebContent.java +++ b/jena-arq/src/test/java/org/apache/jena/riot/web/TestWebContent.java @@ -26,32 +26,39 @@ import org.apache.jena.riot.WebContent; public class TestWebContent { + // CanonicaliseMediaTypes tests check that "Alt" forms map to the right type. + // Mostly, the alternative names have been removed as general standards + // compliance on the web has improved. + // + // Elsewhere, "text/plain" is specially handled in content negotiation, + // not by canonicalised media types. + // because files published on the web by simply placing in a directory of the + // HTTP server on the web can return "text/plain". + @Test - public void testCanonicaliseMimeTypes1() { + public void testCanonicaliseMediaTypes1() { testCanonicalise(WebContent.contentTypeTurtle, WebContent.contentTypeTurtle); - testCanonicalise(WebContent.contentTypeTurtleAlt, WebContent.contentTypeTurtle); } @Test - public void testCanonicaliseMimeTypes2() { + public void testCanonicaliseMediaTypes2() { testCanonicalise(WebContent.contentTypeN3, WebContent.contentTypeN3); testCanonicalise(WebContent.contentTypeN3Alt1, WebContent.contentTypeN3); testCanonicalise(WebContent.contentTypeN3Alt2, WebContent.contentTypeN3); } @Test - public void testCanonicaliseMimeTypes3() { + public void testCanonicaliseMediaTypes3() { testCanonicalise(WebContent.contentTypeNTriples, WebContent.contentTypeNTriples); - testCanonicalise(WebContent.contentTypeNTriplesAlt, WebContent.contentTypeNTriples); } @Test - public void testCanonicaliseMimeTypes4() { + public void testCanonicaliseMediaTypes4() { testCanonicalise(WebContent.contentTypeNQuads, WebContent.contentTypeNQuads); } @Test - public void testCanonicaliseMimeTypes5() { + public void testCanonicaliseMediaTypes5() { testCanonicalise(WebContent.contentTypeTriG, WebContent.contentTypeTriG); } diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/DEF.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/DEF.java index 7e1008674b..88dac83f00 100644 --- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/DEF.java +++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/DEF.java @@ -67,9 +67,7 @@ public class DEF public static final AcceptList jsonOfferDefault() { return AcceptList.create(contentTypeJSON); } public static final AcceptList constructOfferDefault() { return AcceptList.create(contentTypeTurtle, - contentTypeTurtleAlt, contentTypeNTriples, - contentTypeNTriplesAlt, contentTypeRDFXML, contentTypeTriX, contentTypeTriXxml, @@ -81,9 +79,7 @@ public class DEF ); } public static final AcceptList rdfOfferDefault() { return AcceptList.create(contentTypeTurtle, - contentTypeTurtleAlt, contentTypeNTriples, - contentTypeNTriplesAlt, contentTypeRDFXML, contentTypeTriX, contentTypeTriXxml,
