2010-05-18 14 views
11

dire che mi faccio una richiesta GET come questo:Come ottenere l'url richiesta HttpServletRequest

GET http://cotnet.diggstatic.com:6000/js/loader/443/JS_Libraries,jquery|Class|analytics|lightbox|label|jquery-dom|jquery-cookie?q=hello#frag HTTP/1.0 
Host: cotnet.diggstatic.com:6000 

mio servlet prende richiedere in questo modo: HttpServletRequest req;

Quando metto a punto il mio server ed eseguire, ottengo il seguente:

req.getRequestURL().toString() = "http://cotnet.diggstatic.com:6000/js/loader/443/JS_Libraries,jquery%7cClass%7canalytics%7clightbox%7clabel%7cjquery-dom%7cjquery-cookie" 
req.getRequestURI() = "/js/loader/443/JS_Libraries,jquery%7cClass%7canalytics%7clightbox%7clabel%7cjquery-dom%7cjquery-cookie" 
req.getQueryString() = "q=hello" 

Come si fa ad ottenere le informazioni frammento? Inoltre, quando eseguo il debug della richiesta, vedo un campo uri_ di tipo java.net.URI che contiene le informazioni sul frammento. Questo è esattamente quello che voglio. Come posso averlo?

risposta

Problemi correlati