public abstract class ControllerBase extends Object implements Controller, JacksonJsonView, HTMLFilterProvider, JSONErrorPageRenderer, ValidatorProvider, TextRendererProvider, JacksonJsonParamReader
| Constructor and Description |
|---|
ControllerBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Object |
computePluginStashValueIfAbsent(Class<?> pluginClass,
String key,
java.util.function.Supplier<?> supplier)
Get plugin stash value.
|
me.geso.webscrew.response.WebResponse |
errorForbidden()
Create new "403 Forbidden" response in JSON.
|
me.geso.webscrew.response.WebResponse |
errorForbidden(String message) |
me.geso.webscrew.response.WebResponse |
errorMethodNotAllowed()
Create new "405 Method Not Allowed" response in JSON.
|
protected me.geso.webscrew.response.WebResponse |
errorMissingMandatoryParameters(List<String> missingParameters) |
me.geso.webscrew.response.WebResponse |
errorNotFound()
Create new "404 Not Found" response in JSON.
|
String |
filterHTML(String html) |
URL |
getCurrentURL()
[EXPERIMENTAL] Get the URL for current HTTP request.
|
Map<String,String> |
getPathParams() |
Optional<Object> |
getPluginStashValue(Class<?> pluginClass,
String key)
Get plugin stash value.
|
javax.servlet.http.HttpServletRequest |
getServletRequest() |
me.geso.webscrew.response.WebResponse |
handleException(Throwable e) |
void |
init(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
Map<String,String> captured) |
void |
invoke(Method method,
javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
Map<String,String> captured) |
me.geso.webscrew.response.RedirectResponse |
redirect(String location)
Create new redirect response.
|
me.geso.webscrew.response.RedirectResponse |
redirect(String location,
Map<String,String> parameters)
Create new redirect response.
|
me.geso.webscrew.response.WebResponse |
renderText(String text)
Create new text/plain response.
|
void |
setPluginStashValue(Class<?> pluginClass,
String key,
Object value)
Set value for stash space for the plugins.
|
URI |
uriFor(String path)
[EXPERIMENTAL] Short hand for
this.uriFor(path, Collections.emptyMap()). |
URI |
uriFor(String path,
Map<String,String> parameters)
[EXPERIMENTAL] Constructs an absolute URI object based on the application root, the provided path, and the additional arguments and query parameters provided.
|
URI |
uriWith(Map<String,String> parameters)
[EXPERIMENTAL] Returns a rewritten URI object for the current request.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateObjectMapper, renderJSON, renderJSONrenderErrorvalidateParametersreadJsonParampublic void init(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
Map<String,String> captured)
init in interface Controllerpublic javax.servlet.http.HttpServletRequest getServletRequest()
getServletRequest in interface Controllerpublic me.geso.webscrew.response.RedirectResponse redirect(@NonNull
String location)
location - public me.geso.webscrew.response.RedirectResponse redirect(@NonNull
String location,
@NonNull
Map<String,String> parameters)
throws URISyntaxException
location - URISyntaxExceptionpublic me.geso.webscrew.response.WebResponse errorMethodNotAllowed()
public me.geso.webscrew.response.WebResponse errorForbidden()
public me.geso.webscrew.response.WebResponse errorForbidden(String message)
public me.geso.webscrew.response.WebResponse errorNotFound()
public me.geso.webscrew.response.WebResponse renderText(String text)
renderText in interface TextRendererProvidertext - public String filterHTML(String html)
filterHTML in interface HTMLFilterProviderpublic void invoke(Method method, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, Map<String,String> captured)
invoke in interface Controllerpublic me.geso.webscrew.response.WebResponse handleException(Throwable e)
protected me.geso.webscrew.response.WebResponse errorMissingMandatoryParameters(List<String> missingParameters)
public void close()
close in interface AutoCloseablepublic Optional<Object> getPluginStashValue(Class<?> pluginClass, String key)
ControllergetPluginStashValue in interface Controllerpublic void setPluginStashValue(Class<?> pluginClass, String key, Object value)
ControllersetPluginStashValue in interface Controllerpublic Object computePluginStashValueIfAbsent(Class<?> pluginClass, String key, java.util.function.Supplier<?> supplier)
ControllercomputePluginStashValueIfAbsent in interface Controllerpublic Map<String,String> getPathParams()
getPathParams in interface Controllerpublic URL getCurrentURL() throws MalformedURLException
MalformedURLExceptionpublic URI uriFor(String path, Map<String,String> parameters) throws URISyntaxException, MalformedURLException
http://example.com/xxx/,
uriFor("/x") returns http://example.com/xxx/xpath - Path from the current URL. You can use root relative URL from context root.parameters - Query parameters.URISyntaxExceptionMalformedURLExceptionpublic URI uriFor(String path) throws URISyntaxException, MalformedURLException
this.uriFor(path, Collections.emptyMap()).path - Path for destination.URISyntaxExceptionMalformedURLExceptionpublic URI uriWith(Map<String,String> parameters) throws URISyntaxException, MalformedURLException
parameters - URISyntaxExceptionMalformedURLExceptionCopyright © 2015. All rights reserved.