[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    RE: Global class not instantiated???
From:       "James Carroll" <jim () microbrightfield ! com>
Date:       2003-09-25 14:26:18
[Download RAW message or body]


Nevermind, I just found it in the javadocs... cool. I'm starting 
to find my way around a bit.

> 
> 
> I take it back... it wasn't finding my .application at all.
> Once I change the servlet name in my web.xml it started working.
> 
> I have a webapp called tt it's in a webapps/tt folder under 
> Jetty.  When I point a browser there, it immediately tries
> to find /tt/app/  Where does the /app come from?  Why does
> it redirect to /app and can I change it to just the root
> mapping?  
> 
> my web.xml does have / set up as the tapestry redirect servlet,
> but where is that servlet getting it's destinations?
> 
> <?xml version="1.0"?>
> <!DOCTYPE web-app PUBLIC
>   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>   "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
> <web-app>
>   <display-name>MicroBrightField Databases</display-name>
> 
> 	<filter>
> 		<filter-name>redirect</filter-name>
> 	
> <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
> 	</filter>
> 
> 	<filter-mapping>
> 		<filter-name>redirect</filter-name>
> 		<url-pattern>/</url-pattern>
> 	</filter-mapping>
> 
> 	<servlet>
> 		<servlet-name>tt</servlet-name>
> 	
> <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 
> 	<servlet-mapping>
> 		<servlet-name>tt</servlet-name>
> 		<url-pattern>/app</url-pattern>
> 	</servlet-mapping>
> 
> 	<session-config>
> 		<session-timeout>15</session-timeout>
> 	</session-config>
> 
> </web-app>
> 
> Thanks!
> 
> -Jim
> 
> > 
> > works:
> >  [c:\jimc\mbfdb\jetty-4.2.12]java
> > -Dorg.apache.tapestry.global-class=tt.GlobalResources -jar start.jar
> > 
> > doesn't work:
> > 
> >   <application name="MicroBrightField Databases"
> >      engine-class="org.apache.tapestry.engine.SimpleEngine" >
> > 
> >     <property name="org.apache.tapestry.global-class"
> > value="tt.GlobalResources"/>
> > ...
> > 
> > 
> > Looking at the source, something must be broken in 
> AbstractEngine line
> > 2125 (of current CVS)
> > 
> >     protected IPropertySource createPropertySource(RequestContext
> > context)
> >     {
> >         DelegatingPropertySource result = new
> > DelegatingPropertySource();
> > 
> >         ApplicationServlet servlet = context.getServlet();
> >         IApplicationSpecification spec =
> > servlet.getApplicationSpecification();
> > 
> >         result.addSource(new PropertyHolderPropertySource(spec));
> > --------------------------------------------------------- 
> ^^^^  should
> > be giving the application specification properties.
> > 
> >         result.addSource(new
> > ServletPropertySource(servlet.getServletConfig()));
> >         result.addSource(new
> > ServletContextPropertySource(servlet.getServletContext()));
> > 
> > 
> > > 
> > > 
> > > I still can't get it to instantiate, even if I set it as 
> a run-time
> > > definition
> > > when I start the VM:
> > > 
> > > [c:\jimc\mbfdb\jetty-4.2.12]java
> > > -Dorg.apache.tapestry.global-class=tt.GlobalResources 
> -jar start.jar
> > > 
> > > Does anyone have an example they could send to me?
> > > 
> > > Thanks,
> > > -Jim
> > > 
> > > > -----Original Message-----
> > > > From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net] 
> > > > Sent: Wednesday, September 24, 2003 3:08 PM
> > > > To: Tapestry users
> > > > Subject: Re: Global class not instantiated???
> > > > 
> > > > 
> > > > It should be created the first time you access the 
> > > > application and will 
> > > > be stored in the servlet context and used for further 
> > > > requests. If the 
> > > > engine cannot find your global class, it will simply use a 
> > > > synchronized 
> > > > HashMap, it will not complain. SimpleEngine has been dropped 
> > > > as far as I 
> > > > know, the BaseEngine is its replacement other than that I 
> > don't see 
> > > > anything wrong in your specification.
> > > > 
> > > > -Harish
> > > > 
> > > > James Carroll wrote:
> > > > 
> > > > >I moved the global class to the property, and still no luck.
> > > > >
> > > > >When would this be instantiated? In my constructor I configure
> > > > >log4j and log a few things, but nothing shows up
> > > > >so I know it's not getting instantiated. 
> > > > >
> > > > >mbfdb.application  ---------------------
> > > > >
> > > > ><?xml version="1.0"?>
> > > > ><!DOCTYPE application PUBLIC
> > > > >  "-//Apache Software Foundation//Tapestry 
> Specification 3.0//EN"
> > > > >  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
> > > > >	
> > > > ><application name="MicroBrightField Databases"
> > > > >  engine-class="org.apache.tapestry.engine.SimpleEngine" >
> > > > >
> > > > >    <property name="org.apache.tapestry.global-class"
> > > > >value="tt.GlobalResources"/>
> > > > >
> > > > >    <page name="Home" specification-path="/tt/Home.page"/>
> > > > >    <page name="RMAs" specification-path="/tt/RMAs.page"/>
> > > > >
> > > > >    <component-alias type="Border" 
> > > specification-path="/Border.jwc"/>
> > > > >
> > > > ></application>
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >  
> > > > >
> > > > >>-----Original Message-----
> > > > >>From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net] 
> > > > >>Sent: Wednesday, September 24, 2003 2:24 PM
> > > > >>To: Tapestry users
> > > > >>Subject: Re: Global class not instantiated???
> > > > >>
> > > > >>
> > > > >>Global is a property of the engine and so is specified via a 
> > > > >><property...> element like...
> > > > >>
> > > > >>    <property name="org.apache.tapestry.global-class"
> > > > >>        value="tt.GlobalResources"/>
> > > > >>
> > > > >>-Harish
> > > > >>
> > > > >>James Carroll wrote:
> > > > >>
> > > > >>    
> > > > >>
> > > > >>>Hi I'm using 3.0b3, and have the following application:
> > > > >>>
> > > > >>><application
> > > > >>> name="MicroBrightField Databases"
> > > > >>> engine-class="org.apache.tapestry.engine.SimpleEngine"
> > > > >>> org.apache.tapestry.global-class="tt.GlobalResources"
> > > > >>> >
> > > > >>>
> > > > >>> <page name="Home" specification-path="/tt/Home.page"/>
> > > > >>> <page name="RMAs" specification-path="/tt/RMAs.page"/>
> > > > >>>
> > > > >>> <component-alias type="Border" 
> > > specification-path="/Border.jwc"/>
> > > > >>>
> > > > >>></application>
> > > > >>>
> > > > >>>
> > > > >>>I do a getGlobal() and cast it to a GlobalResources 
> in my code
> > > > >>>and get a ClassCastException.  Am I specifiying the 
> > global class
> > > > >>>correctly?
> > > > >>>
> > > > >>>My global class is going to hold my Hibernate 
> Session Factory.
> > > > >>>Is this the best place for it?  I was thinking of subclassing
> > > > >>>SimpleEngine and having it there too.
> > > > >>>
> > > > >>>Thanks,
> > > > >>>-Jim
> > > > >>>
> > > > >>>-----------------------------------------------------------
> > > > ----------
> > > > >>>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
> > > > >
> > > > >
> > > > >  
> > > > >
> > > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > 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
> 
> 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic