Interface RebelHttpServletResponse


public interface RebelHttpServletResponse
Http servlet response interface visible to JRebel agent.

Separate interface is required as the javax.servlet.http.HttpServletResponse interface is not loaded by the boot class loader.

In practice a bytecode processor makes javax.servlet.http.HttpServletResponse to extend the given interface.

  • Method Summary

    Modifier and Type
    Method
    Description
    Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged.
    Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.
    A access mirror for HttpServletResponse's method
    void
    sendError(int sc)
    Sends an error response to the client using the specified status code and clearing the buffer.
    void
    sendError(int sc, String msg)
    Sends an error response to the client using the specified status.
    void
    sendRedirect(String location)
    Sends a temporary redirect response to the client using the specified redirect location URL.
    void
    setHeader(String name, String value)
    A access mirror for HttpServletResponse's method
    void
    setStatus(int sc)
    A access mirror for HttpServletResponse's method
  • Method Details

    • encodeURL

      String encodeURL(String url)
      Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary.

      For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.

      Parameters:
      url - the url to be encoded.
      Returns:
      the encoded URL if encoding is needed; the unchanged URL otherwise.
    • encodeRedirectURL

      String encodeRedirectURL(String url)
      Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. Because the rules for making this determination can differ from those used to decide whether to encode a normal link, this method is separated from the encodeURL method.

      All URLs sent to the HttpServletResponse.sendRedirect method should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.

      Parameters:
      url - the url to be encoded.
      Returns:
      the encoded URL if encoding is needed; the unchanged URL otherwise.
      See Also:
    • sendError

      void sendError(int sc, String msg) throws IOException
      Sends an error response to the client using the specified status. The server defaults to creating the response to look like an HTML-formatted server error page containing the specified message, setting the content type to "text/html", leaving cookies and other headers unmodified. If an error-page declaration has been made for the web application corresponding to the status code passed in, it will be served back in preference to the suggested msg parameter.

      If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.

      Parameters:
      sc - the error status code
      msg - the descriptive message
      Throws:
      IOException - If an input or output exception occurs
      IllegalStateException - If the response was committed
    • sendError

      void sendError(int sc) throws IOException
      Sends an error response to the client using the specified status code and clearing the buffer.

      If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.

      Parameters:
      sc - the error status code
      Throws:
      IOException - If an input or output exception occurs
      IllegalStateException - If the response was committed before this method call
    • sendRedirect

      void sendRedirect(String location) throws IOException
      Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root.

      If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.

      Parameters:
      location - the redirect location URL
      Throws:
      IOException - If an input or output exception occurs
      IllegalStateException - If the response was committed or if a partial URL is given and cannot be converted into a valid URL
    • setStatus

      void setStatus(int sc)
      A access mirror for HttpServletResponse's method
    • setHeader

      void setHeader(String name, String value)
      A access mirror for HttpServletResponse's method
    • getWriter

      PrintWriter getWriter() throws IOException
      A access mirror for HttpServletResponse's method
      Throws:
      IOException