开发者

Is there a way to intentionaly ignore RFC-2396 in constructing a URI

开发者 https://www.devze.com 2023-03-03 17:31 出处:网络
I\'m trying to construct a java.net.URI with illegal characters as the server is a piece of old hardware, not being able to decode RFC-2396 complients URIs. This server demands a http-get with a URI l

I'm trying to construct a java.net.URI with illegal characters as the server is a piece of old hardware, not being able to decode RFC-2396 complients URIs. This server demands a http-get with a URI like this

http://192.168.5.10/cgi-bin/Read.exe?+0+ABC/info.xml+<g>Template</g> 

?+0+ABC/info.xml+<g>Template</g> is the illegal part of the URI and I'll get an java.net.开发者_C百科MalformedURLException Exception.

Decoding this part of the URI to %2B0%2BABC%2Finfo.xml%2B%3Cg%3ETemplate%3C%2Fg%3E get's me a server exception.

I'm wondering if there is a way to get non RFC-2396 complient java.net.URIs on the wire?


The only way to do this would be to not use URLConnection at all, and just write the HTTP request by hand.

If the hardware you're connecting to is determined, so you're pretty sure on what headers to expect, this should not be that difficult; HTTP is a relatively easy protocol.

I did this once myself :)

0

精彩评论

暂无评论...
验证码 换一张
取 消