You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Patrick Casey <pa...@adelphia.net> on 2005/09/03 01:52:20 UTC

Get a list of pages in current application?

 

            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


Re: Get a list of pages in current application?

Posted by Olve Hansen <ol...@intermedia.uib.no>.
fre, 02,.09.2005 kl. 16.52 -0700, skrev Patrick Casey:

>  
>             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?
> 


We have in a way short-circuited the page specification scheme, where we
have a plugins, which in turn makes a set of pages available.
When the engine starts, these plugin pages are registered in tapestry,
and Then they can be retrieved later on.
This works in tapestry 3, in v 4 I really don't know (yet - anyone who
can shed some light on this?)

	private void registerPage(String specPackagePath, BLink bLinkPage) {
		IApplicationSpecification applicationSpecification =
getSpecification();

		applicationSpecification.setPageSpecificationPath(
		        bLinkPage.getPageName(), specPackagePath +
bLinkPage.getSpecificationPath()
		);

		
	}

The BLink is our frameworks notion of a page, knowing the path and a
page name, among other things. 

Later you can get a list of all registered pages in tapestry, if you
have access to the engine:
		IApplicationSpecification applicationSpecification =
getSpecification();
                applicationSpecification.getPageNames(); 


Hth.

Olve S. Hansen

Re: Get a list of pages in current application?

Posted by Olve Hansen <ol...@intermedia.uib.no>.
fre, 02,.09.2005 kl. 16.52 -0700, skrev Patrick Casey:

>  
>             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?
> 


We have in a way short-circuited the page specification scheme, where we
have a plugins, which in turn makes a set of pages available.
When the engine starts, these plugin pages are registered in tapestry,
and Then they can be retrieved later on.
This works in tapestry 3, in v 4 I really don't know (yet - anyone who
can shed some light on this?)

	private void registerPage(String specPackagePath, BLink bLinkPage) {
		IApplicationSpecification applicationSpecification =
getSpecification();

		applicationSpecification.setPageSpecificationPath(
		        bLinkPage.getPageName(), specPackagePath +
bLinkPage.getSpecificationPath()
		);

		
	}

The BLink is our frameworks notion of a page, knowing the path and a
page name, among other things. 

Later you can get a list of all registered pages in tapestry, if you
have access to the engine:
		IApplicationSpecification applicationSpecification =
getSpecification();
                applicationSpecification.getPageNames(); 


Hth.

Olve S. Hansen

Re: Get a list of pages in current application?

Posted by Geoff Longman <gl...@gmail.com>.
You can try an guess this way, but Tapestry is efficent and does not
keep (or need) such a list. It lazy loads pages on request so if a
request has not been made for a page, Tapestry knows nothing about it.
Plus pages can be built that have no .page file at all.

Geoff

On 9/3/05, Bryan Lewis <br...@maine.rr.com> wrote:
> 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" <pa...@adelphia.net>
> To: "'Tapestry users'" <ta...@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:dario.vasconcelos@gmail.com]
> > 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 <pa...@adelphia.net> 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: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
The Spindle guy.           http://spindle.sf.net
Get help with Spindle:   
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:    
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates:            http://spindle.sf.net/updates

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


Re: Get a list of pages in current application?

Posted by Bryan Lewis <br...@maine.rr.com>.
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" <pa...@adelphia.net>
To: "'Tapestry users'" <ta...@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:dario.vasconcelos@gmail.com]
> 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 <pa...@adelphia.net> 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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




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


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


RE: Get a list of pages in current application?

Posted by Patrick Casey <pa...@adelphia.net>.
	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:dario.vasconcelos@gmail.com]
> 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 <pa...@adelphia.net> 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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




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


Re: Get a list of pages in current application?

Posted by Darío Vasconcelos <da...@gmail.com>.
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 <pa...@adelphia.net> 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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org