Package com.mendix.m2ee.api
Interface IMxRuntimeResponse
-
public interface IMxRuntimeResponseThis interface represents a response from the Mendix runtime. Using this interface, information about the response can be retrieved and modified.
-
-
Field Summary
Fields Modifier and Type Field Description static intBAD_REQUESTstatic intCONFLICTstatic intDATAVALIDATION_ERROR_CODEstatic intFORBIDDENstatic intINTERNAL_SERVER_ERRORstatic intMETHOD_NOT_ALLOWEDstatic intNEED_PAYMENTstatic intNOT_FOUNDstatic intNOT_MODIFIEDstatic intOKstatic intSEE_OTHERstatic intSERVICE_UNAVAILABLEstatic intSESSION_KILLEDstatic intTOO_MANY_REQUESTSstatic intUNAUTHORIZEDstatic intXAS_ERROR_CODE
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddCookie(java.lang.String key, java.lang.String value)Adds a cookie to the response.voidaddCookie(java.lang.String key, java.lang.String value, boolean isHttpOnly)Adds a cookie to the response.voidaddCookie(java.lang.String key, java.lang.String value, boolean isHttpOnly, boolean isHostOnly)Adds a cookie to the response.voidaddCookie(java.lang.String key, java.lang.String value, java.lang.String path, java.lang.String domain, int expiry)Adds a cookie to the response.voidaddCookie(java.lang.String key, java.lang.String value, java.lang.String path, java.lang.String domain, int expiry, boolean isHttpOnly)Adds a cookie to the response.voidaddCookie(java.lang.String key, java.lang.String value, java.lang.String path, java.lang.String domain, int expiry, boolean isHttpOnly, boolean isHostOnly)Adds a cookie to the response.voidaddHeader(java.lang.String key, java.lang.String value)Adds a header to the response.java.lang.StringgetCharacterEncoding()Returns the currently set character encoding of the response.java.lang.StringgetContentType()Returns the currently set content type of the response.javax.servlet.http.HttpServletResponsegetHttpServletResponse()Returns the Servlet response associated with this MxRuntimeResponse.java.io.OutputStreamgetOutputStream()Returns an output stream for this response.java.io.WritergetWriter()Returns a writer associated with this MxRuntimeResponse.voidsendError(java.lang.String badRequest)Sends an internal server error as a response.voidsetCharacterEncoding(java.lang.String charset)Sets the character encoding of the response.voidsetContentType(java.lang.String contentType)Sets the content type of the response.voidsetStatus(int status)Sets the status of the response.voidsetStatus(int status, java.lang.String msg)Deprecated.since version 9.13.
-
-
-
Field Detail
-
OK
static final int OK
- See Also:
- Constant Field Values
-
SEE_OTHER
static final int SEE_OTHER
- See Also:
- Constant Field Values
-
NOT_MODIFIED
static final int NOT_MODIFIED
- See Also:
- Constant Field Values
-
BAD_REQUEST
static final int BAD_REQUEST
- See Also:
- Constant Field Values
-
UNAUTHORIZED
static final int UNAUTHORIZED
- See Also:
- Constant Field Values
-
NEED_PAYMENT
static final int NEED_PAYMENT
- See Also:
- Constant Field Values
-
FORBIDDEN
static final int FORBIDDEN
- See Also:
- Constant Field Values
-
NOT_FOUND
static final int NOT_FOUND
- See Also:
- Constant Field Values
-
METHOD_NOT_ALLOWED
static final int METHOD_NOT_ALLOWED
- See Also:
- Constant Field Values
-
CONFLICT
static final int CONFLICT
- See Also:
- Constant Field Values
-
TOO_MANY_REQUESTS
static final int TOO_MANY_REQUESTS
- See Also:
- Constant Field Values
-
SESSION_KILLED
static final int SESSION_KILLED
- See Also:
- Constant Field Values
-
INTERNAL_SERVER_ERROR
static final int INTERNAL_SERVER_ERROR
- See Also:
- Constant Field Values
-
SERVICE_UNAVAILABLE
static final int SERVICE_UNAVAILABLE
- See Also:
- Constant Field Values
-
XAS_ERROR_CODE
static final int XAS_ERROR_CODE
- See Also:
- Constant Field Values
-
DATAVALIDATION_ERROR_CODE
static final int DATAVALIDATION_ERROR_CODE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getContentType
java.lang.String getContentType()
Returns the currently set content type of the response.
-
getCharacterEncoding
java.lang.String getCharacterEncoding()
Returns the currently set character encoding of the response.
-
setContentType
void setContentType(java.lang.String contentType)
Sets the content type of the response.- Parameters:
contentType- the content type
-
setCharacterEncoding
void setCharacterEncoding(java.lang.String charset)
Sets the character encoding of the response.- Parameters:
charset- the character set to use
-
getWriter
java.io.Writer getWriter() throws java.io.IOExceptionReturns a writer associated with this MxRuntimeResponse.- Returns:
- a writer
- Throws:
java.io.IOException- if the writer cannot be opened
-
sendError
void sendError(java.lang.String badRequest)
Sends an internal server error as a response.- Parameters:
badRequest- the description of the error
-
getOutputStream
java.io.OutputStream getOutputStream() throws java.io.IOExceptionReturns an output stream for this response.- Returns:
- the output stream
- Throws:
java.lang.RuntimeException- if getPrintWriter has already been calledjava.io.IOException
-
setStatus
void setStatus(int status)
Sets the status of the response.- Parameters:
status- the status code
-
setStatus
@Deprecated void setStatus(int status, java.lang.String msg)Deprecated.since version 9.13. This method will be removed in version 10. SeeHttpServletResponse.setStatus(int, String)for more details.Sets the status of the response with a message.- Parameters:
status- the status codemsg- the message
-
addHeader
void addHeader(java.lang.String key, java.lang.String value)Adds a header to the response.- Parameters:
key- the header keyvalue- the header value
-
addCookie
void addCookie(java.lang.String key, java.lang.String value)Adds a cookie to the response.- Parameters:
key- the cookie namevalue- the cookie value
-
addCookie
void addCookie(java.lang.String key, java.lang.String value, java.lang.String path, java.lang.String domain, int expiry, boolean isHttpOnly)Adds a cookie to the response.- Parameters:
key- the cookie namevalue- the cookie valuepath- path for the cookie to which the client should return the cookiedomain- the domain within which this cookie should be presentedexpiry- the maximum age in seconds for the cookieisHttpOnly- set the HttpOnly attribute of the cookie
-
addCookie
void addCookie(java.lang.String key, java.lang.String value, java.lang.String path, java.lang.String domain, int expiry, boolean isHttpOnly, boolean isHostOnly)Adds a cookie to the response.- Parameters:
key- the cookie namevalue- the cookie valuepath- path for the cookie to which the client should return the cookiedomain- the domain within which this cookie should be presentedexpiry- the maximum age in seconds for the cookieisHttpOnly- set the HttpOnly attribute of the cookieisHostOnly- prefix key with __Host-
-
addCookie
void addCookie(java.lang.String key, java.lang.String value, java.lang.String path, java.lang.String domain, int expiry)Adds a cookie to the response.- Parameters:
key- the cookie namevalue- the cookie valuepath- path for the cookie to which the client should return the cookiedomain- the domain within which this cookie should be presentedexpiry- the maximum age in seconds for the cookie
-
addCookie
void addCookie(java.lang.String key, java.lang.String value, boolean isHttpOnly)Adds a cookie to the response.- Parameters:
key- the cookie namevalue- the cookie valueisHttpOnly- set the HttpOnly attribute of the cookie
-
addCookie
void addCookie(java.lang.String key, java.lang.String value, boolean isHttpOnly, boolean isHostOnly)Adds a cookie to the response.- Parameters:
key- the cookie namevalue- the cookie valueisHttpOnly- set the HttpOnly attribute of the cookieisHostOnly- prefix key with __Host-
-
getHttpServletResponse
javax.servlet.http.HttpServletResponse getHttpServletResponse()
Returns the Servlet response associated with this MxRuntimeResponse.
-
-