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/02/02 17:36:46 UTC

svn commit: r1239715 - in /incubator/jena/Jena2/ARQ/trunk/src/main/java: com/hp/hpl/jena/sparql/util/Utils.java com/hp/hpl/jena/update/UpdateRequest.java org/openjena/riot/web/HttpOp.java

Author: andy
Date: Thu Feb  2 16:36:45 2012
New Revision: 1239715

URL: http://svn.apache.org/viewvc?rev=1239715&view=rev
Log:
Fix experimental POST support support.
Return fixed length factional decimal in dateTime.

Modified:
    incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/util/Utils.java
    incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/update/UpdateRequest.java
    incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/web/HttpOp.java

Modified: incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/util/Utils.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/util/Utils.java?rev=1239715&r1=1239714&r2=1239715&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/util/Utils.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/util/Utils.java Thu Feb  2 16:36:45 2012
@@ -95,7 +95,7 @@ public class Utils
     
     public static String calendarToXSDDateTimeString(Calendar cal)
     {
-        return calendarToXSDString(cal, "yyyy-MM-dd'T'HH:mm:ss.S") ;
+        return calendarToXSDString(cal, "yyyy-MM-dd'T'HH:mm:sss.S") ;
     }
     
     public static String calendarToXSDDateString(Calendar cal)

Modified: incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/update/UpdateRequest.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/update/UpdateRequest.java?rev=1239715&r1=1239714&r2=1239715&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/update/UpdateRequest.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/update/UpdateRequest.java Thu Feb  2 16:36:45 2012
@@ -30,7 +30,9 @@ import org.openjena.atlas.io.Printable ;
 import com.hp.hpl.jena.sparql.core.Prologue ;
 import com.hp.hpl.jena.sparql.modify.request.UpdateWriter ;
 
-
+/** A SPARQL Update consists of a number of operations (e.g. INSERT, CLEAR).
+ *  A request is the unit of execution.
+ */
 public class UpdateRequest extends Prologue implements Printable, Iterable<Update>
 {
     private List<Update> operations = new ArrayList<Update>() ;

Modified: incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/web/HttpOp.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/web/HttpOp.java?rev=1239715&r1=1239714&r2=1239715&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/web/HttpOp.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/web/HttpOp.java Thu Feb  2 16:36:45 2012
@@ -145,6 +145,7 @@ public class HttpOp
         try
         {
             e = new StringEntity(content, "UTF-8") ;
+            e.setContentType(contentType) ;
             execHttpPost(url, e, acceptType, handlers) ;
         } catch (UnsupportedEncodingException e1)
         {
@@ -254,20 +255,36 @@ public class HttpOp
                 throw new HttpException(statusLine.getStatusCode()+" "+statusLine.getReasonPhrase()) ;
             }
 
-            String contentType = response.getFirstHeader(HttpNames.hContentType).getValue() ;
-            MediaType mt = new MediaType(contentType) ;
-            String ct = mt.getContentType() ;
-            if ( log.isDebugEnabled() )
-                log.debug(format("[%d] %d %s :: %s",id, statusLine.getStatusCode(), statusLine.getReasonPhrase() , mt)) ;
-
-            HttpResponseHandler handler = handlers.get(ct) ;
-            if ( handler == null )
-                // backstop
-                handler = handlers.get("*") ;
-            if ( handler != null )
-                handler.handle(ct, baseIRI, response) ;
+            String ct = "*" ;
+            MediaType mt = null ;
+            if ( statusLine.getStatusCode() == 200 )
+            {
+                String contentType = response.getFirstHeader(HttpNames.hContentType).getValue() ;
+                if ( contentType != null )
+                {
+                    mt = new MediaType(contentType) ;
+                    if ( log.isDebugEnabled() )
+                        log.debug(format("[%d] %d %s :: %s",id, statusLine.getStatusCode(), statusLine.getReasonPhrase() , mt)) ;
+                }
+                else
+                {
+                    if ( log.isDebugEnabled() )
+                        log.debug(format("[%d] %d %s :: (no content type)",id, statusLine.getStatusCode(), statusLine.getReasonPhrase())) ;
+                }
+                HttpResponseHandler handler = handlers.get(ct) ;
+                if ( handler == null )
+                    // backstop
+                    handler = handlers.get("*") ;
+                if ( handler != null )
+                    handler.handle(ct, baseIRI, response) ;
+                else
+                    log.warn(format("[%d] No handler found for %s", id, ct));
+            }
             else
-                log.warn(format("[%d] No handler found for %s", id, mt));
+            {
+                if( handlers != null )
+                    log.warn(format("[%d] No content returned but handlers provided"));
+            }
         } finally { closeEntity(response.getEntity()) ; }
     }