You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Martynas Jusevičius <ma...@graphity.org> on 2013/12/10 15:33:14 UTC

HttpException: 411 - Length Required

Hey,

after upgrade to 2.11.0 I get this exception during Graph Store
Protocol request:

org.apache.jena.atlas.web.HttpException: 411 - Length Required
org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1020)
org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:633)
org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:601)
org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:184)
org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:179)
org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:98)
org.graphity.server.util.DataManager.addModel(DataManager.java:440)

Has something changed wrt to Content-Length? I guess I'll need to
extend DatasetGraphAccessorHTTP... Or is there an easier way to work
around this?

Martynas
graphityhq.com

Re: HttpException: 411 - Length Required

Posted by Martynas Jusevičius <ma...@graphity.org>.
Nagore, you'd have a better chance of response if you started a new
thread instead of replying to a random one with a question.

On Tue, Dec 10, 2013 at 3:48 PM, Nagore Salaberria <na...@gmail.com> wrote:
> Hello,
>
> First of all congratulations for the great work you have done with the JENA
> API .My name is Nagore and I'm developing my thesis and for that I need to
> make a prototype that enables me to read my rdf files and SPARQL queries
> performed on them . So I thought using Jena and when I drove to make my
> first test, I ran into the following error:
>
> *Exception in thread " main" org.apache.jena.riot.RiotException : Invalid
> byte 1 of 1 - byte UTF -8 sequence .*
> *at org.apache.jena.riot.system.ErrorHandlerFactory $ ErrorHandlerStd.fatal
> ( ErrorHandlerFactory.java : 136 )*
> *org.apache.jena.riot.lang.LangRDFXML at $ ErrorHandlerBridge.fatalError (
> LangRDFXML.java : 243 )*
> *at com.hp.hpl.jena.rdf.arp.impl.ARPSaxErrorHandler.fatalError (
> ARPSaxErrorHandler.java : 48 )*
> *at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.warning ( XMLHandler.java :
> 209)*
> *at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.fatalError ( XMLHandler.java :
> 239 )*
> *org.apache.xerces.util.ErrorHandlerWrapper.fatalError at ( Unknown Source
> )*
> *org.apache.xerces.impl.XMLErrorReporter.reportError at ( Unknown Source )*
> *org.apache.xerces.impl.XMLErrorReporter.reportError at ( Unknown Source )*
> *org.apache.xerces.impl.XMLDocumentFragmentScannerImpl at $
> FragmentContentDispatcher.dispatch ( Unknown Source )*
> *org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument at (
> Unknown Source )*
> *org.apache.xerces.parsers.DTDConfiguration.parse at ( Unknown Source )*
> *org.apache.xerces.parsers.DTDConfiguration.parse at ( Unknown Source )*
> *at org.apache.xerces.parsers.XMLParser.parse ( Unknown Source )*
> *at org.apache.xerces.parsers.AbstractSAXParser.parse ( Unknown Source )*
> *at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.parse ( RDFXMLParser.java :
> 151 )*
> *at com.hp.hpl.jena.rdf.arp.ARP.load ( ARP.java : 119 )*
> *at org.apache.jena.riot.lang.LangRDFXML.parse ( LangRDFXML.java : 142 )*
> *org.apache.jena.riot.RDFParserRegistry at $ ReaderRIOTFactoryImpl $ 1.read
> ( RDFParserRegistry.java : 142 )*
> *at org.apache.jena.riot.RDFDataMgr.process ( RDFDataMgr.java : 818)*
> *at org.apache.jena.riot.RDFDataMgr.parse ( RDFDataMgr.java : 679 )*
> *at org.apache.jena.riot.RDFDataMgr.read ( RDFDataMgr.java : 211 )*
> *at org.apache.jena.riot.RDFDataMgr.read ( RDFDataMgr.java : 184 )*
> *at org.apache.jena.riot.RDFDataMgr.read ( RDFDataMgr.java : 122 )*
> *at org.apache.jena.riot.RDFDataMgr.read ( RDFDataMgr.java : 113 )*
> *at org.apache.jena.riot.adapters.RDFReaderRIOT.read ( RDFReaderRIOT.java :
> 77 )*
> *at com.hp.hpl.jena.rdf.model.impl.ModelCom.read ( ModelCom.java : 247 )*
> *at com.hp.hpl.jena.util.FileManager.readModelWorker ( FileManager.java :
> 395 )*
> *at com.hp.hpl.jena.util.FileManager.loadModelWorker ( FileManager.java :
> 326 )*
> *at com.hp.hpl.jena.util.FileManager.loadModel ( FileManager.java : 278 )*
> *at tutorial.prueba.sparqlTest ( prueba.java : 38 )*
> *at tutorial.prueba.main ( prueba.java : 30 )*
>
>
> This would be my code:
>
>
>
> *package tutorial ;*
>
> *javax.management.Query import ;*
> *org.apache.jena.iri.impl.Main import ;*
> *import com.hp.hpl.jena * . ;*
> *com.hp.hpl.jena.query.QueryExecution import ;*
> *com.hp.hpl.jena.query.QueryExecutionFactory import ;*
> *com.hp.hpl.jena.query.QueryFactory import ;*
> *com.hp.hpl.jena.query.QuerySolution import ;*
> *com.hp.hpl.jena.query.ResultSet import ;*
> *com.hp.hpl.jena.rdf.model.Literal import ;*
> *com.hp.hpl.jena.rdf.model.Model import ;*
> *com.hp.hpl.jena.util.FileManager import ;*
>
>
> *public class Test {*
>
>
>
>
> *public static void main ( String args [ ] )*
> *{*
>
> *sparqlTest ( ) ;*
> *}*
>
>
> *static void sparqlTest ()*
> *{*
>
> *FileManager.get () addLocatorClassLoader ( Main.class.getClassLoader ()).
> ;*
> *FileManager.get Model model = () loadModel (
> " http://localhost/loadtest.rdf <http://localhost/loadtest.rdf> ") ;*
>
> *String querys =*
> *" PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#>> " +*
> *" PREFIX gr: <htto://purl.org/goodrelations/v1#
> <http://purl.org/goodrelations/v1#>> " +*
> *"SELECT * WHERE { " +*
> *"? p to gr: offering " +*
> *" ? p gr : name x ? " +*
> *" }";*
>
> *com.hp.hpl.jena.query.Query QueryFactory.create q = ( querys );*
> *QueryExecution QueryExecutionFactory.create exe = ( q , model );*
>
> *try {*
> *ResultSet result = exe.execSelect ();*
> *while ( result.hasNext ())*
> *{*
>
> *QuerySolution result.nextSolution sun = ();*
> *Sol.getLiteral name = Literal ("x" );*
> *System.out.println ();*
> *}*
> *finally { }*
> *exe.close ( ) ;*
> *}*
> *}*
>
> *}*
>
>
> and my rdf file :
>
> *<? xml version = "1.0 " encoding = "UTF -8 ">*
> *< rdf : RDF xmlns: g = " http://purl.org/goodrelations/v1
> <http://purl.org/goodrelations/v1> #" xmlns: xsd =
> " http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema> #"
> xmlns: rdf = " http:/ / www.w3.org/1999/02/22-rdf-syntax-ns
> <http://www.w3.org/1999/02/22-rdf-syntax-ns> # " >*
>
> *< g : offering*
> *<gr:condition> available with different options < / g : condition>*
>
> *<gr:hasPriceSpecification>*
> *<gr:UnitPriceSpecification>*
> *<gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float
> <http://www.w3.org/2001/XMLSchema#float>"> € 279.66 < / gr:
> hasCurrencyValue >*
> *< / gr: UnitPriceSpecification >*
> *< / gr: hasPriceSpecification >*
> *< g : image / >*
> *<gr:name> bicycle training roller Roller Elite AL13 < / gr: name>*
> *< / gr: offering>*
>
> *< g : offering*
> *<gr:condition> available with different options < / g : condition>*
>
> *<gr:hasPriceSpecification>*
> *<gr:UnitPriceSpecification>*
> *<gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float
> <http://www.w3.org/2001/XMLSchema#float>"> € 444.23 < / gr:
> hasCurrencyValue >*
> *< / gr: UnitPriceSpecification >*
> *< / gr: hasPriceSpecification >*
> *< g : image / >*
> *<gr:name> bicycle training roller Arion Digital Elite Roller < / gr: name>*
> *< / gr: offering>*
> *< / rdf : RDF >*
>
>
>
>
> I hope your answer,
>
> Regards,
>
>
> 2013/12/10 Martynas Jusevičius <ma...@graphity.org>
>
>> Hey,
>>
>> after upgrade to 2.11.0 I get this exception during Graph Store
>> Protocol request:
>>
>> org.apache.jena.atlas.web.HttpException: 411 - Length Required
>> org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1020)
>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:633)
>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:601)
>>
>> org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:184)
>>
>> org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:179)
>> org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:98)
>> org.graphity.server.util.DataManager.addModel(DataManager.java:440)
>>
>> Has something changed wrt to Content-Length? I guess I'll need to
>> extend DatasetGraphAccessorHTTP... Or is there an easier way to work
>> around this?
>>
>> Martynas
>> graphityhq.com
>>
>
>
>
> --
> Nagore Salaberria<na...@gmail.com>

