try
{
//logger.info("***PATH: " + request.getRequestURL());
// classloader/deployment aware RestasyProviderFactory. Used to have request specific
// ResteasyProviderFactory.getInstance()
ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
{
ThreadLocalResteasyProviderFactory.push(providerFactory);
}
HttpHeaders headers = null;
UriInfoImpl uriInfo = null;
try
{
headers = ServletUtil.extractHttpHeaders(request);
uriInfo = ServletUtil.extractUriInfo(request, servletMappingPrefix);
}
catch (Exception e)
{
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
// made it warn so that people can filter this.
logger.warn("Failed to parse request.", e);
}
HttpResponse theResponse = createServletResponse(response);
HttpRequest in = createHttpRequest(httpMethod, request, headers, uriInfo, theResponse);
try
{
ResteasyProviderFactory.pushContext(HttpServletRequest.class, request);
ResteasyProviderFactory.pushContext(HttpServletResponse.class, response);
/*
try
{
// embedded TJWS and Jetty might not have these things initialized
ServletConfig config1 = getServletConfig();
ResteasyProviderFactory.pushContext(ServletConfig.class, config1);
}
catch (Exception ignored)
{
}
try
{
// embedded TJWS and Jetty might not have these things initialized
ServletContext servletContext = getServletContext();
ResteasyProviderFactory.pushContext(ServletContext.class, servletContext);
}
catch (Exception ignored)
{
}
*/
ResteasyProviderFactory.pushContext(SecurityContext.class, new ServletSecurityContext(request));
dispatcher.invoke(in, theResponse);
}
finally
{
ResteasyProviderFactory.clearContextData();
}
}
finally
{
ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
{
ThreadLocalResteasyProviderFactory.pop();
}