You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/01/29 13:52:26 UTC

svn commit: r1237267 - in /incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena: atlas/web/TypedStream.java riot/WebContent.java

Author: andy
Date: Sun Jan 29 12:52:24 2012
New Revision: 1237267

URL: http://svn.apache.org/viewvc?rev=1237267&view=rev
Log: (empty)

Modified:
    incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/atlas/web/TypedStream.java
    incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/WebContent.java

Modified: incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/atlas/web/TypedStream.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/atlas/web/TypedStream.java?rev=1237267&r1=1237266&r2=1237267&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/atlas/web/TypedStream.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/atlas/web/TypedStream.java Sun Jan 29 12:52:24 2012
@@ -43,8 +43,8 @@ public class TypedStream
     }
     
     public InputStream getInput()           { return input ; }
-    public String getContentType()          { return mediaType.getContentType() ; }
-    public String getCharset()              { return mediaType.getCharset() ; }
+    public String getContentType()          { return mediaType == null ? null : mediaType.getContentType() ; }
+    public String getCharset()              { return mediaType == null ? null : mediaType.getCharset() ; }
     public ContentType getMediaType()       { return mediaType ; }
     
     public void close()                     { IO.close(input) ; }

Modified: incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/WebContent.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/WebContent.java?rev=1237267&r1=1237266&r2=1237267&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/WebContent.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/WebContent.java Sun Jan 29 12:52:24 2012
@@ -43,6 +43,7 @@ public class WebContent
     public static final String contentTypeTurtle3           = "application/x-turtle" ;
     
     public static final String contentTypeRDFXML            = "application/rdf+xml" ;
+    public static final String contentTypeRDFJSON            = "application/rdf+json" ;
     
     // MIME type for N-triple is text/plain (!!!)
     public static final String contentTypeTextPlain         = "text/plain" ;
@@ -117,8 +118,21 @@ public class WebContent
         mapContentTypeToLang.put(contentTypeTriGAlt,        Lang.TRIG) ;
         
     }
+    
+    /** Return our "canonical" name for a Content Type.
+     * This should be the standard one, no X-* 
+     */
+    public static String contentTypeCanonical(String contentType)
+    { 
+        Lang lang = contentTypeToLang(contentType) ;
+        if ( lang == null )
+            return null ;
+        return mapLangToContentType.get(lang) ;
+    }
+    
     public static Lang contentTypeToLang(String contentType) { return mapContentTypeToLang.get(contentType) ; }
 
+    /** Canonical names */
     private static Map<Lang, String> mapLangToContentType =  new HashMap<Lang, String>() ;
     static {
         mapLangToContentType.put(Lang.N3,           contentTypeN3) ;