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.
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      void addCookie​(java.lang.String key, java.lang.String value)
      Adds a cookie to the response.
      void addCookie​(java.lang.String key, java.lang.String value, boolean isHttpOnly)
      Adds a cookie to the response.
      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.
      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.
      void addHeader​(java.lang.String key, java.lang.String value)
      Adds a header to the response.
      java.lang.String getCharacterEncoding()
      Returns the currently set character encoding of the response.
      java.lang.String getContentType()
      Returns the currently set content type of the response.
      javax.servlet.http.HttpServletResponse getHttpServletResponse()
      Returns the Servlet response associated with this MxRuntimeResponse.
      java.io.OutputStream getOutputStream()
      Returns an output stream for this response.
      java.io.Writer getWriter()
      Returns a writer associated with this MxRuntimeResponse.
      void sendError​(java.lang.String badRequest)
      Sends an internal server error as a response.
      void setCharacterEncoding​(java.lang.String charset)
      Sets the character encoding of the response.
      void setContentType​(java.lang.String contentType)
      Sets the content type of the response.
      void setStatus​(int status)
      Sets the status of the response.
      void setStatus​(int status, java.lang.String msg)
      Deprecated.
      since version 9.13.
    • 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.IOException
        Returns 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.IOException
        Returns an output stream for this response.
        Returns:
        the output stream
        Throws:
        java.lang.RuntimeException - if getPrintWriter has already been called
        java.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. See HttpServletResponse.setStatus(int, String) for more details.
        Sets the status of the response with a message.
        Parameters:
        status - the status code
        msg - the message
      • addHeader

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

        void addCookie​(java.lang.String key,
                       java.lang.String value)
        Adds a cookie to the response.
        Parameters:
        key - the cookie name
        value - 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 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​(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 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​(java.lang.String key,
                       java.lang.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
      • getHttpServletResponse

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