HttpUtils.getRequestURL()

G

galpix

Hi,

I'm trying to call this from an XSP logicsheet :

StringBuffer URL = HttpUtils.getRequestURL(request);

.... but I get this error :

/ start error (lines 195-195) "The method
getRequestURL(HttpServletRequest) in the type HttpUtils is not
applicable
for the arguments (Request)"
StringBuffer URL = HttpUtils.getRequestURL(request);

I don't get it, isn't the request an HtttpServletRequest object ? How
can
I get the URL from an XSP page ??

Many thanks,

galpi
 
R

Roedy Green

for the arguments (Request)"
StringBuffer URL = HttpUtils.getRequestURL(request);

In one case you had Capital Request an the other lower case. Was that
typo in the original? Best always to cut and paste to ensure you
don't add or remove any typos from the original.


If you have an IDE, do a "show declaration" on request to make sure it
is of the class required.
 
G

galpix

Hi,

No typo .... the original code and error message were copy pasted :

StringBuffer URL = HttpUtils.getRequestURL(request);

But the error message as "Request" with Capital R ... I'm not using any
IDE, just writing code with a plain editor.

thanks,

galpi
 
G

galpix

I also tried casting :

"Cannot cast from Request to HttpServletRequest" StringBuffer URI =
HttpUtils.getRequestURL((HttpServletRequest)request);

what's this "Request" object ?

galpi
 
T

Tor Iver Wilhelmsen

what's this "Request" object ?

Not object, but a class. Checl where the variable is declared,
presumably it says Request instead of ServletRequest.
 
B

Babu Kalakrishnan

Hi,

I'm trying to call this from an XSP logicsheet :

StringBuffer URL = HttpUtils.getRequestURL(request);

... but I get this error :

/ start error (lines 195-195) "The method
getRequestURL(HttpServletRequest) in the type HttpUtils is not
applicable
for the arguments (Request)"
StringBuffer URL = HttpUtils.getRequestURL(request);

I don't get it, isn't the request an HtttpServletRequest object ? How
can
I get the URL from an XSP page ??

The error message indicates that the parameter you're passing to the
method is of class Request (Do you have a class named so ?) whereas the
method expects an object which is either a HttpServletRequest or one of
its subclasses.

So check your classes for something named "Request" and make sure that
you don't have another object named "request" (which is of an instance
of a class named "Request") in the scope of the call that hides the real
object (named "request" and of type "HttpServletRequest") which you want
to pass as a parameter.

BK
 
G

galpix

Hi,

The "request" object, which seems to be an instance of "Request" is
made available to me in any XSP page, but I do not declare the
variable. The cocoon framework does it for me so I can fetch info about
the request when generating the page. The strange thing is that I can't
find anything about this "Request" class, but I'll keep digging. Thanks
for all the help, I'll let you know when I figure it out.

galpi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top