You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Ole Matzura <ol...@eviware.com> on 2006/07/05 16:20:30 UTC

are refs allowed in HTTP POST URIs?

Hi all!

I have a soapui user with a web-service endpoint containing a ref as 
follows;

http://somehost.com/my/path#witharef

When using this endpoint as the URI for a PostMethod the ref "#witharef" 
is removed from the path and never transmitted in the request.. I am 
guessing that refs are not actually allowed in this context.. am I right 
or should this be supported?

regards!

/Ole
eviware.com


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: are refs allowed in HTTP POST URIs?

Posted by Ole Matzura <ol...@eviware.com>.
Hi Roland,

thanks again for your answers.. it seems we worked around the issue by 
preencoding the URL.. (since we needed the '#' to be in the URL)

regards!

/Ole

Roland Weber skrev:
> Hello Ole,
>
>   
>> contains a ref which is removed by the httpclient URI 
>> class.. 
>>     
>
> It is not removed by the URI class. It is dropped by the
> HTTP logic in HttpMethodBase.
>
>   
>> is that "correct" behaviour?
>>     
>
> Yes, for the HTTP logic. If it was the URI class that
> dropped the reference, that would be a bug.
>
>   
>> are refs "invalid" in a URI?
>>     
>
> No.
>
>   
>> (The 
>> java.net.URL class handles refs correctly)..
>>     
>
> And so does the URI class. The java.net.HttpURLConnection
> will drop the reference when generating a request.
>
>   
>> Should I tell him not to 
>> use the "#" character in a URI?
>>     
>
> It doesn't matter. As long as he/you are aware that the
> reference will not be sent to the server.
>
> cheers,
>   Roland
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
>
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: are refs allowed in HTTP POST URIs?

Posted by Roland Weber <RO...@de.ibm.com>.
Hello Ole,

> contains a ref which is removed by the httpclient URI 
> class.. 

It is not removed by the URI class. It is dropped by the
HTTP logic in HttpMethodBase.

> is that "correct" behaviour?

Yes, for the HTTP logic. If it was the URI class that
dropped the reference, that would be a bug.

> are refs "invalid" in a URI?

No.

> (The 
> java.net.URL class handles refs correctly)..

And so does the URI class. The java.net.HttpURLConnection
will drop the reference when generating a request.

> Should I tell him not to 
> use the "#" character in a URI?

It doesn't matter. As long as he/you are aware that the
reference will not be sent to the server.

cheers,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: are refs allowed in HTTP POST URIs?

Posted by Ole Matzura <ol...@eviware.com>.
Hi Roland,

thanks for your answer.. I get your point but the URL he is using 
never-the-less contains a ref which is removed by the httpclient URI 
class.. is that "correct" behaviour? are refs "invalid" in a URI? (The 
java.net.URL class handles refs correctly).. Should I tell him not to 
use the "#" character in a URI?

thanks again :-)

regards!

/Ole
eviware.com

Roland Weber skrev:
> Hello Ole,
>
>   
>> http://somehost.com/my/path#witharef
>>
>> When using this endpoint as the URI for a PostMethod the ref "#witharef"
>> is removed from the path and never transmitted in the request.. I am
>> guessing that refs are not actually allowed in this context.. am I right
>> or should this be supported?
>>     
>
> Refs are never part of HTTP requests. They are purely client-side, since
> they point _into_ a document. The HTTP request will always be for the
> whole document. Once the document is on the client, the application
> can then look for the part of the document indicated by the reference.
>
> hope that helps,
>   Roland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
>
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: are refs allowed in HTTP POST URIs?

Posted by Roland Weber <ht...@dubioso.net>.
Hello Ole,

> http://somehost.com/my/path#witharef
> 
> When using this endpoint as the URI for a PostMethod the ref "#witharef"
> is removed from the path and never transmitted in the request.. I am
> guessing that refs are not actually allowed in this context.. am I right
> or should this be supported?

Refs are never part of HTTP requests. They are purely client-side, since
they point _into_ a document. The HTTP request will always be for the
whole document. Once the document is on the client, the application
can then look for the part of the document indicated by the reference.

hope that helps,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org