public abstract class AppController extends HttpSupport
HttpSupport.HttpBuilder, HttpSupport.RenderBuilder
Constructor and Description |
---|
AppController() |
Modifier and Type | Method and Description |
---|---|
boolean |
actionSupportsHttpMethod(String actionMethodName,
HttpMethod httpMethod)
Checks if the action supports an HTTP method, according to its configuration.
|
protected List<HttpMethod> |
allowedActions(String actionMethodName) |
protected void |
assign(String name,
Object value)
Assigns value that will be passed into view.
|
protected String |
getContentType()
Returns hardcoded value "text/html".
|
protected String |
getLayout()
Returns a name for a default layout as provided in
activeweb_defaults.properties file. |
protected byte[] |
getRequestBytes()
Reads entire request data as byte array.
|
protected InputStream |
getRequestInputStream() |
protected InputStream |
getRequestStream()
Alias to
getRequestInputStream() . |
protected String |
getRequestString()
Reads entire request data as String.
|
protected String |
queryString()
Returns query string of the request.
|
protected HttpSupport.RenderBuilder |
render()
Use this method in order to override a layout, status code, and content type.
|
protected HttpSupport.RenderBuilder |
render(String template)
Renders results with a template.
|
boolean |
restful()
Returns true if this controller is configured to be
RESTful . |
static <T extends AppController> |
restful(Class<T> controllerClass) |
protected String |
servletPath() |
protected boolean |
standardActionSupportsHttpMethod(String actionMethodName,
HttpMethod httpMethod) |
protected Map |
values() |
protected void |
view(String name,
Object value)
Alias to
assign(String, Object) . |
appContext, blank, context, cookie, cookies, cookieValue, encoding, exists, flash, flash, flash, flash, format, getEncoding, getFile, getId, getLocale, getMap, getMap, getRealPath, getRequestHost, getRequestPort, getRequestProtocol, getResponseHeaders, getRoute, header, header, header, headers, host, ipAddress, ipForwardedFor, isDelete, isGet, isHead, isPost, isPut, isXhr, locale, locale, logDebug, logError, logError, logError, logInfo, logWarning, logWarning, main, merge, method, multipartFormItems, multipartFormItems, outputStream, outputStream, outputStream, param, param, params, params, params, params1st, params1st, path, port, protocol, redirect, redirect, redirect, redirect, redirect, redirect, redirect, redirect, redirectToReferrer, redirectToReferrer, remoteAddress, remoteHost, render, requestHas, respond, sendCookie, sendCookie, sendFile, sendPermanentCookie, session, session, session, sessionBoolean, sessionDouble, sessionFloat, sessionHas, sessionInteger, sessionLong, sessionObject, sessionString, setContentLength, setEncoding, setLocale, setRequestEncoding, setResponseEncoding, streamOut, uploadedFiles, uploadedFiles, uploadedFiles, uri, url, userAgent, view, view, writer, writer, xhr
protected void assign(String name, Object value)
assign
in class HttpSupport
name
- name of a value.value
- value.protected void view(String name, Object value)
assign(String, Object)
.view
in class HttpSupport
name
- name of object to be passed to viewvalue
- object to be passed to viewprotected Map values()
protected HttpSupport.RenderBuilder render(String template)
IllegalStateException
.template
- - template name, can be "list" - for a view whose name is different than the name of this action, or
"/another_controller/any_view" - this is a reference to a view from another controller. The format of this
parameter should be either a single word or two words separated by slash: '/'. If this is a single word, than
it is assumed that template belongs to current controller, if there is a slash used as a separator, then the
first word is assumed to be a name of another controller.RenderBuilder
, which is used to provide additional parameters.protected HttpSupport.RenderBuilder render()
RenderBuilder
, which is used to provide additional parameters.protected String servletPath()
protected String queryString()
HttpSupport
queryString
in class HttpSupport
protected InputStream getRequestInputStream() throws IOException
IOException
protected InputStream getRequestStream() throws IOException
getRequestInputStream()
.IOException
protected String getRequestString() throws IOException
getRequestInputStream()
.IOException
protected byte[] getRequestBytes() throws IOException
IOException
protected String getLayout()
activeweb_defaults.properties
file.
Override this method in a sub-class. Value expected is a fully qualified name of a layout template.
Example: "/custom/custom_layout"
protected String getContentType()
public boolean actionSupportsHttpMethod(String actionMethodName, HttpMethod httpMethod)
actionMethodName
- name of action method.httpMethod
- http methodprotected boolean standardActionSupportsHttpMethod(String actionMethodName, HttpMethod httpMethod)
protected List<HttpMethod> allowedActions(String actionMethodName)
public boolean restful()
RESTful
.public static <T extends AppController> boolean restful(Class<T> controllerClass)
Copyright © 2016. All rights reserved.