struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: struts-user Digest 22 Aug 2001 16:40:53 -0000 Issue 668
Date Mon, 27 Aug 2001 23:42:39 GMT


On Wed, 22 Aug 2001, david@mclures.net wrote:

>
> The main problem is that Struts [v1.0] seems to assume that the app
> root is always going to be a simple hardcoded slash "/"

More precisely, Struts deals (mostly) with context-relative paths that
start with a "/".  The actual context path assigned to an app is created
by the servlet container you are running in.

For example, the "Struts Example Application" is typically deployed on
context path "/struts-example", but it will run on *any* context path
because there are no assumptions inside the framework about what the
context path is.

> when in our
> case, if it is used at all, it is actually going to need to be
> dynamically generated as something resembling "/prefixspec/".  As
> such, we either need a way to dynamically prefix to the app root, or
> we need to remove the app root prefix altogether and enforce the use
> of relative URLs across all of our Struts based applications (which is
> also problematic).  Bill's idea would provide a slicker way of undoing
> what Struts does to the prefix layer of our URIs, but it would be nice
> if Struts would allow us to dynamically map the absolute path prefix
> somehow to begin with.
>

Since Struts is a JSP/Servlet based framework for building web
applications, it cannot do anything "magical" that any other web
application could not do.  Assigning a dynamic context path is something
that you'll need a servlet container to do for you.

> Thanks again,
>
> David McLure
>
> David.McLure@fmr.com
> david@mclures.net
>

Craig


> >
> > Date: Wed, 22 Aug 2001 10:01:47 -0400
> > To: struts-user@jakarta.apache.org
> > From: Bill Clinton <bclinton@snipermail.com>
> > Subject: Re: Relative URL problem in action taglib processing
> > Message-ID: <3B83BB4B.5010606@snipermail.com>
> >
> > David,
> >       I am doing something similiar in an application I am working on.
> > While I am not stripping the slash, I am modifying the path returned by
> > an action mapping by adding parameters to it without modifying any
> > Struts code.
> >
> > I recommend this solution (or something similar):  Write an extension of
> > ActionForward called SlashlessActionForward.  Make the constructor of
> > this object take an Action forward object like this:
> >
> >      public SlashlessActionForward(ActionForward forward) {
> >
> >          setName(forward.getName());
> >          setPath(forward.getPath());
> >          setRedirect(forward.getRedirect());
> >
> >      }
> >
> > now, override the getPath() method to return the path without the slash.
> > (you would also need to overide setPath() to set a String property in
> > your class)
> >
> > you can now use this in an ActionClass perform method like this:
> >
> > SlashlessActionForward forward =
> >         new SlashlessActionForward(mapping.findForward("success"));
> > return forward;
> >
> > Bill
>
> > > ------------------------------
>
> >
> > Date: Tue, 21 Aug 2001 15:21:05 +1000
> > To: <struts-user@jakarta.apache.org>
> > From: "Robert Parker" <robert_parker@racv.com.au>
> > Subject: Re: Relative URL problem in action taglib processing
> > Message-ID: <004a01c12a01$13b50990$69151f0a@racv.com.au>
> >
> > ----- Original Message -----
> > From: <david@mclures.net>
> > To: <struts-user@jakarta.apache.org>
> > Sent: Tuesday, August 21, 2001 3:49 PM
> > Subject: Relative URL problem in action taglib processing
> >
> > >
> > > Preliminary testing would indicate that this hack does seem to work, but
> > > I can't help but wonder: are we missing something?  Is there an easier,
> > > more elegant way to achieve relative paths in action parameter
> > > references?
> > >
> >
> > I have been deploying my apps as webapps using a war file, that way, the
> > paths are relative to the root directory of the deployed webapp.
> >
> > regards
> >
> > Rob
>
>
>
>


Mime
View raw message