0

When dealing with the requests of type

GET /someFile.txt HTTP/1.1

Is there a library that will help you find /someFile.txt with ease, or is it common to manually split and parse things? No big deal, just wondering.

message.split("\\s+")[1] // works but just looks silly
2
  • 2
    What programming language? What environment? Commented Apr 23, 2012 at 18:32
  • Possible duplicate: stackoverflow.com/questions/5625388/… Commented Apr 23, 2012 at 18:41

1 Answer 1

1

If you're on the server (servlet container) side, HttpServletRequest.getPathInfo should do the job.

http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/http/HttpServletRequest.html#getPathInfo()

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.