Invalid,byte 1 of 1 - byte UTF -8 sequence

Posted by Andy Seaborne <an...@apache.org>.
On 10/12/13 14:48, Nagore Salaberria wrote:
> Hello,
>
> First of all congratulations for the great work you have done with the JENA
> API .My name is Nagore and I'm developing my thesis and for that I need to
> make a prototype that enables me to read my rdf files and SPARQL queries
> performed on them . So I thought using Jena and when I drove to make my
> first test, I ran into the following error:

You have already asked this question (5th Dec) and got answers.  It 
looks liek you are reading broken data.  Please read those answers and 
provide more (and readable) information in a *complete*, *minimal* 
example if they do not answer your issue.

	Andy




Re: HttpException: 411 - Length Required

Posted by Nagore Salaberria <na...@gmail.com>.
Hello,

First of all congratulations for the great work you have done with the JENA
API .My name is Nagore and I'm developing my thesis and for that I need to
make a prototype that enables me to read my rdf files and SPARQL queries
performed on them . So I thought using Jena and when I drove to make my
first test, I ran into the following error:

*Exception in thread " main" org.apache.jena.riot.RiotException : Invalid
byte 1 of 1 - byte UTF -8 sequence .*
*at org.apache.jena.riot.system.ErrorHandlerFactory $ ErrorHandlerStd.fatal
( ErrorHandlerFactory.java : 136 )*
*org.apache.jena.riot.lang.LangRDFXML at $ ErrorHandlerBridge.fatalError (
LangRDFXML.java : 243 )*
*at com.hp.hpl.jena.rdf.arp.impl.ARPSaxErrorHandler.fatalError (
ARPSaxErrorHandler.java : 48 )*
*at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.warning ( XMLHandler.java :
209)*
*at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.fatalError ( XMLHandler.java :
239 )*
*org.apache.xerces.util.ErrorHandlerWrapper.fatalError at ( Unknown Source
)*
*org.apache.xerces.impl.XMLErrorReporter.reportError at ( Unknown Source )*
*org.apache.xerces.impl.XMLErrorReporter.reportError at ( Unknown Source )*
*org.apache.xerces.impl.XMLDocumentFragmentScannerImpl at $
FragmentContentDispatcher.dispatch ( Unknown Source )*
*org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument at (
Unknown Source )*
*org.apache.xerces.parsers.DTDConfiguration.parse at ( Unknown Source )*
*org.apache.xerces.parsers.DTDConfiguration.parse at ( Unknown Source )*
*at org.apache.xerces.parsers.XMLParser.parse ( Unknown Source )*
*at org.apache.xerces.parsers.AbstractSAXParser.parse ( Unknown Source )*
*at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.parse ( RDFXMLParser.java :
151 )*
*at com.hp.hpl.jena.rdf.arp.ARP.load ( ARP.java : 119 )*
*at org.apache.jena.riot.lang.LangRDFXML.parse ( LangRDFXML.java : 142 )*
*org.apache.jena.riot.RDFParserRegistry at $ ReaderRIOTFactoryImpl $ 1.read
( RDFParserRegistry.java : 142 )*
*at org.apache.jena.riot.RDFDataMgr.process ( RDFDataMgr.java : 818)*
*at org.apache.jena.riot.RDFDataMgr.parse ( RDFDataMgr.java : 679 )*
*at org.apache.jena.riot.RDFDataMgr.read ( RDFDataMgr.java : 211 )*
*at org.apache.jena.riot.RDFDataMgr.read ( RDFDataMgr.java : 184 )*
*at org.apache.jena.riot.RDFDataMgr.read ( RDFDataMgr.java : 122 )*
*at org.apache.jena.riot.RDFDataMgr.read ( RDFDataMgr.java : 113 )*
*at org.apache.jena.riot.adapters.RDFReaderRIOT.read ( RDFReaderRIOT.java :
77 )*
*at com.hp.hpl.jena.rdf.model.impl.ModelCom.read ( ModelCom.java : 247 )*
*at com.hp.hpl.jena.util.FileManager.readModelWorker ( FileManager.java :
395 )*
*at com.hp.hpl.jena.util.FileManager.loadModelWorker ( FileManager.java :
326 )*
*at com.hp.hpl.jena.util.FileManager.loadModel ( FileManager.java : 278 )*
*at tutorial.prueba.sparqlTest ( prueba.java : 38 )*
*at tutorial.prueba.main ( prueba.java : 30 )*


This would be my code:



*package tutorial ;*

*javax.management.Query import ;*
*org.apache.jena.iri.impl.Main import ;*
*import com.hp.hpl.jena * . ;*
*com.hp.hpl.jena.query.QueryExecution import ;*
*com.hp.hpl.jena.query.QueryExecutionFactory import ;*
*com.hp.hpl.jena.query.QueryFactory import ;*
*com.hp.hpl.jena.query.QuerySolution import ;*
*com.hp.hpl.jena.query.ResultSet import ;*
*com.hp.hpl.jena.rdf.model.Literal import ;*
*com.hp.hpl.jena.rdf.model.Model import ;*
*com.hp.hpl.jena.util.FileManager import ;*


