Probably a typo below, but getRequestURL arrived with the
Servlet 2.3 spec.  This means it is supported in Tomcat 4.x,
but not in Tomcat 3.x which implements the Servlet 2.2 spec.

Larry

> -----Original Message-----
> From: Greg Trasuk [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 23, 2001 5:41 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Newbie question: Has anyone had trouble compiling code
> containing HttpServletRequest.getRequestURL() ???
> 
> 
> Hi Adam:
> 
>       Somewhere in your compiler classpath, you've got an 
> older servlet.jar, as
> the getRequestURL() method arrived in Servlet Spec 2.2.  It may take a
> little hunting to find it, especially if you're using an IDE 
> (I've run into
> this problem with IBM VA-Java v3.5), but what you need to do 
> is get your
> compiler to compile using the servlet.jar that you will find 
> in Tomcat's
> /lib directory.
> 
> Good luck, don't get discouraged, it all eventually works 
> pretty well...
> 
> Greg Trasuk, President
> StratusCom Manufacturing Systems Inc. - We use information 
> technology to
> solve business problems on your plant floor.
> http://stratuscom.ca
> 
> > -----Original Message-----
> > From: Adam Wiener [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, October 23, 2001 4:08 PM
> > To: [EMAIL PROTECTED]
> > Subject: Newbie question: Has anyone had trouble compiling code
> > containing HttpServletRequest.getRequestURL() ???
> >
> >
> > Hello,
> >
> > I am currently running Tomcat 3.2.2 (I know, I've been meaning to
> > upgrade...) and I am using the default servlet.jar that comes
> > with that
> > distribution. Whenever I try to compile the following code:
> >
> >  public void doPost(HttpServletRequest req, HttpServletResponse res)
> >    throws ServletException, IOException {
> >      res.setContentType("text/plain");
> >      PrintWriter out = res.getWriter();
> >      out.println(req.getRequestURL().toString());
> >  }
> >
> > I get a compilation error saying that the compiler cannot 
> resolve the
> > getRequestURL method in the HttpServletRequest Interface.
> >
> > However the following code compiles just fine:
> >
> >  public void doPost(HttpServletRequest req, HttpServletResponse res)
> >    throws ServletException, IOException {
> >      res.setContentType("text/plain");
> >      PrintWriter out = res.getWriter();
> >      out.println(req.getRequestURI());
> >  }
> >
> > am I missing something really obvious?  All the documentation
> > I can find
> > says the getRequestURL() method is valid... Anyone else 
> have a similar
> > problem?
> >
> > Thanks in advance,
> > Adam
> >
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> 

Reply via email to