Revision: 13832
          http://gate.svn.sourceforge.net/gate/?rev=13832&view=rev
Author:   valyt
Date:     2011-05-18 12:30:53 +0000 (Wed, 18 May 2011)

Log Message:
-----------
Added a request property to the URL Connection used to communicate with the 
SPARQL endpoint.

Modified Paths:
--------------
    
mimir/trunk/plugins/sparql/src/gate/mimir/sparql/SPARQLSemanticAnnotationHelper.java

Modified: 
mimir/trunk/plugins/sparql/src/gate/mimir/sparql/SPARQLSemanticAnnotationHelper.java
===================================================================
--- 
mimir/trunk/plugins/sparql/src/gate/mimir/sparql/SPARQLSemanticAnnotationHelper.java
        2011-05-18 09:17:06 UTC (rev 13831)
+++ 
mimir/trunk/plugins/sparql/src/gate/mimir/sparql/SPARQLSemanticAnnotationHelper.java
        2011-05-18 12:30:53 UTC (rev 13832)
@@ -24,6 +24,7 @@
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URLConnection;
 import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -261,8 +262,9 @@
       String urlStr =
           sparqlEndpoint + "?query=" + URLEncoder.encode(query, "UTF-8");
       URL url = new URL(urlStr);
-      InputStream is = url.openStream();
-      return new SPARQLResultSet(is);
+      URLConnection urlConn = url.openConnection();
+      urlConn.setRequestProperty("Accept", "application/sparql-results+xml");
+      return new SPARQLResultSet(urlConn.getInputStream());
     } catch(UnsupportedEncodingException e) {
       // like that's gonna happen...
       throw new RuntimeException("UTF-8 encoding not supported by this JVM");


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to