Vic Simkus wrote:
>> HttpServletRequest has a getContextPath() that you can use.
> <snip>
> Hi, Scott
> I don't have access to anything "web related" within the class/method.  
> Does Resin provide any way of extracting that sort of information (shot 
> in a dark here) based on the current thread?
> Thanks

This is a hack, but what we do is create a ThreadLocal with the current 
request object.  Something like this:

public abstract class ThreadRequest {

     private static ThreadLocal requestHolder = new ThreadLocal();
      * Sets the current thread's request.
     public static void setRequest(HttpServletRequest request) {

      * Gets the current thread's request.
     public static HttpServletRequest getRequest() {
         return (HttpServletRequest) requestHolder.get();

Then you need a filter that sets this and clears it from the thread.

try {
     // Now hand it off to everything else.
     chain.doFilter(proxiedRequest, response);
} finally {

This gives you static access to the current request on this thread.

Serge Knystautas
Lokitech >> software . strategy . design >>
p. 301.656.5501

resin-interest mailing list

Reply via email to