tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keene, David" <dke...@soe.sony.com>
Subject RE: Custom resource loader
Date Thu, 10 Jun 2004 22:05:25 GMT
I don't know if that would work, but even if it did, I think the custom
loader is a better solution.  I'm porting hundreds of legacy pages over
from a system that used have its common directory in the same context
(it really does need to move though).

The most intuitive way to include another jsp is through @include, and
I'd rather not jump through hoops to use another way of including them
(which I believe that using an Action would entail).

I'm sure someone already solved this problem.  He was talking it up
about a year ago ... (checking archives)... David Keys said he made one
in 2003-02-05. (google is great).  Does anyone have the code for this
that they'd like to share?

Dave



-----Original Message-----
From: Frank Zammetti [mailto:fzammett@hotmail.com] 
Sent: Thursday, June 10, 2004 2:37 PM
To: tomcat-user@jakarta.apache.org
Subject: RE: Custom resource loader

Well, here's maybe a better solution (sort of)... It hinges on the
answer to 
a question I don't know the answer to off the top of my head, that is,
if I 
do an include of something mapped to an Action, will the Action be
executed? 
  What I'm thinking is, what if your include results in an Action
execution, 
and that Action reads in the file you want to include and outputs it to
the 
Response object manually?  Then you could access files anywhere on your
file 
system.

I think I may be getting too crazy here :)

Frank


>From: "Keene, David" <dkeene@soe.sony.com>
>Reply-To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>Subject: RE: Custom resource loader
>Date: Thu, 10 Jun 2004 11:59:10 -0700
>
>That's a good ide frank, but it may not work.
>
>FilrDirContext has a normalize method... the javadoc comment says:
>
>* Return a context-relative path, beginning with a "/", that represents
>* the canonical version of the specified path after ".." and "."
>elements
>* are resolved out.  If the specified path attempts to go outside the
>* boundaries of the current context (i.e. too many ".." path elements
>* are present), return <code>null</code> instead.
>
>Doh!
>
>Also, it would be nice to have the freedom to place the 'common'
>elsewhere on the system.
>
>Dave
>
>
>-----Original Message-----
>From: Frank Zammetti [mailto:fzammett@hotmail.com]
>Sent: Thursday, June 10, 2004 11:17 AM
>To: tomcat-user@jakarta.apache.org
>Subject: RE: Custom resource loader
>
>May I suggest one wacky idea?  I'm not saying this is GOOD or anything,
>but
>it's probably a bit outside the box, for whatever that's worth...
>
>What if you had all your common JSPs in a given directory, like so
>(let's
>talk Tomcat for a minute, but it doesn't matter)...
>
>/tomcat/webapps/commonjsps
>/tomcat/webapps/webapp1
>/tomcat/webapps/webapp2
>
>Then, in either webapp1 or webapp2, let's say you want to use the JSP
>myJSP1.jsp in the common jsps directory... What if you had a JSP in
>webapp1
>and webapp2 that was just this:
>
><%@ page language="java" %>
><%@ include file="../commonjsps/myJSP1.jsp.inc" %>
>
>My syntax might be a little off, but I think the concept is clean.  You
>would have to have basically a "dummy" page that includes the real
page,
>and
>that could be a pain, but I think this would work, and maybe it's
>quicker to
>do than a custom resource loader.
>
>Just a thought.
>
>Frank
>
> >From: "Keene, David" <dkeene@soe.sony.com>
> >Reply-To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> >To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> >Subject: Custom resource loader
> >Date: Thu, 10 Jun 2004 10:43:18 -0700
> >
> >Greetings,
> >
> >A while ago on this list I saw some discussion about custom resource
> >loaders (extending FileDirContext) to load resources from multiple
root
> >paths.
> >
> >I am looking specifically to do this in order to grab jsp pages from
a
> >'commons' directory that many of my sites (which run in different
> >contexts) use.
> >
> >Was there any consensus to the right way to do this?  Has anyone done
> >this already and would be willing to share?
> >
> >My plan is to send an extra attribute to the Resource tag in the
> >server.xml, which is a comma delimited list of additional paths in
the
> >order they should be searched for a given file. The
ExtendedDirContext
> >would then keep all the paths on a list and iterate through them
until
>a
> >named resource was located.
> >
> >Any thoughts,
> >
> >Dave Keene
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
>
>_________________________________________________________________
>Looking to buy a house? Get informed with the Home Buying Guide from
MSN
>
>House & Home. http://coldwellbanker.msn.com/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>

_________________________________________________________________
MSN Toolbar provides one-click access to Hotmail from any Web page -
FREE 
download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/


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




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


Mime
View raw message