*public class Test {*




*public static void main ( String args [ ] )*
*{*

*sparqlTest ( ) ;*
*}*


*static void sparqlTest ()*
*{*

*FileManager.get () addLocatorClassLoader ( Main.class.getClassLoader ()).
;*
*FileManager.get Model model = () loadModel (
" http://localhost/loadtest.rdf <http://localhost/loadtest.rdf> ") ;*

*String querys =*
*" PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
<http://www.w3.org/1999/02/22-rdf-syntax-ns#>> " +*
*" PREFIX gr: <htto://purl.org/goodrelations/v1#
<http://purl.org/goodrelations/v1#>> " +*
*"SELECT * WHERE { " +*
*"? p to gr: offering " +*
*" ? p gr : name x ? " +*
*" }";*

*com.hp.hpl.jena.query.Query QueryFactory.create q = ( querys );*
*QueryExecution QueryExecutionFactory.create exe = ( q , model );*

*try {*
*ResultSet result = exe.execSelect ();*
*while ( result.hasNext ())*
*{*

*QuerySolution result.nextSolution sun = ();*
*Sol.getLiteral name = Literal ("x" );*
*System.out.println ();*
*}*
*finally { }*
*exe.close ( ) ;*
*}*
*}*

*}*


and my rdf file :

*<? xml version = "1.0 " encoding = "UTF -8 ">*
*< rdf : RDF xmlns: g = " http://purl.org/goodrelations/v1
<http://purl.org/goodrelations/v1> #" xmlns: xsd =
" http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema> #"
xmlns: rdf = " http:/ / www.w3.org/1999/02/22-rdf-syntax-ns
<http://www.w3.org/1999/02/22-rdf-syntax-ns> # " >*

*< g : offering*
*<gr:condition> available with different options < / g : condition>*

*<gr:hasPriceSpecification>*
*<gr:UnitPriceSpecification>*
*<gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float
<http://www.w3.org/2001/XMLSchema#float>"> € 279.66 < / gr:
hasCurrencyValue >*
*< / gr: UnitPriceSpecification >*
*< / gr: hasPriceSpecification >*
*< g : image / >*
*<gr:name> bicycle training roller Roller Elite AL13 < / gr: name>*
*< / gr: offering>*

*< g : offering*
*<gr:condition> available with different options < / g : condition>*

*<gr:hasPriceSpecification>*
*<gr:UnitPriceSpecification>*
*<gr:hasCurrencyValue rdf:datatype="http://www.w3.org/2001/XMLSchema#float
<http://www.w3.org/2001/XMLSchema#float>"> € 444.23 < / gr:
hasCurrencyValue >*
*< / gr: UnitPriceSpecification >*
*< / gr: hasPriceSpecification >*
*< g : image / >*
*<gr:name> bicycle training roller Arion Digital Elite Roller < / gr: name>*
*< / gr: offering>*
*< / rdf : RDF >*




I hope your answer,

Regards,


2013/12/10 Martynas Jusevičius <ma...@graphity.org>

> Hey,
>
> after upgrade to 2.11.0 I get this exception during Graph Store
> Protocol request:
>
> org.apache.jena.atlas.web.HttpException: 411 - Length Required
> org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1020)
> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:633)
> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:601)
>
> org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:184)
>
> org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:179)
> org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:98)
> org.graphity.server.util.DataManager.addModel(DataManager.java:440)
>
> Has something changed wrt to Content-Length? I guess I'll need to
> extend DatasetGraphAccessorHTTP... Or is there an easier way to work
> around this?
>
> Martynas
> graphityhq.com
>



-- 
Nagore Salaberria<na...@gmail.com>

Re: HttpException: 411 - Length Required

Posted by james anderson <ja...@dydra.com>.
good afternoon;

On 12 Dec 2013, at 12:55 PM, Andy Seaborne wrote:

> On 12/12/13 11:08, Martynas Jusevičius wrote:
>> Andy,
>> 
>> speaking of nginx - maybe you happen to know if is possible to limit
>> request content size without a Content-Length header?
>> 
>> Martynas
> 
> Don't know - I would not be surprised if it's "can't" because in a stream, the length isn't known so you can only cleanly reject it (413) by reading up to the limit without passing it on the intended target function.

as this issue has been raised in this venue, it makes sense to describe why this works out this way in a concrete case.

mr jusevičius makes requests to a public site. in this situation, even though access is authenticated, there are only limited, somewhat high latency controls on the individual users' behaviour. under which circumstances, despite our clear guidelines, we have too often had imports terminated after dbpedia or equivalent content had been read and cached, because the size was well above the agreed limits. without ascribing intent, it stopped making sense to leave an evident dos vector unmitigated, the content length constraint prior to processing made sense, and it was imposed.
it happens, that on the host in question the restriction applies to all accounts (see above).

one could supplant the chunking implementation or otherwise count bytes and impose the length limitation on the fly thereby eliminating the header requirement.
should use cases demonstrate this to be the best implementation form, this remains an alternative.

> 
> Otherwise, the intended target may see the data start coming in, start working, send 200 and start to send out it's own stream of results and ... then have a problem because you can't now send 413.

the nginx (or equivalent) cgi support could well - or could well have been implemented to, include protocol agreements with the cgi backend, that it refrain from emitting premature 200's, which would make possible to effect content length control without caching. that is, should a limit be exceeded, nginx could well terminate the processing and emit the 413 autonomously.  i have not discovered this to be the case.


> 
> Fuseki streams data in but it's still a transaction (see the "Fuseki v1.0.0 data import problems" message) because it may fail for some reason e.g parse error way down the stream.

is there any support in the http protocol to negotiate a content-length requirement?
evidently, it does not suffice to use the response status to indicate that one is required,.
what would happen, if the server were to effect a configuration such that it announces itself as limited to http 1.0?
in general, to play dumb is a bad idea, especially where the server would intend to stream results from a query in response to a post request, but i am curious.

best regards, from berlin,


---
james anderson | james@dydra.com | http://dydra.com






Re: HttpException: 411 - Length Required

Posted by Andy Seaborne <an...@apache.org>.
On 12/12/13 11:08, Martynas Jusevičius wrote:
> Andy,
>
> speaking of nginx - maybe you happen to know if is possible to limit
> request content size without a Content-Length header?
>
> Martynas

Don't know - I would not be surprised if it's "can't" because in a 
stream, the length isn't known so you can only cleanly reject it (413) 
by reading up to the limit without passing it on the intended target 
function.

Otherwise, the intended target may see the data start coming in, start 
working, send 200 and start to send out it's own stream of results and 
... then have a problem because you can't now send 413.

Fuseki streams data in but it's still a transaction (see the "Fuseki 
v1.0.0 data import problems" message) because it may fail for some 
reason e.g parse error way down the stream.

	Andy

