struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Nash" <m...@coralwave.com>
Subject RE: Extra Path Info Problem!!! HELP!!!
Date Tue, 05 Mar 2002 19:48:36 GMT
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:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@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:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


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


Mime
View raw message