You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stanczak Group <ju...@stanczakgroup.com> on 2005/03/08 20:39:04 UTC

Real Path?

Before I started using Tapestry I could load property files and set file 
system paths on the server automatically using 
getServletContext().getRealPath("/WEB-INF");. How can I do this in 
Tapestry and what's is the best approach to take?

-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


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


Re: Real Path?

Posted by Stanczak Group <ju...@stanczakgroup.com>.

David Ezzio wrote:

> For one of my apps, I created an immutable page attribute, that 
> initializes once, and uses the values of <init-param> from web.xml.  
> In this case, I used 
> cycle.getRequestContext().getServlet().getServletConfig().getInitParameter("<name 
> of init param>") to initialize it with the value in web.xml.
>
> Seems to work just fine.  Allows one to config deployment related 
> parameters that are used by only one page.  If used by multiple pages, 
> then as suggested, put the one-shot initialization into Global.
>
> I don't think you change the things you learned about initialization 
> with Servlets just because you're using Tapestry.

Ok. I'm just still having trouble wrapping my mind around Tapestry. I've 
built app with it, but it seems every time I do something I hit a road 
block. Fun and games.

>
> Stanczak Group wrote:
>
>> So your saying I can use 
>> cycle.getRequestContext().getServlet().getServletContext().getRealPath("");? 
>> I was thinking I could load the properties file into the Global 
>> object and then the whole app could use the values. How do I do that, 
>> just extend the org.apache.tapestry.ApplicationServlet and override 
>> the proper methods? I know I can use the getClass().getResource() to 
>> make the app portable, but I wouldn't know how to make the database 
>> do the same. I use HSQL that connects the JDBC to file, so where 
>> would I put that? As you can see, I'm not understanding some piece of 
>> this, I so used to servlet and just don't know all the methods a 
>> Tapestry. Usually I loaded all my properties files  in the servlet 
>> init(), so I'm guessing that's in the ApplicationServlet?
>>
>> Erik Hatcher wrote:
>
-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


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


Re: Real Path?

Posted by David Ezzio <de...@ysoft.com>.
For one of my apps, I created an immutable page attribute, that 
initializes once, and uses the values of <init-param> from web.xml.  In 
this case, I used 
cycle.getRequestContext().getServlet().getServletConfig().getInitParameter("<name 
of init param>") to initialize it with the value in web.xml.

Seems to work just fine.  Allows one to config deployment related 
parameters that are used by only one page.  If used by multiple pages, 
then as suggested, put the one-shot initialization into Global.

I don't think you change the things you learned about initialization 
with Servlets just because you're using Tapestry.

Stanczak Group wrote:
> So your saying I can use 
> cycle.getRequestContext().getServlet().getServletContext().getRealPath("");? 
> I was thinking I could load the properties file into the Global object 
> and then the whole app could use the values. How do I do that, just 
> extend the org.apache.tapestry.ApplicationServlet and override the 
> proper methods? I know I can use the getClass().getResource() to make 
> the app portable, but I wouldn't know how to make the database do the 
> same. I use HSQL that connects the JDBC to file, so where would I put 
> that? As you can see, I'm not understanding some piece of this, I so 
> used to servlet and just don't know all the methods a Tapestry. Usually 
> I loaded all my properties files  in the servlet init(), so I'm guessing 
> that's in the ApplicationServlet?
> 
> Erik Hatcher wrote:
> 
>> No difference in Tapestry... pretty much everywhere in Tapestry you 
>> can get access to the IRequestCycle which you can spelunk to get to 
>> the container stuff.
>>
>> However, it is non-portable (I'm pretty sure) to treat the webapp as 
>> if it was an exploded filesystem WAR structure.  If a .war file is 
>> deployed, some containers do not explode it and these calls do not 
>> work as expected.
>>
>>     Erik
>>
>> On Mar 8, 2005, at 2:39 PM, Stanczak Group wrote:
>>
>>> Before I started using Tapestry I could load property files and set 
>>> file system paths on the server automatically using 
>>> getServletContext().getRealPath("/WEB-INF");. How can I do this in 
>>> Tapestry and what's is the best approach to take?
>>>
>>> -- 
>>> Justin Stanczak
>>> Stanczak Group
>>> 812-735-3600
>>>
>>> "All that is necessary for the triumph of evil is that good men do 
>>> nothing."
>>> Edmund Burke
>>>
>>> ..________...............__.................
>>> ./  _____/..____..._____/..|_..____...____....
>>> /...\..____/.__.\./....\...__\/.._.\./._..\....
>>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
>>> .\______../\___.._\__|../__|..\____/.\____/......
>>> ........\/.....\/.....\/..........................
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: Real Path?

Posted by Stanczak Group <ju...@stanczakgroup.com>.

Shawn Church wrote:

>Yes, this will work fine.  Extend ApplicationServlet and override init(),
>calling the super implementation first.  You should also register your
>application class in web.xml:
>...
>   <servlet>
>      <servlet-name>myapp</servlet-name>
>      <servlet-class>com.whatever.Application</servlet-class>
>  
>

Ya, this looks like what I want to do. I just want to load the values on 
boot up once. I don't really see any reason to do it each request. I 
just don't understand all in ins and outs of Tapestry yet. Like this for 
example. I know you can extend these, but I wasn't sure if that was the 
correct approach when building an app in tapestry. newbie

>...
>
>Another option is to override BaseEngine and do your global init in
>setupForRequest().  Be sure and tell Tapestry the name of your Engine class
>however, since Tapestry will use it instead of the default implementation.
>To do this, add a property to your myapp.application file, like this:
>
><application name="myapp">
>   <property name="org.apache.tapestry.engine-class"
>value="com.whatever.Engine" />
></application>
>
>Unlike init() however, every request goes through setupForRequest().
>
>http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/ApplicationSe
>rvlet.html
>http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/engine/BaseEn
>gine.html
>
>Shawn
>
>
>-----Original Message-----
>From: Stanczak Group [mailto:justin@stanczakgroup.com]
>Sent: Tuesday, March 08, 2005 5:02 PM
>To: Tapestry users
>Subject: Re: Real Path?
>
>
>So your saying I can use
>cycle.getRequestContext().getServlet().getServletContext().getRealPath("");?
>I was thinking I could load the properties file into the Global object
>and then the whole app could use the values. How do I do that, just
>extend the org.apache.tapestry.ApplicationServlet and override the
>proper methods? I know I can use the getClass().getResource() to make
>the app portable, but I wouldn't know how to make the database do the
>same. I use HSQL that connects the JDBC to file, so where would I put
>that? As you can see, I'm not understanding some piece of this, I so
>used to servlet and just don't know all the methods a Tapestry. Usually
>I loaded all my properties files  in the servlet init(), so I'm guessing
>that's in the ApplicationServlet?
>
>Erik Hatcher wrote:
>  
>
-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


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


Re: Real Path?

Posted by Shawn Church <sh...@boxity.com>.
I think I will do this as well, even though I mentioned overriding
ApplicationServlet as an option.  There are other reasons I always
override Engine anyway (catching application exceptions, etc.), so it
makes sense to keep everything in the Engine.  

I normally use setupForRequest for global initializations, but
setupForRequest actually calls createGlobal (if global is null), so
createGlobal might be easier.

The only place I know of to handle resource cleanup would be the
destroy() method of GenericServlet.  Since ApplicationServlet extends
HttpServlet extends GenericServlet, you may need to override
ApplicationServlet after all.

Shawn


Quoting "matthew c. mead" <m-...@goof.com>:

> Thanks.
> 
> I'm going to look into using this instead of the overridden 
> ApplicationServlet.  It may provide a cleaner way of handling things
> 
> than a number of Singletons.
> 
> I don't see any obvious mechanism that allows for resource cleanup
> upon 
> undeploy of the application - is there one?
> 
> 
> 
> -matt
> 
> Erik Hatcher wrote:
> 
> > I like having my global stuff in my Global object, and it seems the
>  
> > cleanest most Tapestry-centric way is to use a custom engine and
> hook  
> > createGlobal.  I've never subclassed Tapestry's servlet.  Stylistic
>  
> > difference, for sure.  It'll work either way.
> >
> >     Erik
> >
> >
> > On Mar 9, 2005, at 8:47 AM, matthew c. mead wrote:
> >
> >> Erik,
> >>
> >> Why would you rather override the Engine than the servlet?  Is it
> 
> >> just  a stylistic preference, or is there a benefit from doing so?
>  
> >> I've  tended to put all my startup-required stuff into my 
> >> application  servlet implementation.
> >>
> >> Thanks.
> >>
> >>
> >>
> >> -matt
> >>
> >> Erik Hatcher wrote:
> >>
> >>> If you're going to going to use a custom engine and want one-time
>  
> >>> setup  that will put data into Global, I recommend overriding  
> >>> createGlobal  instead.
> >>>
> >>>     Erik
> >>>
> >>>
> >>> On Mar 8, 2005, at 11:53 PM, Shawn Church wrote:
> >>>
> >>>> Yes, this will work fine.  Extend ApplicationServlet and
> override   
> >>>> init(),
> >>>> calling the super implementation first.  You should also
> register  
> >>>> your
> >>>> application class in web.xml:
> >>>> ...
> >>>>    <servlet>
> >>>>       <servlet-name>myapp</servlet-name>
> >>>>       <servlet-class>com.whatever.Application</servlet-class>
> >>>> ...
> >>>>
> >>>> Another option is to override BaseEngine and do your global init
> in
> >>>> setupForRequest().  Be sure and tell Tapestry the name of your 
> 
> >>>> Engine  class
> >>>> however, since Tapestry will use it instead of the default   
> >>>> implementation.
> >>>> To do this, add a property to your myapp.application file, like
> this:
> >>>>
> >>>> <application name="myapp">
> >>>>    <property name="org.apache.tapestry.engine-class"
> >>>> value="com.whatever.Engine" />
> >>>> </application>
> >>>>
> >>>> Unlike init() however, every request goes through
> setupForRequest().
> >>>>
> >>>> http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/ 
> 
> >>>> ApplicationSe
> >>>> rvlet.html
> >>>> http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/
> 
> >>>> engine/ BaseEn
> >>>> gine.html
> >>>>
> >>>> Shawn
> >>>>
> >>>>
> >>>> -----Original Message-----
> >>>> From: Stanczak Group [mailto:justin@stanczakgroup.com]
> >>>> Sent: Tuesday, March 08, 2005 5:02 PM
> >>>> To: Tapestry users
> >>>> Subject: Re: Real Path?
> >>>>
> >>>>
> >>>> So your saying I can use
> >>>>
> cycle.getRequestContext().getServlet().getServletContext().getRealPat
> 
> >>>> h( "");?
> >>>> I was thinking I could load the properties file into the Global 
> 
> >>>> object
> >>>> and then the whole app could use the values. How do I do that,
> just
> >>>> extend the org.apache.tapestry.ApplicationServlet and override
> the
> >>>> proper methods? I know I can use the getClass().getResource() to
> make
> >>>> the app portable, but I wouldn't know how to make the database
> do the
> >>>> same. I use HSQL that connects the JDBC to file, so where would
> I put
> >>>> that? As you can see, I'm not understanding some piece of this,
> I so
> >>>> used to servlet and just don't know all the methods a Tapestry. 
> 
> >>>> Usually
> >>>> I loaded all my properties files  in the servlet init(), so I'm 
>  
> >>>> guessing
> >>>> that's in the ApplicationServlet?
> >>>>
> >>>> Erik Hatcher wrote:
> >>>>
> >>>>> No difference in Tapestry... pretty much everywhere in Tapestry
> you
> >>>>> can get access to the IRequestCycle which you can spelunk to
> get to
> >>>>> the container stuff.
> >>>>>
> >>>>> However, it is non-portable (I'm pretty sure) to treat the
> webapp as
> >>>>> if it was an exploded filesystem WAR structure.  If a .war file
> is
> >>>>> deployed, some containers do not explode it and these calls do
> not
> >>>>> work as expected.
> >>>>>
> >>>>>     Erik
> >>>>>
> >>>>> On Mar 8, 2005, at 2:39 PM, Stanczak Group wrote:
> >>>>>
> >>>>>> Before I started using Tapestry I could load property files
> and set
> >>>>>> file system paths on the server automatically using
> >>>>>> getServletContext().getRealPath("/WEB-INF");. How can I do
> this in
> >>>>>> Tapestry and what's is the best approach to take?
> >>>>>>
> >>>>>> -- 
> >>>>>> Justin Stanczak
> >>>>>> Stanczak Group
> >>>>>> 812-735-3600
> >>>>>>
> >>>>>> "All that is necessary for the triumph of evil is that good
> men do
> >>>>>> nothing."
> >>>>>> Edmund Burke
> >>>>>>
> >>>>>> ..________...............__.................
> >>>>>> ./  _____/..____..._____/..|_..____...____....
> >>>>>> /...\..____/.__.\./....\...__\/.._.\./._..\....
> >>>>>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
> >>>>>> .\______../\___.._\__|../__|..\____/.\____/......
> >>>>>> ........\/.....\/.....\/..........................
> >>>>>>
> >>>>>>
> >>>>>>
> ------------------------------------------------------------------- 
> >>>>>> -- 
> >>>>>> 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
> >>>>>
> >>>>>
> >>>>
> >>>> -- 
> >>>> Justin Stanczak
> >>>> Stanczak Group
> >>>> 812-735-3600
> >>>>
> >>>> "All that is necessary for the triumph of evil is that good men
> 
> >>>> do   nothing."
> >>>> Edmund Burke
> >>>>
> >>>> ..________...............__.................
> >>>> ./  _____/..____..._____/..|_..____...____....
> >>>> /...\..____/.__.\./....\...__\/.._.\./._..\....
> >>>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
> >>>> .\______../\___.._\__|../__|..\____/.\____/......
> >>>> ........\/.....\/.....\/..........................
> >>>>
> >>>>
> >>>>
> ---------------------------------------------------------------------
> >>>> 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
> >>>
> >>
> >> -- 
> >> matthew c. mead
> >>
> >> http://www.goof.com/
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> >
> 
> -- 
> matthew c. mead
> 
> http://www.goof.com/
> 




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


Re: Real Path?

Posted by "matthew c. mead" <m-...@goof.com>.
Thanks.

I'm going to look into using this instead of the overridden 
ApplicationServlet.  It may provide a cleaner way of handling things 
than a number of Singletons.

I don't see any obvious mechanism that allows for resource cleanup upon 
undeploy of the application - is there one?



-matt

Erik Hatcher wrote:

> I like having my global stuff in my Global object, and it seems the  
> cleanest most Tapestry-centric way is to use a custom engine and hook  
> createGlobal.  I've never subclassed Tapestry's servlet.  Stylistic  
> difference, for sure.  It'll work either way.
>
>     Erik
>
>
> On Mar 9, 2005, at 8:47 AM, matthew c. mead wrote:
>
>> Erik,
>>
>> Why would you rather override the Engine than the servlet?  Is it 
>> just  a stylistic preference, or is there a benefit from doing so?  
>> I've  tended to put all my startup-required stuff into my 
>> application  servlet implementation.
>>
>> Thanks.
>>
>>
>>
>> -matt
>>
>> Erik Hatcher wrote:
>>
>>> If you're going to going to use a custom engine and want one-time  
>>> setup  that will put data into Global, I recommend overriding  
>>> createGlobal  instead.
>>>
>>>     Erik
>>>
>>>
>>> On Mar 8, 2005, at 11:53 PM, Shawn Church wrote:
>>>
>>>> Yes, this will work fine.  Extend ApplicationServlet and override   
>>>> init(),
>>>> calling the super implementation first.  You should also register  
>>>> your
>>>> application class in web.xml:
>>>> ...
>>>>    <servlet>
>>>>       <servlet-name>myapp</servlet-name>
>>>>       <servlet-class>com.whatever.Application</servlet-class>
>>>> ...
>>>>
>>>> Another option is to override BaseEngine and do your global init in
>>>> setupForRequest().  Be sure and tell Tapestry the name of your  
>>>> Engine  class
>>>> however, since Tapestry will use it instead of the default   
>>>> implementation.
>>>> To do this, add a property to your myapp.application file, like this:
>>>>
>>>> <application name="myapp">
>>>>    <property name="org.apache.tapestry.engine-class"
>>>> value="com.whatever.Engine" />
>>>> </application>
>>>>
>>>> Unlike init() however, every request goes through setupForRequest().
>>>>
>>>> http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/  
>>>> ApplicationSe
>>>> rvlet.html
>>>> http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/ 
>>>> engine/ BaseEn
>>>> gine.html
>>>>
>>>> Shawn
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Stanczak Group [mailto:justin@stanczakgroup.com]
>>>> Sent: Tuesday, March 08, 2005 5:02 PM
>>>> To: Tapestry users
>>>> Subject: Re: Real Path?
>>>>
>>>>
>>>> So your saying I can use
>>>> cycle.getRequestContext().getServlet().getServletContext().getRealPat 
>>>> h( "");?
>>>> I was thinking I could load the properties file into the Global  
>>>> object
>>>> and then the whole app could use the values. How do I do that, just
>>>> extend the org.apache.tapestry.ApplicationServlet and override the
>>>> proper methods? I know I can use the getClass().getResource() to make
>>>> the app portable, but I wouldn't know how to make the database do the
>>>> same. I use HSQL that connects the JDBC to file, so where would I put
>>>> that? As you can see, I'm not understanding some piece of this, I so
>>>> used to servlet and just don't know all the methods a Tapestry.  
>>>> Usually
>>>> I loaded all my properties files  in the servlet init(), so I'm   
>>>> guessing
>>>> that's in the ApplicationServlet?
>>>>
>>>> Erik Hatcher wrote:
>>>>
>>>>> No difference in Tapestry... pretty much everywhere in Tapestry you
>>>>> can get access to the IRequestCycle which you can spelunk to get to
>>>>> the container stuff.
>>>>>
>>>>> However, it is non-portable (I'm pretty sure) to treat the webapp as
>>>>> if it was an exploded filesystem WAR structure.  If a .war file is
>>>>> deployed, some containers do not explode it and these calls do not
>>>>> work as expected.
>>>>>
>>>>>     Erik
>>>>>
>>>>> On Mar 8, 2005, at 2:39 PM, Stanczak Group wrote:
>>>>>
>>>>>> Before I started using Tapestry I could load property files and set
>>>>>> file system paths on the server automatically using
>>>>>> getServletContext().getRealPath("/WEB-INF");. How can I do this in
>>>>>> Tapestry and what's is the best approach to take?
>>>>>>
>>>>>> -- 
>>>>>> Justin Stanczak
>>>>>> Stanczak Group
>>>>>> 812-735-3600
>>>>>>
>>>>>> "All that is necessary for the triumph of evil is that good men do
>>>>>> nothing."
>>>>>> Edmund Burke
>>>>>>
>>>>>> ..________...............__.................
>>>>>> ./  _____/..____..._____/..|_..____...____....
>>>>>> /...\..____/.__.\./....\...__\/.._.\./._..\....
>>>>>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
>>>>>> .\______../\___.._\__|../__|..\____/.\____/......
>>>>>> ........\/.....\/.....\/..........................
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------- 
>>>>>> -- 
>>>>>> 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
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> Justin Stanczak
>>>> Stanczak Group
>>>> 812-735-3600
>>>>
>>>> "All that is necessary for the triumph of evil is that good men 
>>>> do   nothing."
>>>> Edmund Burke
>>>>
>>>> ..________...............__.................
>>>> ./  _____/..____..._____/..|_..____...____....
>>>> /...\..____/.__.\./....\...__\/.._.\./._..\....
>>>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
>>>> .\______../\___.._\__|../__|..\____/.\____/......
>>>> ........\/.....\/.....\/..........................
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>> -- 
>> matthew c. mead
>>
>> http://www.goof.com/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>

-- 
matthew c. mead

http://www.goof.com/

Re: Real Path?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
I like having my global stuff in my Global object, and it seems the  
cleanest most Tapestry-centric way is to use a custom engine and hook  
createGlobal.  I've never subclassed Tapestry's servlet.  Stylistic  
difference, for sure.  It'll work either way.

	Erik


On Mar 9, 2005, at 8:47 AM, matthew c. mead wrote:

> Erik,
>
> Why would you rather override the Engine than the servlet?  Is it just  
> a stylistic preference, or is there a benefit from doing so?  I've  
> tended to put all my startup-required stuff into my application  
> servlet implementation.
>
> Thanks.
>
>
>
> -matt
>
> Erik Hatcher wrote:
>
>> If you're going to going to use a custom engine and want one-time  
>> setup  that will put data into Global, I recommend overriding  
>> createGlobal  instead.
>>
>>     Erik
>>
>>
>> On Mar 8, 2005, at 11:53 PM, Shawn Church wrote:
>>
>>> Yes, this will work fine.  Extend ApplicationServlet and override   
>>> init(),
>>> calling the super implementation first.  You should also register  
>>> your
>>> application class in web.xml:
>>> ...
>>>    <servlet>
>>>       <servlet-name>myapp</servlet-name>
>>>       <servlet-class>com.whatever.Application</servlet-class>
>>> ...
>>>
>>> Another option is to override BaseEngine and do your global init in
>>> setupForRequest().  Be sure and tell Tapestry the name of your  
>>> Engine  class
>>> however, since Tapestry will use it instead of the default   
>>> implementation.
>>> To do this, add a property to your myapp.application file, like this:
>>>
>>> <application name="myapp">
>>>    <property name="org.apache.tapestry.engine-class"
>>> value="com.whatever.Engine" />
>>> </application>
>>>
>>> Unlike init() however, every request goes through setupForRequest().
>>>
>>> http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/  
>>> ApplicationSe
>>> rvlet.html
>>> http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/ 
>>> engine/ BaseEn
>>> gine.html
>>>
>>> Shawn
>>>
>>>
>>> -----Original Message-----
>>> From: Stanczak Group [mailto:justin@stanczakgroup.com]
>>> Sent: Tuesday, March 08, 2005 5:02 PM
>>> To: Tapestry users
>>> Subject: Re: Real Path?
>>>
>>>
>>> So your saying I can use
>>> cycle.getRequestContext().getServlet().getServletContext().getRealPat 
>>> h( "");?
>>> I was thinking I could load the properties file into the Global  
>>> object
>>> and then the whole app could use the values. How do I do that, just
>>> extend the org.apache.tapestry.ApplicationServlet and override the
>>> proper methods? I know I can use the getClass().getResource() to make
>>> the app portable, but I wouldn't know how to make the database do the
>>> same. I use HSQL that connects the JDBC to file, so where would I put
>>> that? As you can see, I'm not understanding some piece of this, I so
>>> used to servlet and just don't know all the methods a Tapestry.  
>>> Usually
>>> I loaded all my properties files  in the servlet init(), so I'm   
>>> guessing
>>> that's in the ApplicationServlet?
>>>
>>> Erik Hatcher wrote:
>>>
>>>> No difference in Tapestry... pretty much everywhere in Tapestry you
>>>> can get access to the IRequestCycle which you can spelunk to get to
>>>> the container stuff.
>>>>
>>>> However, it is non-portable (I'm pretty sure) to treat the webapp as
>>>> if it was an exploded filesystem WAR structure.  If a .war file is
>>>> deployed, some containers do not explode it and these calls do not
>>>> work as expected.
>>>>
>>>>     Erik
>>>>
>>>> On Mar 8, 2005, at 2:39 PM, Stanczak Group wrote:
>>>>
>>>>> Before I started using Tapestry I could load property files and set
>>>>> file system paths on the server automatically using
>>>>> getServletContext().getRealPath("/WEB-INF");. How can I do this in
>>>>> Tapestry and what's is the best approach to take?
>>>>>
>>>>> -- 
>>>>> Justin Stanczak
>>>>> Stanczak Group
>>>>> 812-735-3600
>>>>>
>>>>> "All that is necessary for the triumph of evil is that good men do
>>>>> nothing."
>>>>> Edmund Burke
>>>>>
>>>>> ..________...............__.................
>>>>> ./  _____/..____..._____/..|_..____...____....
>>>>> /...\..____/.__.\./....\...__\/.._.\./._..\....
>>>>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
>>>>> .\______../\___.._\__|../__|..\____/.\____/......
>>>>> ........\/.....\/.....\/..........................
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------- 
>>>>> --
>>>>> 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
>>>>
>>>>
>>>
>>> -- 
>>> Justin Stanczak
>>> Stanczak Group
>>> 812-735-3600
>>>
>>> "All that is necessary for the triumph of evil is that good men do   
>>> nothing."
>>> Edmund Burke
>>>
>>> ..________...............__.................
>>> ./  _____/..____..._____/..|_..____...____....
>>> /...\..____/.__.\./....\...__\/.._.\./._..\....
>>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
>>> .\______../\___.._\__|../__|..\____/.\____/......
>>> ........\/.....\/.....\/..........................
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
> -- 
> matthew c. mead
>
> http://www.goof.com/


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


Re: Real Path?

Posted by "matthew c. mead" <m-...@goof.com>.
Erik,

Why would you rather override the Engine than the servlet?  Is it just a 
stylistic preference, or is there a benefit from doing so?  I've tended 
to put all my startup-required stuff into my application servlet 
implementation.

Thanks.



-matt

Erik Hatcher wrote:

> If you're going to going to use a custom engine and want one-time 
> setup  that will put data into Global, I recommend overriding 
> createGlobal  instead.
>
>     Erik
>
>
> On Mar 8, 2005, at 11:53 PM, Shawn Church wrote:
>
>> Yes, this will work fine.  Extend ApplicationServlet and override  
>> init(),
>> calling the super implementation first.  You should also register your
>> application class in web.xml:
>> ...
>>    <servlet>
>>       <servlet-name>myapp</servlet-name>
>>       <servlet-class>com.whatever.Application</servlet-class>
>> ...
>>
>> Another option is to override BaseEngine and do your global init in
>> setupForRequest().  Be sure and tell Tapestry the name of your 
>> Engine  class
>> however, since Tapestry will use it instead of the default  
>> implementation.
>> To do this, add a property to your myapp.application file, like this:
>>
>> <application name="myapp">
>>    <property name="org.apache.tapestry.engine-class"
>> value="com.whatever.Engine" />
>> </application>
>>
>> Unlike init() however, every request goes through setupForRequest().
>>
>> http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/ 
>> ApplicationSe
>> rvlet.html
>> http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/engine/ 
>> BaseEn
>> gine.html
>>
>> Shawn
>>
>>
>> -----Original Message-----
>> From: Stanczak Group [mailto:justin@stanczakgroup.com]
>> Sent: Tuesday, March 08, 2005 5:02 PM
>> To: Tapestry users
>> Subject: Re: Real Path?
>>
>>
>> So your saying I can use
>> cycle.getRequestContext().getServlet().getServletContext().getRealPath( 
>> "");?
>> I was thinking I could load the properties file into the Global object
>> and then the whole app could use the values. How do I do that, just
>> extend the org.apache.tapestry.ApplicationServlet and override the
>> proper methods? I know I can use the getClass().getResource() to make
>> the app portable, but I wouldn't know how to make the database do the
>> same. I use HSQL that connects the JDBC to file, so where would I put
>> that? As you can see, I'm not understanding some piece of this, I so
>> used to servlet and just don't know all the methods a Tapestry. Usually
>> I loaded all my properties files  in the servlet init(), so I'm  
>> guessing
>> that's in the ApplicationServlet?
>>
>> Erik Hatcher wrote:
>>
>>> No difference in Tapestry... pretty much everywhere in Tapestry you
>>> can get access to the IRequestCycle which you can spelunk to get to
>>> the container stuff.
>>>
>>> However, it is non-portable (I'm pretty sure) to treat the webapp as
>>> if it was an exploded filesystem WAR structure.  If a .war file is
>>> deployed, some containers do not explode it and these calls do not
>>> work as expected.
>>>
>>>     Erik
>>>
>>> On Mar 8, 2005, at 2:39 PM, Stanczak Group wrote:
>>>
>>>> Before I started using Tapestry I could load property files and set
>>>> file system paths on the server automatically using
>>>> getServletContext().getRealPath("/WEB-INF");. How can I do this in
>>>> Tapestry and what's is the best approach to take?
>>>>
>>>> -- 
>>>> Justin Stanczak
>>>> Stanczak Group
>>>> 812-735-3600
>>>>
>>>> "All that is necessary for the triumph of evil is that good men do
>>>> nothing."
>>>> Edmund Burke
>>>>
>>>> ..________...............__.................
>>>> ./  _____/..____..._____/..|_..____...____....
>>>> /...\..____/.__.\./....\...__\/.._.\./._..\....
>>>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
>>>> .\______../\___.._\__|../__|..\____/.\____/......
>>>> ........\/.....\/.....\/..........................
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>
>> -- 
>> Justin Stanczak
>> Stanczak Group
>> 812-735-3600
>>
>> "All that is necessary for the triumph of evil is that good men do  
>> nothing."
>> Edmund Burke
>>
>> ..________...............__.................
>> ./  _____/..____..._____/..|_..____...____....
>> /...\..____/.__.\./....\...__\/.._.\./._..\....
>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
>> .\______../\___.._\__|../__|..\____/.\____/......
>> ........\/.....\/.....\/..........................
>>
>>
>> ---------------------------------------------------------------------
>> 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
>

-- 
matthew c. mead

http://www.goof.com/

Re: Real Path?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
If you're going to going to use a custom engine and want one-time setup  
that will put data into Global, I recommend overriding createGlobal  
instead.

	Erik


On Mar 8, 2005, at 11:53 PM, Shawn Church wrote:

> Yes, this will work fine.  Extend ApplicationServlet and override  
> init(),
> calling the super implementation first.  You should also register your
> application class in web.xml:
> ...
>    <servlet>
>       <servlet-name>myapp</servlet-name>
>       <servlet-class>com.whatever.Application</servlet-class>
> ...
>
> Another option is to override BaseEngine and do your global init in
> setupForRequest().  Be sure and tell Tapestry the name of your Engine  
> class
> however, since Tapestry will use it instead of the default  
> implementation.
> To do this, add a property to your myapp.application file, like this:
>
> <application name="myapp">
>    <property name="org.apache.tapestry.engine-class"
> value="com.whatever.Engine" />
> </application>
>
> Unlike init() however, every request goes through setupForRequest().
>
> http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/ 
> ApplicationSe
> rvlet.html
> http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/engine/ 
> BaseEn
> gine.html
>
> Shawn
>
>
> -----Original Message-----
> From: Stanczak Group [mailto:justin@stanczakgroup.com]
> Sent: Tuesday, March 08, 2005 5:02 PM
> To: Tapestry users
> Subject: Re: Real Path?
>
>
> So your saying I can use
> cycle.getRequestContext().getServlet().getServletContext().getRealPath( 
> "");?
> I was thinking I could load the properties file into the Global object
> and then the whole app could use the values. How do I do that, just
> extend the org.apache.tapestry.ApplicationServlet and override the
> proper methods? I know I can use the getClass().getResource() to make
> the app portable, but I wouldn't know how to make the database do the
> same. I use HSQL that connects the JDBC to file, so where would I put
> that? As you can see, I'm not understanding some piece of this, I so
> used to servlet and just don't know all the methods a Tapestry. Usually
> I loaded all my properties files  in the servlet init(), so I'm  
> guessing
> that's in the ApplicationServlet?
>
> Erik Hatcher wrote:
>
>> No difference in Tapestry... pretty much everywhere in Tapestry you
>> can get access to the IRequestCycle which you can spelunk to get to
>> the container stuff.
>>
>> However, it is non-portable (I'm pretty sure) to treat the webapp as
>> if it was an exploded filesystem WAR structure.  If a .war file is
>> deployed, some containers do not explode it and these calls do not
>> work as expected.
>>
>>     Erik
>>
>> On Mar 8, 2005, at 2:39 PM, Stanczak Group wrote:
>>
>>> Before I started using Tapestry I could load property files and set
>>> file system paths on the server automatically using
>>> getServletContext().getRealPath("/WEB-INF");. How can I do this in
>>> Tapestry and what's is the best approach to take?
>>>
>>> --
>>> Justin Stanczak
>>> Stanczak Group
>>> 812-735-3600
>>>
>>> "All that is necessary for the triumph of evil is that good men do
>>> nothing."
>>> Edmund Burke
>>>
>>> ..________...............__.................
>>> ./  _____/..____..._____/..|_..____...____....
>>> /...\..____/.__.\./....\...__\/.._.\./._..\....
>>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
>>> .\______../\___.._\__|../__|..\____/.\____/......
>>> ........\/.....\/.....\/..........................
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
> --
> Justin Stanczak
> Stanczak Group
> 812-735-3600
>
> "All that is necessary for the triumph of evil is that good men do  
> nothing."
> Edmund Burke
>
> ..________...............__.................
> ./  _____/..____..._____/..|_..____...____....
> /...\..____/.__.\./....\...__\/.._.\./._..\....
> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
> .\______../\___.._\__|../__|..\____/.\____/......
> ........\/.....\/.....\/..........................
>
>
> ---------------------------------------------------------------------
> 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: Real Path?

Posted by Shawn Church <sh...@boxity.com>.
Yes, this will work fine.  Extend ApplicationServlet and override init(),
calling the super implementation first.  You should also register your
application class in web.xml:
...
   <servlet>
      <servlet-name>myapp</servlet-name>
      <servlet-class>com.whatever.Application</servlet-class>
...

Another option is to override BaseEngine and do your global init in
setupForRequest().  Be sure and tell Tapestry the name of your Engine class
however, since Tapestry will use it instead of the default implementation.
To do this, add a property to your myapp.application file, like this:

<application name="myapp">
   <property name="org.apache.tapestry.engine-class"
value="com.whatever.Engine" />
</application>

Unlike init() however, every request goes through setupForRequest().

http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/ApplicationSe
rvlet.html
http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/engine/BaseEn
gine.html

Shawn


-----Original Message-----
From: Stanczak Group [mailto:justin@stanczakgroup.com]
Sent: Tuesday, March 08, 2005 5:02 PM
To: Tapestry users
Subject: Re: Real Path?


So your saying I can use
cycle.getRequestContext().getServlet().getServletContext().getRealPath("");?
I was thinking I could load the properties file into the Global object
and then the whole app could use the values. How do I do that, just
extend the org.apache.tapestry.ApplicationServlet and override the
proper methods? I know I can use the getClass().getResource() to make
the app portable, but I wouldn't know how to make the database do the
same. I use HSQL that connects the JDBC to file, so where would I put
that? As you can see, I'm not understanding some piece of this, I so
used to servlet and just don't know all the methods a Tapestry. Usually
I loaded all my properties files  in the servlet init(), so I'm guessing
that's in the ApplicationServlet?

Erik Hatcher wrote:

> No difference in Tapestry... pretty much everywhere in Tapestry you
> can get access to the IRequestCycle which you can spelunk to get to
> the container stuff.
>
> However, it is non-portable (I'm pretty sure) to treat the webapp as
> if it was an exploded filesystem WAR structure.  If a .war file is
> deployed, some containers do not explode it and these calls do not
> work as expected.
>
>     Erik
>
> On Mar 8, 2005, at 2:39 PM, Stanczak Group wrote:
>
>> Before I started using Tapestry I could load property files and set
>> file system paths on the server automatically using
>> getServletContext().getRealPath("/WEB-INF");. How can I do this in
>> Tapestry and what's is the best approach to take?
>>
>> --
>> Justin Stanczak
>> Stanczak Group
>> 812-735-3600
>>
>> "All that is necessary for the triumph of evil is that good men do
>> nothing."
>> Edmund Burke
>>
>> ..________...............__.................
>> ./  _____/..____..._____/..|_..____...____....
>> /...\..____/.__.\./....\...__\/.._.\./._..\....
>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
>> .\______../\___.._\__|../__|..\____/.\____/......
>> ........\/.....\/.....\/..........................
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>

--
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


---------------------------------------------------------------------
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: Real Path?

Posted by Stanczak Group <ju...@stanczakgroup.com>.
So your saying I can use 
cycle.getRequestContext().getServlet().getServletContext().getRealPath("");? 
I was thinking I could load the properties file into the Global object 
and then the whole app could use the values. How do I do that, just 
extend the org.apache.tapestry.ApplicationServlet and override the 
proper methods? I know I can use the getClass().getResource() to make 
the app portable, but I wouldn't know how to make the database do the 
same. I use HSQL that connects the JDBC to file, so where would I put 
that? As you can see, I'm not understanding some piece of this, I so 
used to servlet and just don't know all the methods a Tapestry. Usually 
I loaded all my properties files  in the servlet init(), so I'm guessing 
that's in the ApplicationServlet?

Erik Hatcher wrote:

> No difference in Tapestry... pretty much everywhere in Tapestry you 
> can get access to the IRequestCycle which you can spelunk to get to 
> the container stuff.
>
> However, it is non-portable (I'm pretty sure) to treat the webapp as 
> if it was an exploded filesystem WAR structure.  If a .war file is 
> deployed, some containers do not explode it and these calls do not 
> work as expected.
>
>     Erik
>
> On Mar 8, 2005, at 2:39 PM, Stanczak Group wrote:
>
>> Before I started using Tapestry I could load property files and set 
>> file system paths on the server automatically using 
>> getServletContext().getRealPath("/WEB-INF");. How can I do this in 
>> Tapestry and what's is the best approach to take?
>>
>> -- 
>> Justin Stanczak
>> Stanczak Group
>> 812-735-3600
>>
>> "All that is necessary for the triumph of evil is that good men do 
>> nothing."
>> Edmund Burke
>>
>> ..________...............__.................
>> ./  _____/..____..._____/..|_..____...____....
>> /...\..____/.__.\./....\...__\/.._.\./._..\....
>> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
>> .\______../\___.._\__|../__|..\____/.\____/......
>> ........\/.....\/.....\/..........................
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>

-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


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


Re: Real Path?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
No difference in Tapestry... pretty much everywhere in Tapestry you can 
get access to the IRequestCycle which you can spelunk to get to the 
container stuff.

However, it is non-portable (I'm pretty sure) to treat the webapp as if 
it was an exploded filesystem WAR structure.  If a .war file is 
deployed, some containers do not explode it and these calls do not work 
as expected.

	Erik

On Mar 8, 2005, at 2:39 PM, Stanczak Group wrote:

> Before I started using Tapestry I could load property files and set 
> file system paths on the server automatically using 
> getServletContext().getRealPath("/WEB-INF");. How can I do this in 
> Tapestry and what's is the best approach to take?
>
> -- 
> Justin Stanczak
> Stanczak Group
> 812-735-3600
>
> "All that is necessary for the triumph of evil is that good men do 
> nothing."
> Edmund Burke
>
> ..________...............__.................
> ./  _____/..____..._____/..|_..____...____....
> /...\..____/.__.\./....\...__\/.._.\./._..\....
> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
> .\______../\___.._\__|../__|..\____/.\____/......
> ........\/.....\/.....\/..........................
>
>
> ---------------------------------------------------------------------
> 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: Real Path?

Posted by Stanczak Group <ju...@stanczakgroup.com>.
I guess I need to refine what I've said. I'm looking for the best 
practice in Tapestry apps to load configs. Then in those configs I need 
to normalize the file system paths like I did with the 
cycle.getRequestContext().getServlet().getServletContext().getRealPath("<your 
path>"). I have an app that has some file paths where it stores uploaded 
files, and another feature that loads a text file and replaces value to 
create a custom email body. I guess I just need someone to give me the 
full picture on how I should be doing this in Tapestry. I don't want to 
have a bunch of hack code, I'd like to use best practice in Tapestry, if 
there is one. Maybe this explains better, but it could be more confusing.

David Ezzio wrote:

> Hi Justin,
>
> cycle.getRequestContext().getServlet().getServletContext().getRealPath("<your 
> path>")  can do the job.
>
> David
>
> Stanczak Group wrote:
>
>> Before I started using Tapestry I could load property files and set 
>> file system paths on the server automatically using 
>> getServletContext().getRealPath("/WEB-INF");. How can I do this in 
>> Tapestry and what's is the best approach to take?
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


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


Re: Real Path?

Posted by David Ezzio <de...@ysoft.com>.
Hi Justin,

cycle.getRequestContext().getServlet().getServletContext().getRealPath("<your 
path>")  can do the job.

David

Stanczak Group wrote:
> Before I started using Tapestry I could load property files and set file 
> system paths on the server automatically using 
> getServletContext().getRealPath("/WEB-INF");. How can I do this in 
> Tapestry and what's is the best approach to take?
> 

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