Interface IMxRuntimeResponse


public interface IMxRuntimeResponse
This interface represents a response from the Mendix runtime. Using this interface, information about the response can be retrieved and modified.
  • Field Details

  • Method Details

    • getContentType

      String getContentType()
      Returns the currently set content type of the response.
    • getCharacterEncoding

      String getCharacterEncoding()
      Returns the currently set character encoding of the response.
    • setContentType

      void setContentType(String contentType)
      Sets the content type of the response.
      Parameters:
      contentType - the content type
    • setCharacterEncoding

      void setCharacterEncoding(String charset)
      Sets the character encoding of the response.
      Parameters:
      charset - the character set to use
    • getWriter

      Writer getWriter() throws IOException
      Returns a writer associated with this MxRuntimeResponse.
      Returns:
      a writer
      Throws:
      IOException - if the writer cannot be opened
    • sendError

      void sendError(String badRequest)
      Sends an internal server error as a response.
      Parameters:
      badRequest - the description of the error
    • getOutputStream

      OutputStream getOutputStream() throws IOException
      Returns an output stream for this response.
      Returns:
      the output stream
      Throws:
      RuntimeException - if getPrintWriter has already been called
      IOException
    • setStatus

      void setStatus(int status)
      Sets the status of the response.
      Parameters:
      status - the status code
    • addHeader

      void addHeader(String key, String value)
      Adds a header to the response.
      Parameters:
      key - the header key
      value - the header value
    • addCookie

      void addCookie(String key, String value)
      Adds a cookie to the response.
      Parameters:
      key - the cookie name
      value - the cookie value
    • addCookie

      void addCookie(String key, String value, String path, String domain, int expiry, boolean isHttpOnly)
      Adds a cookie to the response.
      Parameters:
      key - the cookie name
      value - the cookie value
      path - path for the cookie to which the client should return the cookie
      domain - the domain within which this cookie should be presented
      expiry - the maximum age in seconds for the cookie
      isHttpOnly - set the HttpOnly attribute of the cookie
    • addCookie

      void addCookie(String key, String value, String path, String domain, int expiry, boolean isHttpOnly, boolean isHostOnly)
      Adds a cookie to the response.
      Parameters:
      key - the cookie name
      value - the cookie value
      path - path for the cookie to which the client should return the cookie
      domain - the domain within which this cookie should be presented
      expiry - the maximum age in seconds for the cookie
      isHttpOnly - set the HttpOnly attribute of the cookie
      isHostOnly - prefix key with __Host-
    • addCookie

      void addCookie(String key, String value, String path, String domain, int expiry)
      Adds a cookie to the response.
      Parameters:
      key - the cookie name
      value - the cookie value
      path - path for the cookie to which the client should return the cookie
      domain - the domain within which this cookie should be presented
      expiry - the maximum age in seconds for the cookie
    • addCookie

      void addCookie(String key, String value, String path, String domain, boolean isHttpOnly)
      Adds a cookie to the response.
      Parameters:
      key - the cookie name
      value - the cookie value
      path - path for the cookie to which the client should return the cookie
      domain - the domain within which this cookie should be presented
      isHttpOnly - set the HttpOnly attribute of the cookie
    • addCookie

      void addCookie(String key, String value, boolean isHttpOnly)
      Adds a cookie to the response.
      Parameters:
      key - the cookie name
      value - the cookie value
      isHttpOnly - set the HttpOnly attribute of the cookie
    • addCookie

      void addCookie(String key, String value, boolean isHttpOnly, boolean isHostOnly)
      Adds a cookie to the response.
      Parameters:
      key - the cookie name
      value - the cookie value
      isHttpOnly - set the HttpOnly attribute of the cookie
      isHostOnly - prefix key with __Host-
    • getHttpServletResponse

      javax.servlet.http.HttpServletResponse getHttpServletResponse()
      Returns the Servlet response associated with this MxRuntimeResponse.
    • addContentSecurityPolicyHeader

      void addContentSecurityPolicyHeader()
      Adds the Content-Security-Policy header as was configured in the application
    • getNonce

      String getNonce()
      Returns a uniquely generated secure nonce for this response. Can be used when setting a Content-Security-Policy.
      Returns:
      a unique secure nonce