>
> On Tue, Dec 10, 2013 at 6:53 PM, Andy Seaborne <an...@apache.org> wrote:
>> On 10/12/13 16:26, Martynas Jusevičius wrote:
>>>
>>> I'm upgrading from an old version of DatasetGraphAccessorHTTP (that I
>>> had tweaked to support authentication):
>>>
>>> https://github.com/Graphity/graphity-ldp/blob/master/src/main/java/org/graphity/update/DatasetGraphAccessorHTTP.java
>>
>>
>> HttpClient must be doing it because of the HttpEntity that is set.
>>
>>>
>>> The server is Dydra and the log follows. If getting the server to
>>> stream is not possible at the moment, what are my options?
>>
>>
>> 1/ Call HttpOps.execHttpPost(String.HttpEntity) yourself.
>>
>> 2/ Change DatasetGraphAccessorHTTP.graphToHttpEntity to use the same sort of
>> HttpEntity as before (which will send a single Conent-Length set
>>
>> 3/ ?? Use a different HttpClient from the default
>>     See HttpOps.setDefaultHttpClient
>>     No idea what the right setting are I'm afraid.
>>
>> 4/ Get Dydra to support streaming - I guess they don't support chunk
>> encoding and only support simple modes with Content-Length: - but it looks
>> like nginx proxied to the backend so hard to be sure.
>>
>> It's http-client that's doing that and as a very well used piece of
>> software, I'm mildly confident it is doing the right thing.
>>
>> Maybe it's just a matter of tuning that off (see 3).
>>
>> http://en.wikipedia.org/wiki/Chunked_transfer_encoding
>>
>> """
>> Chunked encoding has the benefit that it is not necessary to generate the
>> full content before writing the header, as it allows streaming of content as
>> chunks and explicitly signaling the end of the content, making the
>> connection available for the next HTTP request/response.
>> """
>>
>>
>> I suppose we could have an option on DatasetGraphAccessorHTTP for
>> "inefficient" mode (several of us are rather pro streaming :-) but not the
>> default.
>>
>>          Andy
>>
>>
>>>
>>> 15:17:05,340 DEBUG wire:63 - >> "POST
>>>
>>> /graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
>>> HTTP/1.1[\r][\n]"
>>> 15:17:05,340 DEBUG wire:63 - >> "Transfer-Encoding: chunked[\r][\n]"
>>> 15:17:05,341 DEBUG wire:63 - >> "Content-Type:
>>> application/rdf+xml[\r][\n]"
>>> 15:17:05,341 DEBUG wire:63 - >> "Host: xx.dydra.com[\r][\n]"
>>> 15:17:05,341 DEBUG wire:63 - >> "Connection: Keep-Alive[\r][\n]"
>>> 15:17:05,342 DEBUG wire:63 - >> "User-Agent: Apache-HttpClient/4.2.3
>>> (java 1.5)[\r][\n]"
>>> 15:17:05,342 DEBUG wire:63 - >> "Authorization: Basic
>>> .......[\r][\n]"
>>>
>>> 15:17:05,342 DEBUG wire:63 - >> "[\r][\n]"
>>> 15:17:05,342 DEBUG headers:273 - >> POST
>>>
>>> /graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
>>> HTTP/1.1
>>> 15:17:05,343 DEBUG headers:276 - >> Transfer-Encoding: chunked
>>> 15:17:05,343 DEBUG headers:276 - >> Content-Type: application/rdf+xml
>>> 15:17:05,343 DEBUG headers:276 - >> Host: xx.dydra.com
>>> 15:17:05,343 DEBUG headers:276 - >> Connection: Keep-Alive
>>> 15:17:05,343 DEBUG headers:276 - >> User-Agent:
>>> Apache-HttpClient/4.2.3 (java 1.5)
>>> ...
>>> 15:17:05,406 DEBUG DefaultClientConnection:254 - Receiving response:
>>> HTTP/1.1 411 Length Required
>>> 15:17:05,406 DEBUG headers:257 - << HTTP/1.1 411 Length Required
>>> 15:17:05,407 DEBUG headers:260 - << Server: nginx/1.2.1
>>> 15:17:05,407 DEBUG headers:260 - << Date: Tue, 10 Dec 2013 14:17:07 GMT
>>> 15:17:05,407 DEBUG headers:260 - << Content-Type: text/html
>>> 15:17:05,407 DEBUG headers:260 - << Content-Length: 180
>>> 15:17:05,408 DEBUG headers:260 - << Connection: close
>>> 15:17:05,409 DEBUG SystemDefaultHttpClient:73 - Authentication succeeded
>>> 15:17:05,409 DEBUG HttpOp:1017 - [8] 411 Length Required
>>> 15:17:05,410 DEBUG DefaultClientConnection:169 - Connection
>>> 0.0.0.0:51690<->176.9.131.227:80 closed
>>> 15:17:05,410 DEBUG PoolingClientConnectionManager:281 - Connection
>>> released: [id: 7][route: {}->http://xx.dydra.com][total kept alive:
>>>
>>> On Tue, Dec 10, 2013 at 5:18 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>> On 10/12/13 14:33, Martynas Jusevičius wrote:
>>>>>
>>>>>
>>>>> Hey,
>>>>>
>>>>> after upgrade to 2.11.0 I get this exception during Graph Store
>>>>> Protocol request:
>>>>>
>>>>> org.apache.jena.atlas.web.HttpException: 411 - Length Required
>>>>> org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1020)
>>>>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:633)
>>>>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:601)
>>>>>
>>>>>
>>>>> org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:184)
>>>>>
>>>>>
>>>>> org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:179)
>>>>> org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:98)
>>>>> org.graphity.server.util.DataManager.addModel(DataManager.java:440)
>>>>>
>>>>> Has something changed wrt to Content-Length? I guess I'll need to
>>>>> extend DatasetGraphAccessorHTTP... Or is there an easier way to work
>>>>> around this?
>>>>>
>>>>> Martynas
>>>>> graphityhq.com
>>>>>
>>>>
>>>> Looks like the server not liking the client request - what did the server
>>>> say about the request? (and what is the server?)
>>>>
>>>> ARQ like to stream - and that means no content length.
>>>>
>>>> What does the Jena code from the version you are upgarding for under
>>>> DatasetGraphAccessorHTTP look like?
>>>>
>>>>           Andy
>>
>>


Re: HttpException: 411 - Length Required

Posted by Martynas Jusevičius <ma...@graphity.org>.
Andy,

speaking of nginx - maybe you happen to know if is possible to limit
request content size without a Content-Length header?

Martynas

