HTTP Analysis Retrieving Requests in Compound Fields

I have fields like:

"GET /?blahblahblah HTTP/1.1" 200 43 "http://www.thesun.co.uk/sol/homepage/" 1 blahblah - "en-gb" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB0.0; FunWebProducts; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"

I am looking for a java library or code that can decode this, parse it separately and provide programmatic access to the components, especially user agent information. googling didn’t help, but since this information is used all the time, existing systems must exist to do what I need.

+3
source share
2 answers

You might want to use Apache HttpCore . The interface you are looking for is HttpRequest , and the simple implementation is BasicHttpRequest .

HttpRequest , , , , -, , :

DefaultHttpServerConnection serverConnection = new DefaultHttpServerConnection();
serverConnection.bind(socket, params);
HttpRequest httpRequest = serverConnection.receiveRequestHeader();
+3

, , - apache LOG. JXLA google "Java apache log parser".

0

Source: https://habr.com/ru/post/1769038/


All Articles