public static final String JSP_MAPPING = "/" + URLMarkupGenerator.JSP_PREFIX;
public boolean processRequest() throws Exception {
HttpServletRequest request = getHttpRequest();
String servletPath = request.getServletPath();
RequestContext requestContext = RequestContext.lookup();
// No JSP mapping -> nothing to do.
if (!servletPath.startsWith(JSP_MAPPING)) return true;
String contextPath = request.getContextPath();
requestContext.consumeURIPart(JSP_MAPPING);
String requestUri = request.getRequestURI();
String relativeUri = requestUri.substring(contextPath == null ? 0 : (contextPath.length()));
relativeUri = relativeUri.substring(servletPath == null ? 0 : (servletPath.length()));
// Empty URI -> nothing to do.
if (StringUtils.isBlank(relativeUri)) return true;
// Set the JSP as the response.
int paramIndex = relativeUri.indexOf("?");
String jsp = paramIndex != -1 ? relativeUri.substring(0, paramIndex) : relativeUri;
requestContext.consumeURIPart(jsp);
requestContext.setResponse(new ShowScreenResponse(jsp));
return true;
}