public class TemplateRedirect
extends java.lang.Object
DirectTemplateResource.
Rest resource convention: /{rest prefix}/{app name}/{path from request}, where {app name} is an application registration name.
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,
LazyLocationProvider locationProvider,
ErrorRedirect errorRedirect) |
| Modifier and Type | Method and Description |
|---|---|
ErrorRedirect |
getErrorRedirect() |
void |
redirect(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String page)
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,
LazyLocationProvider locationProvider,
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)
throws java.io.IOException,
javax.servlet.ServletException
DirectTemplateResource will be used.request - template requestresponse - template responsepage - requested template path (cleared for matching)java.io.IOException - on dispatching errorsjavax.servlet.ServletException - on dispatching errorspublic ErrorRedirect getErrorRedirect()
public static TemplateContext templateContext()