Hello Michael,
if its within same webapp (I presume it is), you can use 
ContainerRequestFilter - short sample:
// redirects *helloworld to *helloworld/something
public class MyFilter implements ContainerRequestFilter {
     @Override
     public ContainerRequest filter(ContainerRequest request) {
         try {
             
if(request.getAbsolutePath().toString().endsWith("helloworld")) {
                 request.setUris(request.getBaseUri(), 
request.getRequestUriBuilder().path("something").build());
             }
             return request;
         } catch (Exception e) {
             // add proper handling
         }
         return null;
     }
}
I have to admit I don't really know why your case don't work, but it 
might be meant for lower level use / redirecting to another 
servlet/filter maybe.. not sure. Anyway ContainerRequestFilter should 
work for you (but its Jersey specific). See 
http://jersey.java.net/nonav/apidocs/1.11/jersey/com/sun/jersey/spi/container/ContainerRequestFilter.html.
Regards,
Pavel
On 1/10/12 8:20 AM, Michael Karneim wrote:
>
> Hi all,
>
> I am having an issue forwardig a request from one resource to another.
> I get the following exception: java.lang.IllegalStateException: No 
> thread local value in scope for proxy of class $Proxy55
>
> The sample code below reproduces this issue.
>
>   @Path("/forwarder")
>   public class ForwardingResource {
>     @GET
>     @Produces("text/plain")
>     public String getContent(@Context HttpServletRequest request, 
> @Context HttpServletResponse response) throws ServletException, 
> IOException {
>
>         request.getRequestDispatcher("target").forward(request, 
> response);
>         return ""; // Nothing
>     }
>   }
>
>
>   @Path("/target")
>   public class TargetResource {
>     @GET
>     @Produces("text/plain")
>     public String getContent() {
>         return "I am the target";
>     }
>   }
>
>
> When I call
>
>   Client c = Client.create();
>   WebResource r = c.resource("http://localhost:8080/jersey.repo1");
>   String result = r.path("forwarder").get(String.class);
>
> I get a HTTP Status 500 with the following stacktrace:
>
> java.lang.IllegalStateException: No thread local value in scope for 
> proxy of class $Proxy55
>         com.sun.jersey.server.impl.ThreadLocalInvoker.invoke(ThreadLocalInvoker.java:93) 
>
>         $Proxy55.removeAttribute(Unknown Source)
>         jersey.repo1.ForwardingResource.getContent(ForwardingResource.java:19) 
>
>         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
>
>         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
>
>         java.lang.reflect.Method.invoke(Method.java:597)
>         com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) 
>
>        com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
>
>         com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
>
>         com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) 
>
>         com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) 
>
>         com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) 
>
>         com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) 
>
>         com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469) 
>
>         com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400) 
>
>         com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) 
>
>         com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) 
>
>         com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) 
>
>         com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) 
>
>         com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708) 
>
>         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
>
> I am running jersey within tomcat 6.
>
> WEB-INF/lib contains the following jars:
>
> asm-3.3.1.jar
> jaxb-impl.jar
> jersey-bundle-1.11.jar
> jsr311-api-1.1.1.jar
>
> Any suggestions or workarounds would be much appreciated!
>
> Michael
>
>
>