Well, there's this old trick.  It's not exactly what you asked for because
it needs a requestCycle to get to the servletContext.  I use it to preload
all the pages at app start-up:

String prefix = "/WEB-INF/";
String suffix = ".page";

Set set = cycle.getRequestContext().getServlet()
          .getServletConfig().getServletContext()
          .getResourcePaths(prefix);
//log.debug("~~ WEB-INF resources = " + set);

Iterator it = set.iterator();
while (it.hasNext()) {
    String name = (String) it.next();
    if (name.endsWith(suffix)) {
        // Strip off the prefix and suffix.
        name = name.substring(prefix.length());
        name = name.substring(0, name.length() - suffix.length());
        log.debug("~~ Preloading " + appName + " page " + name);
        cycle.getPage(name);
    }
}


----- Original Message ----- 
From: "Patrick Casey" <[EMAIL PROTECTED]>
To: "'Tapestry users'" <tapestry-user@jakarta.apache.org>
Sent: Saturday, September 03, 2005 2:18 AM
Subject: RE: Get a list of pages in current application?



I think that's all just the classloader at work :). Howard may have
done some double-secret coolness, but the ability to load a class on the fly
(even a class which didn't exist at JVM start) is a standard classloader
behavior (I've got a library somewhere or other that generates beans on the
fly and compiles them).

What I'm trying to do here doesn't strike me as all that unusual. I
want each user to be able to choose their own home page. So I want to give
them a (somewhat filtered) list of pages in a drop down. I'd like to pluck
the list out of Tapestry (it's all defined in the .application file, so I
know its rattling around in memory somewhere or other).

--- Pat

> -----Original Message-----
> From: DarĂ­o Vasconcelos [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 02, 2005 11:06 PM
> To: Tapestry users
> Subject: Re: Get a list of pages in current application?
>
> I think that, in any case, Tapestry could return a list of the pages
> that are currently pooled, since it appears to use some clever file
> and reflection routines to call not-instanced pages. I've created new
> classes in the middle of a session and seen TP call them without
> needing a restart.
>
> On 9/2/05, Patrick Casey <[EMAIL PROTECTED]> wrote:
> >
> >
> >             Is there a way to get a list of all the pages in the current
> > application? Preferably one that can be accessed statically so I can get
> the
> > list outside of the response cycle?
> >
> >
> >
> >             --- Pat
> >
> >
> >
>
>
> --
> I have enough money to last me the rest of my life, unless I buy
> something.
>     Jackie Mason
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to