On Tue, Dec 10, 2013 at 6:53 PM, Andy Seaborne <an...@apache.org> wrote:
> On 10/12/13 16:26, Martynas Jusevičius wrote:
>>
>> I'm upgrading from an old version of DatasetGraphAccessorHTTP (that I
>> had tweaked to support authentication):
>>
>> https://github.com/Graphity/graphity-ldp/blob/master/src/main/java/org/graphity/update/DatasetGraphAccessorHTTP.java
>
>
> HttpClient must be doing it because of the HttpEntity that is set.
>
>>
>> The server is Dydra and the log follows. If getting the server to
>> stream is not possible at the moment, what are my options?
>
>
> 1/ Call HttpOps.execHttpPost(String.HttpEntity) yourself.
>
> 2/ Change DatasetGraphAccessorHTTP.graphToHttpEntity to use the same sort of
> HttpEntity as before (which will send a single Conent-Length set
>
> 3/ ?? Use a different HttpClient from the default
>    See HttpOps.setDefaultHttpClient
>    No idea what the right setting are I'm afraid.
>
> 4/ Get Dydra to support streaming - I guess they don't support chunk
> encoding and only support simple modes with Content-Length: - but it looks
> like nginx proxied to the backend so hard to be sure.
>
> It's http-client that's doing that and as a very well used piece of
> software, I'm mildly confident it is doing the right thing.
>
> Maybe it's just a matter of tuning that off (see 3).
>
> http://en.wikipedia.org/wiki/Chunked_transfer_encoding
>
> """
> Chunked encoding has the benefit that it is not necessary to generate the
> full content before writing the header, as it allows streaming of content as
> chunks and explicitly signaling the end of the content, making the
> connection available for the next HTTP request/response.
> """
>
>
> I suppose we could have an option on DatasetGraphAccessorHTTP for
> "inefficient" mode (several of us are rather pro streaming :-) but not the
> default.
>
>         Andy
>
>
>>
>> 15:17:05,340 DEBUG wire:63 - >> "POST
>>
>> /graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
>> HTTP/1.1[\r][\n]"
>> 15:17:05,340 DEBUG wire:63 - >> "Transfer-Encoding: chunked[\r][\n]"
>> 15:17:05,341 DEBUG wire:63 - >> "Content-Type:
>> application/rdf+xml[\r][\n]"
>> 15:17:05,341 DEBUG wire:63 - >> "Host: xx.dydra.com[\r][\n]"
>> 15:17:05,341 DEBUG wire:63 - >> "Connection: Keep-Alive[\r][\n]"
>> 15:17:05,342 DEBUG wire:63 - >> "User-Agent: Apache-HttpClient/4.2.3
>> (java 1.5)[\r][\n]"
>> 15:17:05,342 DEBUG wire:63 - >> "Authorization: Basic
>> .......[\r][\n]"
>>
>> 15:17:05,342 DEBUG wire:63 - >> "[\r][\n]"
>> 15:17:05,342 DEBUG headers:273 - >> POST
>>
>> /graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
>> HTTP/1.1
>> 15:17:05,343 DEBUG headers:276 - >> Transfer-Encoding: chunked
>> 15:17:05,343 DEBUG headers:276 - >> Content-Type: application/rdf+xml
>> 15:17:05,343 DEBUG headers:276 - >> Host: xx.dydra.com
>> 15:17:05,343 DEBUG headers:276 - >> Connection: Keep-Alive
>> 15:17:05,343 DEBUG headers:276 - >> User-Agent:
>> Apache-HttpClient/4.2.3 (java 1.5)
>> ...
>> 15:17:05,406 DEBUG DefaultClientConnection:254 - Receiving response:
>> HTTP/1.1 411 Length Required
>> 15:17:05,406 DEBUG headers:257 - << HTTP/1.1 411 Length Required
>> 15:17:05,407 DEBUG headers:260 - << Server: nginx/1.2.1
>> 15:17:05,407 DEBUG headers:260 - << Date: Tue, 10 Dec 2013 14:17:07 GMT
>> 15:17:05,407 DEBUG headers:260 - << Content-Type: text/html
>> 15:17:05,407 DEBUG headers:260 - << Content-Length: 180
>> 15:17:05,408 DEBUG headers:260 - << Connection: close
>> 15:17:05,409 DEBUG SystemDefaultHttpClient:73 - Authentication succeeded
>> 15:17:05,409 DEBUG HttpOp:1017 - [8] 411 Length Required
>> 15:17:05,410 DEBUG DefaultClientConnection:169 - Connection
>> 0.0.0.0:51690<->176.9.131.227:80 closed
>> 15:17:05,410 DEBUG PoolingClientConnectionManager:281 - Connection
>> released: [id: 7][route: {}->http://xx.dydra.com][total kept alive:
>>
>> On Tue, Dec 10, 2013 at 5:18 PM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>> On 10/12/13 14:33, Martynas Jusevičius wrote:
>>>>
>>>>
>>>> Hey,
>>>>
>>>> after upgrade to 2.11.0 I get this exception during Graph Store
>>>> Protocol request:
>>>>
>>>> org.apache.jena.atlas.web.HttpException: 411 - Length Required
>>>> org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1020)
>>>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:633)
>>>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:601)
>>>>
>>>>
>>>> org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:184)
>>>>
>>>>
>>>> org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:179)
>>>> org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:98)
>>>> org.graphity.server.util.DataManager.addModel(DataManager.java:440)
>>>>
>>>> Has something changed wrt to Content-Length? I guess I'll need to
>>>> extend DatasetGraphAccessorHTTP... Or is there an easier way to work
>>>> around this?
>>>>
>>>> Martynas
>>>> graphityhq.com
>>>>
>>>
>>> Looks like the server not liking the client request - what did the server
>>> say about the request? (and what is the server?)
>>>
>>> ARQ like to stream - and that means no content length.
>>>
>>> What does the Jena code from the version you are upgarding for under
>>> DatasetGraphAccessorHTTP look like?
>>>
>>>          Andy
>
>

Re: HttpException: 411 - Length Required

Posted by Andy Seaborne <an...@apache.org>.
On 10/12/13 18:08, Martynas Jusevičius wrote:
> Thanks Andy. I'm trying 2/ and 4/ simultaneously. I think an optional
> non-streaming mode would be a good idea anyway.
>
> As a sidenote, I want to complain about extensibility of Jena a
> little. Lets take the same DatasetGraphAccessorHTTP as example:
> - I cannot override graphToHttpEntity() because it is static and
> others depend on it
> - I cannot override doPost() etc. since they're private - would
> protected not be enough?

Fine - can do that but the key is interface DatasetGraphAccessor which 
is public. (now "have done that")

DatasetGraphAccessorHTTP is not exactly rocket science as classes go - 
it's all format-and-call HttpOp.

We are talking about only this much code:

@Override public void httpPost(Graph data)
                   { doPost(targetDefault(), data) ; }

@Override public void httpPost(Node graphName, Graph data)
   { doPost(target(graphName), data) ; }

private void doPost(String url, Graph data) {
         HttpEntity entity = graphToHttpEntity(data) ;
         HttpOp.execHttpPost(url, entity, null, null, this.authenticator) ;
     }

Both httpPost are public!

The whole of GSP isn't rocket science - it's barely rocket enginneering [*].


> - say I want to change the default serialization language to
> N-Triples. I cannot do that sine sendLang is static and there's no
> getter method for it

Submit a patch!

>
> So instead of extending the class and overriding a single method I now
> end up copying over all of the code, because in my opinion there are
> too many static and private methods. End of complaint,

Submit patches!

> Jena is great otherwise :)

Thanks.

	Andy
>
> Martynas

[*] Rocket science is simple to explain - you throw things out the back 
and the rocket goes forward.  Rocket engineering, doing it efficiently 
and safely, is much, much harder.

