You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Henrik Vendelbo <hv...@bluprints.com> on 2005/04/15 20:57:19 UTC

accessing ServletContext

On a related note, I couldn't figure out how to access the ServletContext from a request cycle. Anyone knows ?

Henrik
----- Original Message ----- 
From: "Henrik Vendelbo" <hv...@bluprints.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, April 15, 2005 7:34 PM
Subject: Re: Service construction, friendly urls


I did, but it doesnt seem to work.

----- Original Message ----- 
From: "Paul Ferraro" <pm...@columbia.edu>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, April 15, 2005 7:18 PM
Subject: Re: Service construction, friendly urls


> That should be configured in your servlet engine, *not* in Tapestry.  If 
> you don't want the servlet context in the url, then you should configure 
> your servlet engine to use a servlet context of "/".
> 
> Paul
> 
> Henrik Vendelbo wrote:
> 
> >I need to do a bit of modification to the friendly urls implementation. I need to be able to configure wether the servlet context is encoded in the url. Since it will be applicationwide all instances need the same configuration. 
> >
> >I think my options are: To access the engine or access the global object. I suppose that I might not be able to access the global object through getPage(), so that leaves me with accessing the engine.
> >
> >Any suggestions ?
> >
> >Henrik
> >
> >
> >---------------------------------------------------------------------
> >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


Re: accessing ServletContext

Posted by Henrik Vendelbo <hv...@bluprints.com>.
I suppose I could use getServletPath and add the first path if it contains two slashes, except that wouldn't work if the page was accessed through the root of the webapp

----- Original Message ----- 
From: "Paul Ferraro" <pm...@columbia.edu>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, April 15, 2005 9:13 PM
Subject: Re: accessing ServletContext


> cycle.getRequestContext().getServlet().getServletContext()
> 
> I don't understand why that doesn't work.  If your servlet context is 
> "/" then HttpServletRequest.getServletPath() returns 
> "/your-servlet-name" - there is no context path to include.  Are you 
> sure we're talking about the same thing?
> 
> Paul
> 
> Henrik Vendelbo wrote:
> 
> >On a related note, I couldn't figure out how to access the ServletContext from a request cycle. Anyone knows ?
> >
> >Henrik
> >----- Original Message ----- 
> >From: "Henrik Vendelbo" <hv...@bluprints.com>
> >To: "Tapestry users" <ta...@jakarta.apache.org>
> >Sent: Friday, April 15, 2005 7:34 PM
> >Subject: Re: Service construction, friendly urls
> >
> >
> >I did, but it doesnt seem to work.
> >
> >----- Original Message ----- 
> >From: "Paul Ferraro" <pm...@columbia.edu>
> >To: "Tapestry users" <ta...@jakarta.apache.org>
> >Sent: Friday, April 15, 2005 7:18 PM
> >Subject: Re: Service construction, friendly urls
> >
> >
> >  
> >
> >>That should be configured in your servlet engine, *not* in Tapestry.  If 
> >>you don't want the servlet context in the url, then you should configure 
> >>your servlet engine to use a servlet context of "/".
> >>
> >>Paul
> >>
> >>Henrik Vendelbo wrote:
> >>
> >>    
> >>
> >>>I need to do a bit of modification to the friendly urls implementation. I need to be able to configure wether the servlet context is encoded in the url. Since it will be applicationwide all instances need the same configuration. 
> >>>
> >>>I think my options are: To access the engine or access the global object. I suppose that I might not be able to access the global object through getPage(), so that leaves me with accessing the engine.
> >>>
> >>>Any suggestions ?
> >>>
> >>>Henrik
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>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


Re: accessing ServletContext

Posted by Henrik Vendelbo <hv...@bluprints.com>.
my servlet context isn't / it is changed using mod_rewrite, and having a path of "/" and a docBase of "/context" gives me the wrong url path. There is probally some sneaky way of deducting it, but I can't think of any right now.

----- Original Message ----- 
From: "Paul Ferraro" <pm...@columbia.edu>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, April 15, 2005 9:13 PM
Subject: Re: accessing ServletContext


> cycle.getRequestContext().getServlet().getServletContext()
> 
> I don't understand why that doesn't work.  If your servlet context is 
> "/" then HttpServletRequest.getServletPath() returns 
> "/your-servlet-name" - there is no context path to include.  Are you 
> sure we're talking about the same thing?
> 
> Paul
> 
> Henrik Vendelbo wrote:
> 
> >On a related note, I couldn't figure out how to access the ServletContext from a request cycle. Anyone knows ?
> >
> >Henrik
> >----- Original Message ----- 
> >From: "Henrik Vendelbo" <hv...@bluprints.com>
> >To: "Tapestry users" <ta...@jakarta.apache.org>
> >Sent: Friday, April 15, 2005 7:34 PM
> >Subject: Re: Service construction, friendly urls
> >
> >
> >I did, but it doesnt seem to work.
> >
> >----- Original Message ----- 
> >From: "Paul Ferraro" <pm...@columbia.edu>
> >To: "Tapestry users" <ta...@jakarta.apache.org>
> >Sent: Friday, April 15, 2005 7:18 PM
> >Subject: Re: Service construction, friendly urls
> >
> >
> >  
> >
> >>That should be configured in your servlet engine, *not* in Tapestry.  If 
> >>you don't want the servlet context in the url, then you should configure 
> >>your servlet engine to use a servlet context of "/".
> >>
> >>Paul
> >>
> >>Henrik Vendelbo wrote:
> >>
> >>    
> >>
> >>>I need to do a bit of modification to the friendly urls implementation. I need to be able to configure wether the servlet context is encoded in the url. Since it will be applicationwide all instances need the same configuration. 
> >>>
> >>>I think my options are: To access the engine or access the global object. I suppose that I might not be able to access the global object through getPage(), so that leaves me with accessing the engine.
> >>>
> >>>Any suggestions ?
> >>>
> >>>Henrik
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>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


Re: accessing ServletContext

Posted by Paul Ferraro <pm...@columbia.edu>.
cycle.getRequestContext().getServlet().getServletContext()

I don't understand why that doesn't work.  If your servlet context is 
"/" then HttpServletRequest.getServletPath() returns 
"/your-servlet-name" - there is no context path to include.  Are you 
sure we're talking about the same thing?

Paul

Henrik Vendelbo wrote:

>On a related note, I couldn't figure out how to access the ServletContext from a request cycle. Anyone knows ?
>
>Henrik
>----- Original Message ----- 
>From: "Henrik Vendelbo" <hv...@bluprints.com>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Friday, April 15, 2005 7:34 PM
>Subject: Re: Service construction, friendly urls
>
>
>I did, but it doesnt seem to work.
>
>----- Original Message ----- 
>From: "Paul Ferraro" <pm...@columbia.edu>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Friday, April 15, 2005 7:18 PM
>Subject: Re: Service construction, friendly urls
>
>
>  
>
>>That should be configured in your servlet engine, *not* in Tapestry.  If 
>>you don't want the servlet context in the url, then you should configure 
>>your servlet engine to use a servlet context of "/".
>>
>>Paul
>>
>>Henrik Vendelbo wrote:
>>
>>    
>>
>>>I need to do a bit of modification to the friendly urls implementation. I need to be able to configure wether the servlet context is encoded in the url. Since it will be applicationwide all instances need the same configuration. 
>>>
>>>I think my options are: To access the engine or access the global object. I suppose that I might not be able to access the global object through getPage(), so that leaves me with accessing the engine.
>>>
>>>Any suggestions ?
>>>
>>>Henrik
>>>
>>>
>>>---------------------------------------------------------------------
>>>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