• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpServletRequest  RSS feed

 
Dar Var
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've imported

import javax.servlet.*;
import javax.servlet.http.*;

I have a HttpServletRequest reference called request. I try

String requestURL = request.getRequestURL().toString();

but get

cannot resolve symbol: method getRequestURL ()in interface javax.servlet.http.HttpServletRequest

Why does this happen when HttpServletRequest has a getRequestURL method?
This error occurs for both 1.3.1 and 1.4.2
 
Bindesh Vij
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try getRequestURI()
instead of getRequestURL()
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getRequestURL() and getRequestURI() are both valid but different methods on the request interface. I'm at a loss to explain the compilation error.

You mentioned the JDK versions you are using, but that's moot. What version of the Servlet API are you compiling against?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!