You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@abdera.apache.org by Zi Xuan Zhang <zh...@cn.ibm.com> on 2007/08/03 08:21:12 UTC

A problem about URL parsing

Hi,

I am encoutering an exception when executing http request
(get/post/put/delete) when the URL includes '[' and ']'

org.apache.abdera.protocol.client.ClientException:
java.lang.IllegalArgumentException: Invalid uri
'http://localhost/dm/atom/library/[@PzzxLibrary/@RMain.nsf]/feed': escaped
absolute path not valid
      at
org.apache.abdera.protocol.client.CommonsClient.execute(CommonsClient.java:158)
      at org.apache.abdera.protocol.client.Client.post(Client.java:140)

I think this should be an valid URL, since I can get the correct response
from browser. Can you provide some information about this exception? Thanks
a lot!

Best regards,


___________________________________________________________

Zixuan Zhang(张子轩),

IBM Lotus Qucikr API Automation, CSDL,
zhangzix@cn.ibm.com,
86-10-62782244 ext.4648,
2/F, Deshi Building, No. 9, East Road, ShangDi, Beijing 100085, P.R.China.





Re: A problem about URL parsing

Posted by James M Snell <ja...@gmail.com>.
The reasoning behind the error is that the characters [ and ] are
gen-delims and are not legal within IRI segments.  See section 2.2 of
RFC 3987 for more detail.  Those characters need to be percent-encoded.
 A quick test of firefox shows that the browser is, in fact,
percent-encoding those characters when it sends the request over the
wire.  e.g., I typed "http://www.snellspace.com/public/[test]" but it is
sent as http://www.snellspace.com/public/%5Btest%5D.

- James


Zi Xuan Zhang wrote:
> Hi,
> 
> I am encoutering an exception when executing http request
> (get/post/put/delete) when the URL includes '[' and ']'
> 
> org.apache.abdera.protocol.client.ClientException:
> java.lang.IllegalArgumentException: Invalid uri
> 'http://localhost/dm/atom/library/[@PzzxLibrary/@RMain.nsf]/feed':
> escaped absolute path not valid
> at
> org.apache.abdera.protocol.client.CommonsClient.execute(CommonsClient.java:158)
> at org.apache.abdera.protocol.client.Client.post(Client.java:140)
> 
> I think this should be an valid URL, since I can get the correct
> response from browser. Can you provide some information about this
> exception? Thanks a lot!
> 
> Best regards,
> 
> ___________________________________________________________
> *
> Zixuan Zhang(张子轩),*
> 
> IBM Lotus Qucikr API Automation, CSDL,
> zhangzix@cn.ibm.com,
> 86-10-62782244 ext.4648,
> 2/F, Deshi Building, No. 9, East Road, ShangDi, Beijing 100085, P.R.China.
> 
> <http://www.ibm.com/lotus/quickr>
>