You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by cool dude <co...@yahoo.com> on 2002/02/12 15:58:41 UTC

Extra Path Info Problem!!! HELP!!!

Hi Guyz,
      I'm having a really strange problem wiht struts
... I looked around in the mailing list & found a lot
of people had similar problems .. but I couldn't find
any solution for it. The problem relates to use of
extra path info. I have a URL which looks something
like this
http://myserver.com/servletname/extrapathinfo/actionname

I've defined the url mapping in the web.xml as 
/servletname/*. I was hoping that struts will try &
pick up only the last component of the URL as the
action name & I would be able to use the extra path
info in my servlet. But it doesn't work that way,
instead struts tries to look for an action with the
name /extrapathinfo/actionname ...

I would really appreciate any idea/leads in solving
this problem ... been stuck-up with this for sometime
now .. :-(

Thanx in advance,
VD.

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Extra Path Info Problem!!! HELP!!!

Posted by Ted Husted <hu...@apache.org>.
As a convention, I'd suggest using some other prefix entirely for the
path-helper servlet, like /ex/*, so that it would plug-into any
application that might already be using *.do or /do/*, but, yes, I think
this seems like the cleanest solution. It avoids major surgery on the
existing action-mapping path matching, it can plug-into any existing
Struts application. 

Do the applications using extra-path-information also need the
parameters changed to include a paramId, or can you just pass whatever
is between the slashes? From what you are saying, it sounds like you
need the capability to do both, since an existing application might be
depending on the position of the parameters as an implicit Id?

If we did *not* need to generate an id for the parameter (we can pass
?param as-is instead of {id}=param), we might be able to use a heuristic
search, and avoid a second config.

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg19204.html

Unfortunately, I don't have one of this of my own, and don't know how
things are usually done.

-T.

Michael Nash wrote:
> 
> Ted:
> 
> I've been experimenting with a way of doing mappings from "normal" URL's to
> Action URI's, and wonder if it's the right approach. If so, I'd be happy to
> drop it in for inclusion in a release when/if appropriate, or set it up as
> an optional-add on.
> 
> I took the simple approach, and added a configuration like this:
> 
> <path-mappings>
>         <path-mapping>
>            <url-pattern>/form/*</url-pattern>
>            <path>/application/Something.do</path>
>            <fixed-param>
>               <param-name>someParamName</param-name>
>               <param-value>someParamValue</param-value>
>            </fixed-param>
>            <param>
>               <param-number>1</param-number>
>               <param-name>firstParam</param-name>
>            </param>
>            <param>
>               <param-number>2+</param-number> <!-- the + means take
> everything from param 2 onwards -->
>               <param-name>secondParam</param-name>
>            </param>
>        </path-mapping>
>     </path-mappings>
> 
> Then I have a servlet called "PathHandler", which I map to "/do/*", and...
> 
> if you issue a URL like:
> 
> /application/do/form/message/here/is/a/path
> 
> it would then simply issue a forward to:
> 
> /application/Something.do?someParamName=someparamValue&firstParam=message&se
> condParam=here/is/a/path
> 
> Comments on whether or not this is the right way to go much appreciated, as
> I need this functionality myself soon :-)
> 
> Mike
> 
> > -----Original Message-----
> > From: Ted Husted [mailto:husted@apache.org]
> > Sent: Thursday, February 14, 2002 4:10 AM
> > To: Struts Users Mailing List
> > Subject: Re: Extra Path Info Problem!!! HELP!!!
> >
> >
> > Not supported, though I wish it were :o(
> >
> > http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11714.html
> >
> > http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11709.html
> >
> > Problem is, an Action URI is not a path, but a string identifier that is
> > make to look like a path. So, someone has to write the code to simulate
> > a path.
> >
> > Another problem is that the Action form tag assumes that all action URIs
> > either don't have extensions or are using extension mapping. So, if you
> > are using something like this:
> >
> > /do/MailMerge.txt
> >
> > This doesn't work as an ActionMapping, but does work as a ActionForward.
> >
> >
> > -- Ted Husted, Husted dot Com, Fairport NY USA.
> > -- Java Web Development with Struts.
> > -- Tel +1 585 737-3463.
> > -- Web http://www.husted.com/struts/
> >
> >
> > cool dude wrote:
> > >
> > > Hi Guyz,
> > >       I'm having a really strange problem wiht struts
> > > ... I looked around in the mailing list & found a lot
> > > of people had similar problems .. but I couldn't find
> > > any solution for it. The problem relates to use of
> > > extra path info. I have a URL which looks something
> > > like this
> > > http://myserver.com/servletname/extrapathinfo/actionname
> > >
> > > I've defined the url mapping in the web.xml as
> > > /servletname/*. I was hoping that struts will try &
> > > pick up only the last component of the URL as the
> > > action name & I would be able to use the extra path
> > > info in my servlet. But it doesn't work that way,
> > > instead struts tries to look for an action with the
> > > name /extrapathinfo/actionname ...
> > >
> > > I would really appreciate any idea/leads in solving
> > > this problem ... been stuck-up with this for sometime
> > > now .. :-(
> > >
> > > Thanx in advance,
> > > VD.
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Send FREE Valentine eCards with Yahoo! Greetings!
> > > http://greetings.yahoo.com
> > >
> > > --
> > > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Java Web Development with Struts.
> -- Tel +1 585 737-3463.
> -- Web http://www.husted.com/struts/
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Extra Path Info Problem!!! HELP!!!

Posted by Michael Nash <mi...@coralwave.com>.
Ted:

I've been experimenting with a way of doing mappings from "normal" URL's to
Action URI's, and wonder if it's the right approach. If so, I'd be happy to
drop it in for inclusion in a release when/if appropriate, or set it up as
an optional-add on.

I took the simple approach, and added a configuration like this:

<path-mappings>
        <path-mapping>
           <url-pattern>/form/*</url-pattern>
           <path>/application/Something.do</path>
           <fixed-param>
              <param-name>someParamName</param-name>
              <param-value>someParamValue</param-value>
           </fixed-param>
           <param>
              <param-number>1</param-number>
              <param-name>firstParam</param-name>
           </param>
           <param>
              <param-number>2+</param-number> <!-- the + means take
everything from param 2 onwards -->
              <param-name>secondParam</param-name>
           </param>
       </path-mapping>
    </path-mappings>

Then I have a servlet called "PathHandler", which I map to "/do/*", and...

if you issue a URL like:

/application/do/form/message/here/is/a/path

it would then simply issue a forward to:

/application/Something.do?someParamName=someparamValue&firstParam=message&se
condParam=here/is/a/path

Comments on whether or not this is the right way to go much appreciated, as
I need this functionality myself soon :-)

Mike

> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org]
> Sent: Thursday, February 14, 2002 4:10 AM
> To: Struts Users Mailing List
> Subject: Re: Extra Path Info Problem!!! HELP!!!
>
>
> Not supported, though I wish it were :o(
>
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11714.html
>
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11709.html
>
> Problem is, an Action URI is not a path, but a string identifier that is
> make to look like a path. So, someone has to write the code to simulate
> a path.
>
> Another problem is that the Action form tag assumes that all action URIs
> either don't have extensions or are using extension mapping. So, if you
> are using something like this:
>
> /do/MailMerge.txt
>
> This doesn't work as an ActionMapping, but does work as a ActionForward.
>
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Java Web Development with Struts.
> -- Tel +1 585 737-3463.
> -- Web http://www.husted.com/struts/
>
>
> cool dude wrote:
> >
> > Hi Guyz,
> >       I'm having a really strange problem wiht struts
> > ... I looked around in the mailing list & found a lot
> > of people had similar problems .. but I couldn't find
> > any solution for it. The problem relates to use of
> > extra path info. I have a URL which looks something
> > like this
> > http://myserver.com/servletname/extrapathinfo/actionname
> >
> > I've defined the url mapping in the web.xml as
> > /servletname/*. I was hoping that struts will try &
> > pick up only the last component of the URL as the
> > action name & I would be able to use the extra path
> > info in my servlet. But it doesn't work that way,
> > instead struts tries to look for an action with the
> > name /extrapathinfo/actionname ...
> >
> > I would really appreciate any idea/leads in solving
> > this problem ... been stuck-up with this for sometime
> > now .. :-(
> >
> > Thanx in advance,
> > VD.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Send FREE Valentine eCards with Yahoo! Greetings!
> > http://greetings.yahoo.com
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Java Web Development with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Extra Path Info Problem!!! HELP!!!

Posted by Ted Husted <hu...@apache.org>.
Not supported, though I wish it were :o(

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11714.html

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg11709.html

Problem is, an Action URI is not a path, but a string identifier that is
make to look like a path. So, someone has to write the code to simulate
a path. 

Another problem is that the Action form tag assumes that all action URIs
either don't have extensions or are using extension mapping. So, if you
are using something like this:

/do/MailMerge.txt

This doesn't work as an ActionMapping, but does work as a ActionForward.


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Java Web Development with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


cool dude wrote:
> 
> Hi Guyz,
>       I'm having a really strange problem wiht struts
> ... I looked around in the mailing list & found a lot
> of people had similar problems .. but I couldn't find
> any solution for it. The problem relates to use of
> extra path info. I have a URL which looks something
> like this
> http://myserver.com/servletname/extrapathinfo/actionname
> 
> I've defined the url mapping in the web.xml as
> /servletname/*. I was hoping that struts will try &
> pick up only the last component of the URL as the
> action name & I would be able to use the extra path
> info in my servlet. But it doesn't work that way,
> instead struts tries to look for an action with the
> name /extrapathinfo/actionname ...
> 
> I would really appreciate any idea/leads in solving
> this problem ... been stuck-up with this for sometime
> now .. :-(
> 
> Thanx in advance,
> VD.
> 
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Java Web Development with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>