>
> On Tue, Dec 10, 2013 at 6:53 PM, Andy Seaborne <an...@apache.org> wrote:
>> On 10/12/13 16:26, Martynas Jusevičius wrote:
>>>
>>> I'm upgrading from an old version of DatasetGraphAccessorHTTP (that I
>>> had tweaked to support authentication):
>>>
>>> https://github.com/Graphity/graphity-ldp/blob/master/src/main/java/org/graphity/update/DatasetGraphAccessorHTTP.java
>>
>>
>> HttpClient must be doing it because of the HttpEntity that is set.
>>
>>>
>>> The server is Dydra and the log follows. If getting the server to
>>> stream is not possible at the moment, what are my options?
>>
>>
>> 1/ Call HttpOps.execHttpPost(String.HttpEntity) yourself.
>>
>> 2/ Change DatasetGraphAccessorHTTP.graphToHttpEntity to use the same sort of
>> HttpEntity as before (which will send a single Conent-Length set
>>
>> 3/ ?? Use a different HttpClient from the default
>>     See HttpOps.setDefaultHttpClient
>>     No idea what the right setting are I'm afraid.
>>
>> 4/ Get Dydra to support streaming - I guess they don't support chunk
>> encoding and only support simple modes with Content-Length: - but it looks
>> like nginx proxied to the backend so hard to be sure.
>>
>> It's http-client that's doing that and as a very well used piece of
>> software, I'm mildly confident it is doing the right thing.
>>
>> Maybe it's just a matter of tuning that off (see 3).
>>
>> http://en.wikipedia.org/wiki/Chunked_transfer_encoding
>>
>> """
>> Chunked encoding has the benefit that it is not necessary to generate the
>> full content before writing the header, as it allows streaming of content as
>> chunks and explicitly signaling the end of the content, making the
>> connection available for the next HTTP request/response.
>> """
>>
>>
>> I suppose we could have an option on DatasetGraphAccessorHTTP for
>> "inefficient" mode (several of us are rather pro streaming :-) but not the
>> default.
>>
>>          Andy
>>
>>
>>>
>>> 15:17:05,340 DEBUG wire:63 - >> "POST
>>>
>>> /graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
>>> HTTP/1.1[\r][\n]"
>>> 15:17:05,340 DEBUG wire:63 - >> "Transfer-Encoding: chunked[\r][\n]"
>>> 15:17:05,341 DEBUG wire:63 - >> "Content-Type:
>>> application/rdf+xml[\r][\n]"
>>> 15:17:05,341 DEBUG wire:63 - >> "Host: xx.dydra.com[\r][\n]"
>>> 15:17:05,341 DEBUG wire:63 - >> "Connection: Keep-Alive[\r][\n]"
>>> 15:17:05,342 DEBUG wire:63 - >> "User-Agent: Apache-HttpClient/4.2.3
>>> (java 1.5)[\r][\n]"
>>> 15:17:05,342 DEBUG wire:63 - >> "Authorization: Basic
>>> .......[\r][\n]"
>>>
>>> 15:17:05,342 DEBUG wire:63 - >> "[\r][\n]"
>>> 15:17:05,342 DEBUG headers:273 - >> POST
>>>
>>> /graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
>>> HTTP/1.1
>>> 15:17:05,343 DEBUG headers:276 - >> Transfer-Encoding: chunked
>>> 15:17:05,343 DEBUG headers:276 - >> Content-Type: application/rdf+xml
>>> 15:17:05,343 DEBUG headers:276 - >> Host: xx.dydra.com
>>> 15:17:05,343 DEBUG headers:276 - >> Connection: Keep-Alive
>>> 15:17:05,343 DEBUG headers:276 - >> User-Agent:
>>> Apache-HttpClient/4.2.3 (java 1.5)
>>> ...
>>> 15:17:05,406 DEBUG DefaultClientConnection:254 - Receiving response:
>>> HTTP/1.1 411 Length Required
>>> 15:17:05,406 DEBUG headers:257 - << HTTP/1.1 411 Length Required
>>> 15:17:05,407 DEBUG headers:260 - << Server: nginx/1.2.1
>>> 15:17:05,407 DEBUG headers:260 - << Date: Tue, 10 Dec 2013 14:17:07 GMT
>>> 15:17:05,407 DEBUG headers:260 - << Content-Type: text/html
>>> 15:17:05,407 DEBUG headers:260 - << Content-Length: 180
>>> 15:17:05,408 DEBUG headers:260 - << Connection: close
>>> 15:17:05,409 DEBUG SystemDefaultHttpClient:73 - Authentication succeeded
>>> 15:17:05,409 DEBUG HttpOp:1017 - [8] 411 Length Required
>>> 15:17:05,410 DEBUG DefaultClientConnection:169 - Connection
>>> 0.0.0.0:51690<->176.9.131.227:80 closed
>>> 15:17:05,410 DEBUG PoolingClientConnectionManager:281 - Connection
>>> released: [id: 7][route: {}->http://xx.dydra.com][total kept alive:
>>>
>>> On Tue, Dec 10, 2013 at 5:18 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>> On 10/12/13 14:33, Martynas Jusevičius wrote:
>>>>>
>>>>>
>>>>> Hey,
>>>>>
>>>>> after upgrade to 2.11.0 I get this exception during Graph Store
>>>>> Protocol request:
>>>>>
>>>>> org.apache.jena.atlas.web.HttpException: 411 - Length Required
>>>>> org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1020)
>>>>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:633)
>>>>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:601)
>>>>>
>>>>>
>>>>> org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:184)
>>>>>
>>>>>
>>>>> org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:179)
>>>>> org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:98)
>>>>> org.graphity.server.util.DataManager.addModel(DataManager.java:440)
>>>>>
>>>>> Has something changed wrt to Content-Length? I guess I'll need to
>>>>> extend DatasetGraphAccessorHTTP... Or is there an easier way to work
>>>>> around this?
>>>>>
>>>>> Martynas
>>>>> graphityhq.com
>>>>>
>>>>
>>>> Looks like the server not liking the client request - what did the server
>>>> say about the request? (and what is the server?)
>>>>
>>>> ARQ like to stream - and that means no content length.
>>>>
>>>> What does the Jena code from the version you are upgarding for under
>>>> DatasetGraphAccessorHTTP look like?
>>>>
>>>>           Andy
>>
>>


Re: HttpException: 411 - Length Required

Posted by Martynas Jusevičius <ma...@graphity.org>.
Thanks Andy. I'm trying 2/ and 4/ simultaneously. I think an optional
non-streaming mode would be a good idea anyway.

As a sidenote, I want to complain about extensibility of Jena a
little. Lets take the same DatasetGraphAccessorHTTP as example:
- I cannot override graphToHttpEntity() because it is static and
others depend on it
- I cannot override doPost() etc. since they're private - would
protected not be enough?
- say I want to change the default serialization language to
N-Triples. I cannot do that sine sendLang is static and there's no
getter method for it

So instead of extending the class and overriding a single method I now
end up copying over all of the code, because in my opinion there are
too many static and private methods. End of complaint, Jena is great
otherwise :)

Martynas

