You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mosho <ro...@gmail.com> on 2006/07/28 20:35:34 UTC

Question regarding getRequestURI()


Hi All,

I am using struts 1.1 I need to get the process.do from the url.

For example if I have 
 http://11.1.30.222:1001/testproject/process.do

By using getRequestURI(), I can get /testproject/process.do but I just need
process.do.
Is there any way to get this?

Thanks
-- 
View this message in context: http://www.nabble.com/Question-regarding-getRequestURI%28%29-tf2016924.html#a5544941
Sent from the Struts - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Question regarding getRequestURI()

Posted by Puneet Lakhina <pu...@gmail.com>.
>
>
> String requestUri = request.getRequestURI();
> String resourceName = requestUri.substring(requestUri.lastIndexOf("/"),
> requestURI.length-1);


String resourceName = requestUri.substring(requestUri.lastIndexOf("/"),
requestURI.length()-1);

just in case you din notice

-- 
Puneet

Re: Question regarding getRequestURI()

Posted by Monkeyden <mo...@gmail.com>.
Actually, the mapping parameter may give you something.  Try mapping.getPath
()

On 7/28/06, Monkeyden <mo...@gmail.com> wrote:
>
>  You have to parse it.  Something like this:
>
> String requestUri = request.getRequestURI();
> String resourceName = requestUri.substring(requestUri.lastIndexOf("/"),
> requestURI.length-1);
>
>
>  On 7/28/06, mosho <ro...@gmail.com> wrote:
> >
> >
> >
> > Hi All,
> >
> > I am using struts 1.1 I need to get the process.do from the url.
> >
> > For example if I have
> > http://11.1.30.222:1001/testproject/process.do
> >
> > By using getRequestURI(), I can get /testproject/process.do but I just
> > need
> > process.do.
> > Is there any way to get this?
> >
> > Thanks
> > --
> > View this message in context: http://www.nabble.com/Question-regarding-getRequestURI%28%29-tf2016924.html#a5544941
> >
> > Sent from the Struts - User forum at Nabble.com <http://nabble.com/>.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

Re: Question regarding getRequestURI()

Posted by Monkeyden <mo...@gmail.com>.
You have to parse it.  Something like this:

String requestUri = request.getRequestURI();
String resourceName = requestUri.substring(requestUri.lastIndexOf("/"),
requestURI.length-1);


On 7/28/06, mosho <ro...@gmail.com> wrote:
>
>
>
> Hi All,
>
> I am using struts 1.1 I need to get the process.do from the url.
>
> For example if I have
> http://11.1.30.222:1001/testproject/process.do
>
> By using getRequestURI(), I can get /testproject/process.do but I just
> need
> process.do.
> Is there any way to get this?
>
> Thanks
> --
> View this message in context:
> http://www.nabble.com/Question-regarding-getRequestURI%28%29-tf2016924.html#a5544941
> Sent from the Struts - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Question regarding getRequestURI()

Posted by mosho <ro...@gmail.com>.
Thanks for your replies.

This solution works for me, mapping.getpath(). 

 
-- 
View this message in context: http://www.nabble.com/Question-regarding-getRequestURI%28%29-tf2016924.html#a5576221
Sent from the Struts - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org