jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1362987 - in /jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader: Langs.java WebReader2.java
Date Wed, 18 Jul 2012 15:48:48 GMT
Author: andy
Date: Wed Jul 18 15:48:48 2012
New Revision: 1362987

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

Modified:
    jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/Langs.java
    jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/WebReader2.java

Modified: jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/Langs.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/Langs.java?rev=1362987&r1=1362986&r2=1362987&view=diff
==============================================================================
--- jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/Langs.java (original)
+++ jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/Langs.java Wed Jul 18 15:48:48
2012
@@ -200,7 +200,7 @@ public class Langs
         addQuadSyntax$(langNQuads, WebContent.contentTypeNQuads, pfQuads,           "nq")
;
         addContentTypeLang$(WebContent.contentTypeNQuadsAlt, langNQuads) ;
         
-        // Reader name and variations to lang (compatibility)
+        // Reader name and variations to lang - must include Jena old-name.
         registerShortNameForLang("RDF/XML",         langRDFXML) ;
         registerShortNameForLang("RDFXML",          langRDFXML) ;
         registerShortNameForLang("RDF/XML-ABBREV",  langRDFXML) ;
@@ -214,13 +214,13 @@ public class Langs
         registerShortNameForLang("TURTLE",          langTurtle) ;
         registerShortNameForLang("TTL",             langTurtle) ;
 
+        registerShortNameForLang("RDF/JSON",        langRDFJSON) ;
+        registerShortNameForLang("RDFJSON",         langRDFJSON) ;
+        
         registerShortNameForLang("N-QUADS",         langNQuads) ;
         registerShortNameForLang("NQUADS",          langNQuads) ;
         registerShortNameForLang("NQ",              langNQuads) ;
             
-        registerShortNameForLang("RDF/JSON",        langRDFJSON) ;
-        registerShortNameForLang("RDFJSON",         langRDFJSON) ;
-        
         registerShortNameForLang("TRIG",            langTriG) ;
     }
     

Modified: jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/WebReader2.java
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/WebReader2.java?rev=1362987&r1=1362986&r2=1362987&view=diff
==============================================================================
--- jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/WebReader2.java (original)
+++ jena/Scratch/AFS/Dev/trunk/src/main/java/projects/riot_reader/WebReader2.java Wed Jul
18 15:48:48 2012
@@ -336,16 +336,28 @@ public class WebReader2
     {
         if ( ctStr != null )
             ctStr = WebContent.contentTypeCanonical(ctStr) ;
-        boolean isTextPlain = WebContent.contentTypeTextPlain.equals(ctStr) ;
         
+        boolean isTextPlain = WebContent.contentTypeTextPlain.equals(ctStr) ;
         ContentType ct = (ctStr==null) ? null : ContentType.parse(ctStr) ;
         
+        // It's it's text plain, we ignore it because a lot of naive
+        // server setups return text/plain for any file type.
+        
         if ( ct == null || isTextPlain )
         {
             if ( hintLang == null )
                 ct = Langs.guessContentType(target) ;
             else
+            {
                 ct = Langs.shortNameToContentType(hintLang) ;
+                if ( ct == null )
+                {
+                    // Is the hint a content type?
+                    Lang2 lang = Langs.contentTypeToLang(hintLang) ;
+                    if ( lang != null )
+                        ct = lang.getContentType() ;
+                }
+            }
         }
         return ct ;
     }



Mime
View raw message