On Tue, Dec 10, 2013 at 6:53 PM, Andy Seaborne <an...@apache.org> wrote:
> On 10/12/13 16:26, Martynas Jusevičius wrote:
>>
>> I'm upgrading from an old version of DatasetGraphAccessorHTTP (that I
>> had tweaked to support authentication):
>>
>> https://github.com/Graphity/graphity-ldp/blob/master/src/main/java/org/graphity/update/DatasetGraphAccessorHTTP.java
>
>
> HttpClient must be doing it because of the HttpEntity that is set.
>
>>
>> The server is Dydra and the log follows. If getting the server to
>> stream is not possible at the moment, what are my options?
>
>
> 1/ Call HttpOps.execHttpPost(String.HttpEntity) yourself.
>
> 2/ Change DatasetGraphAccessorHTTP.graphToHttpEntity to use the same sort of
> HttpEntity as before (which will send a single Conent-Length set
>
> 3/ ?? Use a different HttpClient from the default
>    See HttpOps.setDefaultHttpClient
>    No idea what the right setting are I'm afraid.
>
> 4/ Get Dydra to support streaming - I guess they don't support chunk
> encoding and only support simple modes with Content-Length: - but it looks
> like nginx proxied to the backend so hard to be sure.
>
> It's http-client that's doing that and as a very well used piece of
> software, I'm mildly confident it is doing the right thing.
>
> Maybe it's just a matter of tuning that off (see 3).
>
> http://en.wikipedia.org/wiki/Chunked_transfer_encoding
>
> """
> Chunked encoding has the benefit that it is not necessary to generate the
> full content before writing the header, as it allows streaming of content as
> chunks and explicitly signaling the end of the content, making the
> connection available for the next HTTP request/response.
> """
>
>
> I suppose we could have an option on DatasetGraphAccessorHTTP for
> "inefficient" mode (several of us are rather pro streaming :-) but not the
> default.
>
>         Andy
>
>
>>
>> 15:17:05,340 DEBUG wire:63 - >> "POST
>>
>> /graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
>> HTTP/1.1[\r][\n]"
>> 15:17:05,340 DEBUG wire:63 - >> "Transfer-Encoding: chunked[\r][\n]"
>> 15:17:05,341 DEBUG wire:63 - >> "Content-Type:
>> application/rdf+xml[\r][\n]"
>> 15:17:05,341 DEBUG wire:63 - >> "Host: xx.dydra.com[\r][\n]"
>> 15:17:05,341 DEBUG wire:63 - >> "Connection: Keep-Alive[\r][\n]"
>> 15:17:05,342 DEBUG wire:63 - >> "User-Agent: Apache-HttpClient/4.2.3
>> (java 1.5)[\r][\n]"
>> 15:17:05,342 DEBUG wire:63 - >> "Authorization: Basic
>> .......[\r][\n]"
>>
>> 15:17:05,342 DEBUG wire:63 - >> "[\r][\n]"
>> 15:17:05,342 DEBUG headers:273 - >> POST
>>
>> /graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
>> HTTP/1.1
>> 15:17:05,343 DEBUG headers:276 - >> Transfer-Encoding: chunked
>> 15:17:05,343 DEBUG headers:276 - >> Content-Type: application/rdf+xml
>> 15:17:05,343 DEBUG headers:276 - >> Host: xx.dydra.com
>> 15:17:05,343 DEBUG headers:276 - >> Connection: Keep-Alive
>> 15:17:05,343 DEBUG headers:276 - >> User-Agent:
>> Apache-HttpClient/4.2.3 (java 1.5)
>> ...
>> 15:17:05,406 DEBUG DefaultClientConnection:254 - Receiving response:
>> HTTP/1.1 411 Length Required
>> 15:17:05,406 DEBUG headers:257 - << HTTP/1.1 411 Length Required
>> 15:17:05,407 DEBUG headers:260 - << Server: nginx/1.2.1
>> 15:17:05,407 DEBUG headers:260 - << Date: Tue, 10 Dec 2013 14:17:07 GMT
>> 15:17:05,407 DEBUG headers:260 - << Content-Type: text/html
>> 15:17:05,407 DEBUG headers:260 - << Content-Length: 180
>> 15:17:05,408 DEBUG headers:260 - << Connection: close
>> 15:17:05,409 DEBUG SystemDefaultHttpClient:73 - Authentication succeeded
>> 15:17:05,409 DEBUG HttpOp:1017 - [8] 411 Length Required
>> 15:17:05,410 DEBUG DefaultClientConnection:169 - Connection
>> 0.0.0.0:51690<->176.9.131.227:80 closed
>> 15:17:05,410 DEBUG PoolingClientConnectionManager:281 - Connection
>> released: [id: 7][route: {}->http://xx.dydra.com][total kept alive:
>>
>> On Tue, Dec 10, 2013 at 5:18 PM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>> On 10/12/13 14:33, Martynas Jusevičius wrote:
>>>>
>>>>
>>>> Hey,
>>>>
>>>> after upgrade to 2.11.0 I get this exception during Graph Store
>>>> Protocol request:
>>>>
>>>> org.apache.jena.atlas.web.HttpException: 411 - Length Required
>>>> org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1020)
>>>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:633)
>>>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:601)
>>>>
>>>>
>>>> org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:184)
>>>>
>>>>
>>>> org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:179)
>>>> org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:98)
>>>> org.graphity.server.util.DataManager.addModel(DataManager.java:440)
>>>>
>>>> Has something changed wrt to Content-Length? I guess I'll need to
>>>> extend DatasetGraphAccessorHTTP... Or is there an easier way to work
>>>> around this?
>>>>
>>>> Martynas
>>>> graphityhq.com
>>>>
>>>
>>> Looks like the server not liking the client request - what did the server
>>> say about the request? (and what is the server?)
>>>
>>> ARQ like to stream - and that means no content length.
>>>
>>> What does the Jena code from the version you are upgarding for under
>>> DatasetGraphAccessorHTTP look like?
>>>
>>>          Andy
>
>

Re: HttpException: 411 - Length Required

Posted by Andy Seaborne <an...@apache.org>.
On 10/12/13 16:26, Martynas Jusevičius wrote:
> I'm upgrading from an old version of DatasetGraphAccessorHTTP (that I
> had tweaked to support authentication):
> https://github.com/Graphity/graphity-ldp/blob/master/src/main/java/org/graphity/update/DatasetGraphAccessorHTTP.java

HttpClient must be doing it because of the HttpEntity that is set.
>
> The server is Dydra and the log follows. If getting the server to
> stream is not possible at the moment, what are my options?

1/ Call HttpOps.execHttpPost(String.HttpEntity) yourself.

2/ Change DatasetGraphAccessorHTTP.graphToHttpEntity to use the same 
sort of HttpEntity as before (which will send a single Conent-Length set

3/ ?? Use a different HttpClient from the default
    See HttpOps.setDefaultHttpClient
    No idea what the right setting are I'm afraid.

4/ Get Dydra to support streaming - I guess they don't support chunk 
encoding and only support simple modes with Content-Length: - but it 
looks like nginx proxied to the backend so hard to be sure.

It's http-client that's doing that and as a very well used piece of 
software, I'm mildly confident it is doing the right thing.

Maybe it's just a matter of tuning that off (see 3).

http://en.wikipedia.org/wiki/Chunked_transfer_encoding

"""
Chunked encoding has the benefit that it is not necessary to generate 
the full content before writing the header, as it allows streaming of 
content as chunks and explicitly signaling the end of the content, 
making the connection available for the next HTTP request/response.
"""


I suppose we could have an option on DatasetGraphAccessorHTTP for 
"inefficient" mode (several of us are rather pro streaming :-) but not 
the default.

	Andy


>
> 15:17:05,340 DEBUG wire:63 - >> "POST
> /graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
> HTTP/1.1[\r][\n]"
> 15:17:05,340 DEBUG wire:63 - >> "Transfer-Encoding: chunked[\r][\n]"
> 15:17:05,341 DEBUG wire:63 - >> "Content-Type: application/rdf+xml[\r][\n]"
> 15:17:05,341 DEBUG wire:63 - >> "Host: xx.dydra.com[\r][\n]"
> 15:17:05,341 DEBUG wire:63 - >> "Connection: Keep-Alive[\r][\n]"
> 15:17:05,342 DEBUG wire:63 - >> "User-Agent: Apache-HttpClient/4.2.3
> (java 1.5)[\r][\n]"
> 15:17:05,342 DEBUG wire:63 - >> "Authorization: Basic
> .......[\r][\n]"
> 15:17:05,342 DEBUG wire:63 - >> "[\r][\n]"
> 15:17:05,342 DEBUG headers:273 - >> POST
> /graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
> HTTP/1.1
> 15:17:05,343 DEBUG headers:276 - >> Transfer-Encoding: chunked
> 15:17:05,343 DEBUG headers:276 - >> Content-Type: application/rdf+xml
> 15:17:05,343 DEBUG headers:276 - >> Host: xx.dydra.com
> 15:17:05,343 DEBUG headers:276 - >> Connection: Keep-Alive
> 15:17:05,343 DEBUG headers:276 - >> User-Agent:
> Apache-HttpClient/4.2.3 (java 1.5)
> ...
> 15:17:05,406 DEBUG DefaultClientConnection:254 - Receiving response:
> HTTP/1.1 411 Length Required
> 15:17:05,406 DEBUG headers:257 - << HTTP/1.1 411 Length Required
> 15:17:05,407 DEBUG headers:260 - << Server: nginx/1.2.1
> 15:17:05,407 DEBUG headers:260 - << Date: Tue, 10 Dec 2013 14:17:07 GMT
> 15:17:05,407 DEBUG headers:260 - << Content-Type: text/html
> 15:17:05,407 DEBUG headers:260 - << Content-Length: 180
> 15:17:05,408 DEBUG headers:260 - << Connection: close
> 15:17:05,409 DEBUG SystemDefaultHttpClient:73 - Authentication succeeded
> 15:17:05,409 DEBUG HttpOp:1017 - [8] 411 Length Required
> 15:17:05,410 DEBUG DefaultClientConnection:169 - Connection
> 0.0.0.0:51690<->176.9.131.227:80 closed
> 15:17:05,410 DEBUG PoolingClientConnectionManager:281 - Connection
> released: [id: 7][route: {}->http://xx.dydra.com][total kept alive:
>
> On Tue, Dec 10, 2013 at 5:18 PM, Andy Seaborne <an...@apache.org> wrote:
>> On 10/12/13 14:33, Martynas Jusevičius wrote:
>>>
>>> Hey,
>>>
>>> after upgrade to 2.11.0 I get this exception during Graph Store
>>> Protocol request:
>>>
>>> org.apache.jena.atlas.web.HttpException: 411 - Length Required
>>> org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1020)
>>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:633)
>>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:601)
>>>
>>> org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:184)
>>>
>>> org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:179)
>>> org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:98)
>>> org.graphity.server.util.DataManager.addModel(DataManager.java:440)
>>>
>>> Has something changed wrt to Content-Length? I guess I'll need to
>>> extend DatasetGraphAccessorHTTP... Or is there an easier way to work
>>> around this?
>>>
>>> Martynas
>>> graphityhq.com
>>>
>>
>> Looks like the server not liking the client request - what did the server
>> say about the request? (and what is the server?)
>>
>> ARQ like to stream - and that means no content length.
>>
>> What does the Jena code from the version you are upgarding for under
>> DatasetGraphAccessorHTTP look like?
>>
>>          Andy


