public class TemplateRedirect
extends java.lang.Object
DirectTemplateExceptionMapper.
Rest resource convention: /[rest context]/[prefix]/[path from request], where [prefix] is application registration name by default (but may be configured). Additional mappings may be configured to sub url, so redirection to different rest "branches" may be performed, depending on called url.
If resource is annotated with Template annotation (it should!) then
TemplateAnnotationFilter will detect it and set specified template into context TemplateContext.
Important: resources must use TemplateView as base template model class
in order to properly support Template annotation.
| Constructor and Description |
|---|
TemplateRedirect(javax.servlet.Servlet restServlet,
java.lang.String app,
java.lang.String mapping,
ViewRestLookup views,
AssetLookup assets,
ErrorRedirect errorRedirect) |
| Modifier and Type | Method and Description |
|---|---|
ErrorRedirect |
getErrorRedirect() |
java.lang.String |
getRootPath() |
void |
redirect(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String page,
boolean directTemplate)
Redirect template request into rest resource.
|
void |
setRootPath(java.lang.String contextPath,
java.lang.String servletMapping) |
static TemplateContext |
templateContext() |
public TemplateRedirect(javax.servlet.Servlet restServlet,
java.lang.String app,
java.lang.String mapping,
ViewRestLookup views,
AssetLookup assets,
ErrorRedirect errorRedirect)
public void setRootPath(java.lang.String contextPath,
java.lang.String servletMapping)
contextPath - main context mapping pathservletMapping - rest servlet mapping pathpublic void redirect(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String page,
boolean directTemplate)
throws java.io.IOException,
javax.servlet.ServletException
DirectTemplateExceptionMapper (to render direct template instead).request - template requestresponse - template responsepage - requested template path (cleared for matching)directTemplate - true if target path looks like template calljava.io.IOException - on dispatching errorsjavax.servlet.ServletException - on dispatching errorspublic ErrorRedirect getErrorRedirect()
public java.lang.String getRootPath()
public static TemplateContext templateContext()