When implementing a proxy server, I get an HTTP request as a string, such as this one:
GET http://localhost:54321/x HTTP/1.1
Host: localhost:54321
Cache-Control: no-cache
Is there a built-in class to parse this request?
I don't know anything about built-in support for such parsing. If you really need such parser, you can check out this lib: http://hc.apache.org/index.html
Here's detailed example: http://www.mail-archive.com/[email protected]/msg04070.html
if "built in" means the JDK I am pretty sure there is no class that does you bidding.
As Lukas says, HttpComponents might be of help. Even if there is no class that does exactly what you want there is code available to look at how they do it.
It is not very hard to implement this yourself though. Some string splitting will do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With