Re: HttpException: 411 - Length Required

Posted by Martynas Jusevičius <ma...@graphity.org>.
I'm upgrading from an old version of DatasetGraphAccessorHTTP (that I
had tweaked to support authentication):
https://github.com/Graphity/graphity-ldp/blob/master/src/main/java/org/graphity/update/DatasetGraphAccessorHTTP.java

The server is Dydra and the log follows. If getting the server to
stream is not possible at the moment, what are my options?

15:17:05,340 DEBUG wire:63 - >> "POST
/graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
HTTP/1.1[\r][\n]"
15:17:05,340 DEBUG wire:63 - >> "Transfer-Encoding: chunked[\r][\n]"
15:17:05,341 DEBUG wire:63 - >> "Content-Type: application/rdf+xml[\r][\n]"
15:17:05,341 DEBUG wire:63 - >> "Host: xx.dydra.com[\r][\n]"
15:17:05,341 DEBUG wire:63 - >> "Connection: Keep-Alive[\r][\n]"
15:17:05,342 DEBUG wire:63 - >> "User-Agent: Apache-HttpClient/4.2.3
(java 1.5)[\r][\n]"
15:17:05,342 DEBUG wire:63 - >> "Authorization: Basic
Z3JhcGhpdHk6NDZiV0xSUGg2THV0bWQ3Zg==[\r][\n]"
15:17:05,342 DEBUG wire:63 - >> "[\r][\n]"
15:17:05,342 DEBUG headers:273 - >> POST
/graphity/some-test/service?graph=http%3A%2F%2Flocalhost%3A8080%2Fdanske_aviser%2Fgraphs%2Fceb6ec92-3b71-4bc8-a438-a327ba889ecf%23this
HTTP/1.1
15:17:05,343 DEBUG headers:276 - >> Transfer-Encoding: chunked
15:17:05,343 DEBUG headers:276 - >> Content-Type: application/rdf+xml
15:17:05,343 DEBUG headers:276 - >> Host: xx.dydra.com
15:17:05,343 DEBUG headers:276 - >> Connection: Keep-Alive
15:17:05,343 DEBUG headers:276 - >> User-Agent:
Apache-HttpClient/4.2.3 (java 1.5)
...
15:17:05,406 DEBUG DefaultClientConnection:254 - Receiving response:
HTTP/1.1 411 Length Required
15:17:05,406 DEBUG headers:257 - << HTTP/1.1 411 Length Required
15:17:05,407 DEBUG headers:260 - << Server: nginx/1.2.1
15:17:05,407 DEBUG headers:260 - << Date: Tue, 10 Dec 2013 14:17:07 GMT
15:17:05,407 DEBUG headers:260 - << Content-Type: text/html
15:17:05,407 DEBUG headers:260 - << Content-Length: 180
15:17:05,408 DEBUG headers:260 - << Connection: close
15:17:05,409 DEBUG SystemDefaultHttpClient:73 - Authentication succeeded
15:17:05,409 DEBUG HttpOp:1017 - [8] 411 Length Required
15:17:05,410 DEBUG DefaultClientConnection:169 - Connection
0.0.0.0:51690<->176.9.131.227:80 closed
15:17:05,410 DEBUG PoolingClientConnectionManager:281 - Connection
released: [id: 7][route: {}->http://xx.dydra.com][total kept alive:

On Tue, Dec 10, 2013 at 5:18 PM, Andy Seaborne <an...@apache.org> wrote:
> On 10/12/13 14:33, Martynas Jusevičius wrote:
>>
>> Hey,
>>
>> after upgrade to 2.11.0 I get this exception during Graph Store
>> Protocol request:
>>
>> org.apache.jena.atlas.web.HttpException: 411 - Length Required
>> org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1020)
>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:633)
>> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:601)
>>
>> org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:184)
>>
>> org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:179)
>> org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:98)
>> org.graphity.server.util.DataManager.addModel(DataManager.java:440)
>>
>> Has something changed wrt to Content-Length? I guess I'll need to
>> extend DatasetGraphAccessorHTTP... Or is there an easier way to work
>> around this?
>>
>> Martynas
>> graphityhq.com
>>
>
> Looks like the server not liking the client request - what did the server
> say about the request? (and what is the server?)
>
> ARQ like to stream - and that means no content length.
>
> What does the Jena code from the version you are upgarding for under
> DatasetGraphAccessorHTTP look like?
>
>         Andy

Re: HttpException: 411 - Length Required

Posted by Andy Seaborne <an...@apache.org>.
On 10/12/13 14:33, Martynas Jusevičius wrote:
> Hey,
>
> after upgrade to 2.11.0 I get this exception during Graph Store
> Protocol request:
>
> org.apache.jena.atlas.web.HttpException: 411 - Length Required
> org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1020)
> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:633)
> org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:601)
> org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:184)
> org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:179)
> org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:98)
> org.graphity.server.util.DataManager.addModel(DataManager.java:440)
>
> Has something changed wrt to Content-Length? I guess I'll need to
> extend DatasetGraphAccessorHTTP... Or is there an easier way to work
> around this?
>
> Martynas
> graphityhq.com
>

Looks like the server not liking the client request - what did the 
server say about the request? (and what is the server?)

ARQ like to stream - and that means no content length.

What does the Jena code from the version you are upgarding for under 
DatasetGraphAccessorHTTP look like?

	Andy