Return-Path: Delivered-To: apmail-jakarta-struts-user-archive@jakarta.apache.org Received: (qmail 91788 invoked by uid 500); 27 Aug 2001 23:43:00 -0000 Mailing-List: contact struts-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: struts-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list struts-user@jakarta.apache.org Received: (qmail 91781 invoked from network); 27 Aug 2001 23:42:59 -0000 Received: from icarus.apache.org (64.125.133.21) by daedalus.apache.org with SMTP; 27 Aug 2001 23:42:59 -0000 Received: (qmail 86863 invoked by uid 1059); 27 Aug 2001 23:42:39 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 27 Aug 2001 23:42:39 -0000 Date: Mon, 27 Aug 2001 16:42:39 -0700 (PDT) From: "Craig R. McClanahan" Sender: To: cc: Subject: Re: struts-user Digest 22 Aug 2001 16:40:53 -0000 Issue 668 In-Reply-To: <3B8484EE.C6DFADB5@mclures.net> Message-ID: <20010827163824.D82011-100000@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: localhost 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 > > 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: > > From: "Robert Parker" > > Subject: Re: Relative URL problem in action taglib processing > > Message-ID: <004a01c12a01$13b50990$69151f0a@racv.com.au> > > > > ----- Original Message ----- > > From: > > To: > > 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 > > > >