Package rife.engine

Class Context

java.lang.Object
rife.engine.Context

public class Context extends Object
This class provides the context for the current HTTP request.
Since:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean
     
    static final double
     
    static final float
     
    static final int
     
    static final long
     
    static final int
    Status code (500) indicating an error inside the HTTP server which prevented it from fulfilling the request.
    static final int
    Status code (304) indicating that a conditional GET operation found that the resource was available and not modified.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds the Cookie created by a CookieBuilder to the response.
    void
    addDateHeader(String name, long date)
    Adds a response header with the given name and date-value.
    void
    addHeader(String name, int value)
    Adds a response header with the given name and integer value.
    void
    addHeader(String name, String value)
    Adds a response header with the given name and value.
    Returns the value of the named attribute.
    Returns a list of attribute names available to this request.
    Retrieves the body of this context's request as a string.
    byte[]
    Retrieves the body of this context's request as a byte array.
    Returns the name of the character encoding used in the body of this request.
    void
    Clears the text buffer is it's enabled.
    Returns the MIME type of the body of the request, or null if the type is not known.
    Returns the portion of the request URI that indicates the context of the request.
    Returns the unique identifier of the current continuation.
    boolean
    Retrieves the value of a named cookie and converts it to a boolean.
    boolean
    cookieBoolean(String name, boolean defaultValue)
    Retrieves the value of a named cookie and converts it to a boolean, using a default value if no input value is present.
    double
    Retrieves the value of a named cookie and converts it to a double.
    double
    cookieDouble(String name, double defaultValue)
    Retrieves the value of a named cookie and converts it to a double, using a default value if no input value is present.
    float
    Retrieves the value of a named cookie and converts it to a float.
    float
    cookieFloat(String name, float defaultValue)
    Retrieves the value of a named cookie and converts it to a float, using a default value if no input value is present.
    int
    Retrieves the value of a named cookie and converts it to an integer.
    int
    cookieInt(String name, int defaultValue)
    Retrieves the value of a named cookie and converts it to an integer, using a default value if no input value is present.
    long
    Retrieves the value of a named cookie and converts it to a long.
    long
    cookieLong(String name, long defaultValue)
    Retrieves the value of a named cookie and converts it to a long, using a default value if no input value is present.
    Retrieves the names of the cookies.
    Retrieves the value of a cookie.
    cookieValue(String name, String defaultValue)
    Retrieves the value of a named cookie, using a default value as fallback.
    Retrieves all current cookies names with their values.
    void
    Interrupts the execution in RIFE2 completely and defers it to the servlet container.
    void
    enableTextBuffer(boolean enabled)
    Enables or disables the response text buffer.
    Retrieves the exception that was triggered during the RIFE2 web engine execution.
    file(String name)
    Retrieves an uploaded file.
    Retrieves the list of uploaded file names.
    Retrieves the files that were uploaded in this context.
    files(String name)
    Retrieves all files that have been uploaded for a particular name.
    void
    Forces all the streamed content to be output to the client.
    static Context
    Retrieves the context that was stored in a template attribute.
    Retrieves the URL portion that corresponds to the entrance gate of the RIFE2 web engine, this is usually equivalent with the HTTP request context path.
    void
    generateEmptyForm(Template template, Class beanClass)
    Generates a form that corresponds to an empty instance of a bean class.
    void
    generateEmptyForm(Template template, Class beanClass, String prefix)
    Generates a form that corresponds to an empty instance of a bean class.
    void
    generateForm(Template template, Object beanInstance)
    Generates a form that corresponds to a bean instance.
    void
    generateForm(Template template, Object beanInstance, String prefix)
    Generates a form that corresponds to a bean instance.
    boolean
    Checks if a request attribute exists.
    boolean
    Indicates whether a continuation identifier is available
    boolean
    Checks whether a cookie is present.
    boolean
    Checks if a particular file has been uploaded in this context.
    boolean
    Checks whether a value has been provided to a parameter.
    boolean
    Checks for the existence of a property in this context's HierarchicalProperties.
    header(String name)
    Returns the value of the specified request header as a String.
    long
    Returns the value of the specified request header as a long value that represents a date.
    int
    Returns the value of the specified request header as an int.
    Returns a list of all the header names in the request.
    Returns all the values of the specified request header as a list of String objects.
    boolean
    Checks if an uploaded file wasn't sent or if it is empty.
    boolean
    Checks whether a parameter is empty.
    Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
    Returns a list of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language} header.
    Returns the HTTP RequestMethod with which this context's request was made.
    void
    Interrupts the execution in this element, moving processing on to the next element in the before/route/after chain
    Returns an output stream suitable for writing binary data in the response.
    Retrieves the value of a parameter.
    parameter(String name, String defaultValue)
    Retrieves the value of a parameter and returns a default value if no parameter value is present
    boolean
    Retrieves the value of a parameter and converts it to a boolean.
    boolean
    parameterBoolean(String name, boolean defaultValue)
    Retrieves the value of a parameter and converts it to a boolean, using a default value if no parameter value is present.
    double
    Retrieves the value of a parameter and converts it to a double.
    double
    parameterDouble(String name, double defaultValue)
    Retrieves the value of a parameter and converts it to a double, using a default value if no parameter value is present.
    double[]
    Retrieves the values of a parameter as an array of doubles.
    float
    Retrieves the value of a parameter and converts it to a float.
    float
    parameterFloat(String name, float defaultValue)
    Retrieves the value of a parameter and converts it to a float, using a default value if no parameter value is present.
    float[]
    Retrieves the values of a parameter as an array of floats.
    int
    Retrieves the value of a parameter and converts it to an integer.
    int
    parameterInt(String name, int defaultValue)
    Retrieves the value of a parameter and converts it to an integer, using a default value if no parameter value is present.
    int[]
    Retrieves the values of a parameter as an array of integers.
    long
    Retrieves the value of a parameter and converts it to a long.
    long
    parameterLong(String name, long defaultValue)
    Retrieves the value of a parameter and converts it to a long, using a default value if no parameter value is present.
    long[]
    Retrieves the values of a parameter as an array of longs.
    Retrieves the names of all the parameters that are present.
    Retrieves the parameters that were sent to this context.
    <BeanType> BeanType
    parametersBean(Class<BeanType> beanClass)
    Creates an instance of a bean and populates the properties with the parameter values.
    <BeanType> BeanType
    parametersBean(Class<BeanType> beanClass, String prefix)
    Creates an instance of a bean and populates the properties with the parameter values, taking the provided prefix into account.
    void
    Fills the properties of an existing bean with the parameter values.
    void
    parametersBean(Object bean, String prefix)
    Fills the properties of an existing bean with the parameter values that were sent, taking the provided prefix into account.
    Retrieves the values of a parameter.
    The pathinfo that was captured or matched.
    final void
    Pauses the execution of the element and creates a new continuation.
    void
    Sets up the current response to prevent all caching of the response by the client.
    void
    print(Object object)
    Prints the string representation of an object to the request text output.
    void
    print(Template template)
    Prints a template to the response.
    The hierarchical properties accessible to this context.
    Retrieve a property from this context's HierarchicalProperties.
    Returns a collection of the names in this context's HierarchicalProperties.
    Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
    void
    Interrupts the execution in this element and redirects the client to another URL.
    void
    redirect(Route route)
    Interrupts the execution in this element and redirects the client to another URL.
    Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
    Returns the fully qualified name of the client or the last proxy that sent the request.
    Returns the login of the user making this request.
    void
    Removes an attribute from this request.
    void
    Removes a cookie with path "/".
    void
    removeCookie(String path, String name)
    Removes a cookie with given path and name.
    void
    removeForm(Template template, Class beanClass)
    Removes a generated form, leaving the builder value tags empty again as if this form had never been generated.
    void
    removeForm(Template template, Class beanClass, String prefix)
    Removes a generated form, leaving the builder value tags empty again as if this form had never been generated.
    void
    Removes a name parameter that was previously set.
    The request of this context.
    void
    Interrupts the execution in this element, stops processing any other element, and sends the current response directly to the client.
    The response of this context.
    The route of this context.
    The router in which this context's route was defined.
    Returns the name of the scheme used to make this request.
    boolean
    Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
    selectParameter(Template template, String name, String[] values)
    Sets a select box option, a radio button or a checkbox to selected or checked.
    Returns the host name of the server to which the request was sent.
    int
    Returns the port number to which the request was sent.
    serverRootUrl(int port)
    Returns the root URL of the server that is running this web applications.
    Returns the current session associated with this request, or if the request does not have a session, creates one.
    session(boolean create)
    Returns the current Session associated with this request or, if there is no current session and create is true, returns a new session.
    void
    setAttribute(String name, Object object)
    Stores an attribute in this request.
    void
    setContentLength(int length)
    Sets the length of the content body in the response.
    void
    setContentType(String contentType)
    Sets the content type of the response being sent to the client.
    void
    setDateHeader(String name, long date)
    Adds a response header with the given name and date-value.
    void
    setHeader(String name, int value)
    Adds a response header with the given name and integer value.
    void
    setHeader(String name, String value)
    Sets a response header with the given name and value.
    void
    setLocale(Locale locale)
    Sets the locale of the response.
    void
    setParameter(String name, Object value)
    Sets a named parameter value for URL generation with urlFor(rife.engine.Route) or the `route:` filtered template value tags.
    void
    Sets named parameters values from bean properties for URL generation with urlFor(rife.engine.Route) or the `route:` filtered template value tags.
    void
    Sets named parameters values from bean properties for URL generation with urlFor(rife.engine.Route) or the `route:` filtered template value tags.
    void
    setStatus(int statusCode)
    Sets the status code for the response.
    The active site this context is executing in.
    Instantiates an HTML template with the name corresponding to the identifier of this route's element.
    Instantiates an HTML template with a given name.
    template(String name, String encoding)
    Instantiates an HTML template with a given name and encoding.
    Instantiates an JSON template with the name corresponding to the identifier of this route's element.
    Instantiates an JSON template with a given name.
    templateJson(String name, String encoding)
    Instantiates an JSON template with a given name and encoding.
    Instantiates an SVG template with the name corresponding to the identifier of this route's element.
    Instantiates an SVG template with a given name.
    templateSvg(String name, String encoding)
    Instantiates an SVG template with a given name and encoding.
    Instantiates a TXT template with the name corresponding to the identifier of this route's element.
    Instantiates a TXT template with a given name.
    templateTxt(String name, String encoding)
    Instantiates a TXT template with a given name and encoding.
    Instantiates an XML template with the name corresponding to the identifier of this route's element.
    Instantiates an XML template with a given name.
    templateXml(String name, String encoding)
    Instantiates an XML template with a given name and encoding.
    boolean
    Indicates whether the response text buffer is enabled or disabled.
    urlFor(Route route)
    Start building a URL towards a particular route.
    Returns the root URL of this web application.
    webappRootUrl(int port)
    Returns the root URL of this web application.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_BOOLEAN

      public static final boolean DEFAULT_BOOLEAN
      See Also:
    • DEFAULT_INTEGER

      public static final int DEFAULT_INTEGER
      See Also:
    • DEFAULT_LONG

      public static final long DEFAULT_LONG
      See Also:
    • DEFAULT_DOUBLE

      public static final double DEFAULT_DOUBLE
      See Also:
    • DEFAULT_FLOAT

      public static final float DEFAULT_FLOAT
      See Also:
    • SC_NOT_MODIFIED

      public static final int SC_NOT_MODIFIED
      Status code (304) indicating that a conditional GET operation found that the resource was available and not modified.
      See Also:
    • SC_INTERNAL_SERVER_ERROR

      public static final int SC_INTERNAL_SERVER_ERROR
      Status code (500) indicating an error inside the HTTP server which prevented it from fulfilling the request.
      See Also:
  • Method Details

    • site

      public Site site()
      The active site this context is executing in.
      Returns:
      the currently active site
      Since:
      1.0
    • request

      public Request request()
      The request of this context.

      Most request methods have direct counterparts in the context for easier and more convenient usage.

      Returns:
      this context's request
      Since:
      1.0
    • response

      public Response response()
      The response of this context.

      Most response methods have direct counterparts in the context for easier and more convenient usage.

      Returns:
      this context's response
      Since:
      1.0
    • pathInfo

      public String pathInfo()
      The pathinfo that was captured or matched.

      The slash separated between the route path in the pathinfo will have been stripped already.

      Returns:
      the captured or matching pathinfo; or null if no pathinfo was captured or matched
      Since:
      1.0
    • route

      public Route route()
      The route of this context.
      Returns:
      this context's route; or null if the context doesn't belong to a specific route
      Since:
      1.0
    • router

      public Router router()
      The router in which this context's route was defined.
      Returns:
      this context's route's router; or null if the context doesn't belong to a specific route
      Since:
      1.0
    • properties

      public HierarchicalProperties properties()
      The hierarchical properties accessible to this context.
      Returns:
      this context's hierarchical properties; or null if those properties can't be found
      Since:
      1.0
    • property

      public Object property(String name)
      Retrieve a property from this context's HierarchicalProperties.
      Returns:
      the requested property; or null if it doesn't exist
      Since:
      1.0
    • hasProperty

      public boolean hasProperty(String name)
      Checks for the existence of a property in this context's HierarchicalProperties.
      Returns:
      true if the property exists; or false otherwise
      Since:
      1.0
    • propertyNames

      public Collection<String> propertyNames()
      Returns a collection of the names in this context's HierarchicalProperties.
      Returns:
      the requested collection of names
      Since:
      1.0
    • pause

      public final void pause()
      Pauses the execution of the element and creates a new continuation.

      The next request will resume exactly at the same location with a completely restored call stack and variable stack.

      Since:
      1.0
    • hasContinuationId

      public boolean hasContinuationId()
      Indicates whether a continuation identifier is available
      Returns:
      true when a continuation identifier is available; or

      false otherwise

      Since:
      1.0
    • continuationId

      public String continuationId()
      Returns the unique identifier of the current continuation.
      Returns:
      the unique identifier of the current continuation; or

      null if no continuation is active

      Since:
      1.0
    • print

      public void print(Object object) throws EngineException
      Prints the string representation of an object to the request text output. The string representation will be created through a String.valueOf(value) call.
      Parameters:
      object - the object that will be output
      Throws:
      EngineException - if an error occurs during the output of the content
      Since:
      1.0
      See Also:
    • print

      public void print(Template template) throws TemplateException
      Prints a template to the response.

      If no response content type was set yet, the template's content type will be used.

      Printing a template will automatically process all the filtered tags.

      Printing a template instead of the string representation of its content has many advantages, the biggest one being that the out-of-container testing API will have access to this template instance, allowing you to assert of value content, instead of having to parse a response.

      Parameters:
      template - the template to print
      Throws:
      TemplateException - if an error occurs while processing the template
      EngineException - if an error occurs during the output of the content
      Since:
      1.0
    • fromTemplate

      public static Context fromTemplate(Template template)
      Retrieves the context that was stored in a template attribute.

      Each template that was obtained through a context, automatically has the context store itself in the template as an attribute. This convenience method makes it easy to retrieve that context elsewhere.

      Returns:
      the current context stored in a template attribute.
      Since:
      1.8.0
    • template

      public Template template() throws TemplateException
      Instantiates an HTML template with the name corresponding to the identifier of this route's element.

      For lambda elements, this will be the path of the route and for class elements this will be the shortened uncapitalized name of the class.

      Returns:
      the HTML template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • template

      public Template template(String name) throws TemplateException
      Instantiates an HTML template with a given name.
      Parameters:
      name - the template name
      Returns:
      the HTML template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • template

      public Template template(String name, String encoding) throws TemplateException
      Instantiates an HTML template with a given name and encoding.
      Parameters:
      name - the template name
      encoding - the template's encoding
      Returns:
      the HTML template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateTxt

      public Template templateTxt() throws TemplateException
      Instantiates a TXT template with the name corresponding to the identifier of this route's element.

      For lambda elements, this will be the path of the route and for class elements this will be the shortened uncapitalized name of the class.

      Returns:
      the TXT template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateTxt

      public Template templateTxt(String name) throws TemplateException
      Instantiates a TXT template with a given name.
      Parameters:
      name - the template name
      Returns:
      the TXT template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateTxt

      public Template templateTxt(String name, String encoding) throws TemplateException
      Instantiates a TXT template with a given name and encoding.
      Parameters:
      name - the template name
      encoding - the template's encoding
      Returns:
      the TXT template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateXml

      public Template templateXml() throws TemplateException
      Instantiates an XML template with the name corresponding to the identifier of this route's element.

      For lambda elements, this will be the path of the route and for class elements this will be the shortened uncapitalized name of the class.

      Returns:
      the XML template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateXml

      public Template templateXml(String name) throws TemplateException
      Instantiates an XML template with a given name.
      Parameters:
      name - the template name
      Returns:
      the XML template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateXml

      public Template templateXml(String name, String encoding) throws TemplateException
      Instantiates an XML template with a given name and encoding.
      Parameters:
      name - the template name
      encoding - the template's encoding
      Returns:
      the XML template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateJson

      public Template templateJson() throws TemplateException
      Instantiates an JSON template with the name corresponding to the identifier of this route's element.

      For lambda elements, this will be the path of the route and for class elements this will be the shortened uncapitalized name of the class.

      Returns:
      the JSON template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateJson

      public Template templateJson(String name) throws TemplateException
      Instantiates an JSON template with a given name.
      Parameters:
      name - the template name
      Returns:
      the JSON template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateJson

      public Template templateJson(String name, String encoding) throws TemplateException
      Instantiates an JSON template with a given name and encoding.
      Parameters:
      name - the template name
      encoding - the template's encoding
      Returns:
      the JSON template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateSvg

      public Template templateSvg() throws TemplateException
      Instantiates an SVG template with the name corresponding to the identifier of this route's element.

      For lambda elements, this will be the path of the route and for class elements this will be the shortened uncapitalized name of the class.

      Returns:
      the SVG template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateSvg

      public Template templateSvg(String name) throws TemplateException
      Instantiates an SVG template with a given name.
      Parameters:
      name - the template name
      Returns:
      the SVG template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • templateSvg

      public Template templateSvg(String name, String encoding) throws TemplateException
      Instantiates an SVG template with a given name and encoding.
      Parameters:
      name - the template name
      encoding - the template's encoding
      Returns:
      the SVG template if it was found.
      Throws:
      TemplateException - when an error occurred instantiating the template
      Since:
      1.0
      See Also:
    • gateUrl

      public String gateUrl()
      Retrieves the URL portion that corresponds to the entrance gate of the RIFE2 web engine, this is usually equivalent with the HTTP request context path.
      Returns:
      the URL of the web engine gate
      Since:
      1.0
    • serverRootUrl

      public String serverRootUrl(int port)
      Returns the root URL of the server that is running this web applications.

      This includes the protocol, the server name and the server port, for example: http://www.somehost.com:8080.

      Parameters:
      port - the server port to use, or -1 to use the sane port as the active request
      Returns:
      the server's root url
      Since:
      1.0
    • webappRootUrl

      public String webappRootUrl()
      Returns the root URL of this web application.

      This includes the protocol, the server name and the server port, and the gate URL.

      Returns:
      this web application's root URL
      Since:
      1.0
    • webappRootUrl

      public String webappRootUrl(int port)
      Returns the root URL of this web application.

      This includes the protocol, the server name and the server port, and the gate URL.

      Parameters:
      port - the server port to use, or -1 to use the sane port as the active request
      Returns:
      this web application's root URL
      Since:
      1.0
    • urlFor

      public UrlBuilder urlFor(Route route)
      Start building a URL towards a particular route.

      The result is a instance that can be used for further customization of the URL, if needed.

      Parameters:
      route - the target route
      Returns:
      an instance of
      Since:
      1.0
    • engineException

      public Throwable engineException()
      Retrieves the exception that was triggered during the RIFE2 web engine execution.
      Returns:
      the triggered exception; or

      null if no exception was triggered

      Since:
      1.0
    • selectParameter

      public Collection<String> selectParameter(Template template, String name, String[] values)
      Sets a select box option, a radio button or a checkbox to selected or checked.

      This method delegates all logic to the FormBuilder.selectParameter(Template, String, String[]) method of the provided template instance.

      Parameters:
      template - the template instance where the selection should happen
      name - the name of the parameter
      values - the values that should be selected or checked
      Returns:
      a list with the identifiers of the template values that have been set, this is never null, when no values are set an empty list is returned
      Since:
      1.0
      See Also:
    • generateForm

      public void generateForm(Template template, Object beanInstance)
      Generates a form that corresponds to a bean instance.
      Parameters:
      template - the template instance where the generation should happen
      beanInstance - the instance of the bean that should be used to generate the form
      Since:
      1.0
      See Also:
    • generateForm

      public void generateForm(Template template, Object beanInstance, String prefix)
      Generates a form that corresponds to a bean instance.

      This method delegates all logic to the FormBuilder.generateForm(Template, Object, Map, String) method of the provided template instance.

      Parameters:
      template - the template instance where the generation should happen
      beanInstance - the instance of the bean that should be used to generate the form
      prefix - the prefix that will be prepended to all bean property names
      Since:
      1.0
      See Also:
    • generateEmptyForm

      public void generateEmptyForm(Template template, Class beanClass)
      Generates a form that corresponds to an empty instance of a bean class.
      Parameters:
      template - the template instance where the generation should happen
      beanClass - the class of the bean that should be used to generate the form
      Since:
      1.0
      See Also:
    • generateEmptyForm

      public void generateEmptyForm(Template template, Class beanClass, String prefix)
      Generates a form that corresponds to an empty instance of a bean class.

      An 'empty' instance is an object that has been created by calling the default constructor of the bean class, without making any additional changes to it afterward.

      This method delegates all logic to the FormBuilder.generateForm(Template, Class, Map, String) method of the provided template instance.

      Parameters:
      template - the template instance where the generation should happen
      beanClass - the class of the bean that should be used to generate the form
      prefix - the prefix that will be prepended to all bean property names
      Since:
      1.0
      See Also:
    • removeForm

      public void removeForm(Template template, Class beanClass)
      Removes a generated form, leaving the builder value tags empty again as if this form had never been generated.
      Parameters:
      template - the template instance where the form should be removed from
      beanClass - the class of the bean that should be used to remove the form
      Since:
      1.0
      See Also:
    • removeForm

      public void removeForm(Template template, Class beanClass, String prefix)
      Removes a generated form, leaving the builder value tags empty again as if this form had never been generated.

      This method delegates all logic to the FormBuilder.removeForm(Template, Class, String) method of the provided template instance.

      Parameters:
      template - the template instance where the form should be removed from
      beanClass - the class of the bean that should be used to remove the form
      prefix - the prefix that will be prepended to all bean property names
      Since:
      1.0
      See Also:
    • defer

      public void defer() throws DeferException
      Interrupts the execution in RIFE2 completely and defers it to the servlet container.

      If RIFE2 is being run as a filter, it will execute the next filter in the chain.

      If RIFE2 is being run as a servlet, the status code 404: Not Found will be sent to the client.

      Throws:
      DeferException - an exception that is used to immediately interrupt the execution, don't catch this exception
      Since:
      1.0
    • redirect

      public void redirect(Object url) throws RedirectException
      Interrupts the execution in this element and redirects the client to another URL.
      Parameters:
      url - the URL to which the request will be redirected, String.valueOf() will be called with this object, so a variety of types can be used
      Throws:
      RedirectException - an exception that is used to immediately interrupt the execution, don't catch this exception
      Since:
      1.0
    • redirect

      public void redirect(Route route) throws RedirectException
      Interrupts the execution in this element and redirects the client to another URL.
      Parameters:
      route - the route to which the request will be redirected
      Throws:
      RedirectException - an exception that is used to immediately interrupt the execution, don't catch this exception
      Since:
      1.0
    • respond

      public void respond()
      Interrupts the execution in this element, stops processing any other element, and sends the current response directly to the client.
      Throws:
      RespondException - an exception that is used to immediately interrupt the execution, don't catch this exception
      Since:
      1.0
    • next

      public void next()
      Interrupts the execution in this element, moving processing on to the next element in the before/route/after chain
      Throws:
      NextException - an exception that is used to immediately interrupt the execution, don't catch this exception
      Since:
      1.0
    • preventCaching

      public void preventCaching()
      Sets up the current response to prevent all caching of the response by the client.
      Since:
      1.0
    • method

      public RequestMethod method()
      Returns the HTTP RequestMethod with which this context's request was made.
      Returns:
      the RequestMethod of this context's request
      Since:
      1.0
    • parameters

      public Map<String,String[]> parameters()
      Retrieves the parameters that were sent to this context.
      Returns:
      a Map with all the parameter names and values
      Since:
      1.0
    • hasParameterValue

      public boolean hasParameterValue(String name)
      Checks whether a value has been provided to a parameter.
      Parameters:
      name - the name of the parameter
      Returns:
      true if the parameter has a value; or

      false otherwise

      Since:
      1.0
      See Also:
    • isParameterEmpty

      public boolean isParameterEmpty(String name)
      Checks whether a parameter is empty.
      Parameters:
      name - the name of the parameter
      Returns:
      true if the parameter is empty; or

      false otherwise

      Since:
      1.0
      See Also:
    • parameter

      public String parameter(String name)
      Retrieves the value of a parameter.
      Parameters:
      name - the name of the parameter
      Returns:
      the value of the parameter; or

      null if no value is present for this parameter

      Since:
      1.0
      See Also:
    • parameter

      public String parameter(String name, String defaultValue)
      Retrieves the value of a parameter and returns a default value if no parameter value is present
      Parameters:
      name - the name of the parameter
      defaultValue - the default value that will be used when no parameter value is present
      Returns:
      the parameter value; or

      the default value if no parameter value is present

      Since:
      1.0
      See Also:
    • parameterNames

      public Set<String> parameterNames()
      Retrieves the names of all the parameters that are present.
      Returns:
      the list with the parameter names
      Since:
      1.0
      See Also:
    • parameterValues

      public String[] parameterValues(String name)
      Retrieves the values of a parameter.
      Parameters:
      name - the name of the parameter
      Since:
      1.0
      See Also:
    • parameterBoolean

      public boolean parameterBoolean(String name)
      Retrieves the value of a parameter and converts it to a boolean.
      Parameters:
      name - the name of the parameter
      Returns:
      the converted parameter value; or

      false if no parameter value is present or if the parameter value is not a valid boolean

      Since:
      1.0
      See Also:
    • parameterBoolean

      public boolean parameterBoolean(String name, boolean defaultValue)
      Retrieves the value of a parameter and converts it to a boolean, using a default value if no parameter value is present.
      Parameters:
      name - the name of the parameter
      defaultValue - the default value that will be used when no parameter value is present
      Returns:
      the converted parameter value; or

      the default value if no parameter value is present

      Since:
      1.0
      See Also:
    • parameterInt

      public int parameterInt(String name)
      Retrieves the value of a parameter and converts it to an integer.
      Parameters:
      name - the name of the parameter
      Returns:
      the converted parameter value; or

      0 if no parameter value is present or if the parameter value is not a valid integer

      Since:
      1.0
      See Also:
    • parameterInt

      public int parameterInt(String name, int defaultValue)
      Retrieves the value of a parameter and converts it to an integer, using a default value if no parameter value is present.
      Parameters:
      name - the name of the parameter
      defaultValue - the default value that will be used when no parameter value is present
      Returns:
      the converted parameter value; or

      the default value if no parameter value is present

      Since:
      1.0
      See Also:
    • parameterLong

      public long parameterLong(String name)
      Retrieves the value of a parameter and converts it to a long.
      Parameters:
      name - the name of the parameter
      Returns:
      the converted parameter value; or

      0L if no parameter value is present or if the parameter value is not a valid long

      Since:
      1.0
      See Also:
    • parameterLong

      public long parameterLong(String name, long defaultValue)
      Retrieves the value of a parameter and converts it to a long, using a default value if no parameter value is present.
      Parameters:
      name - the name of the parameter
      defaultValue - the default value that will be used when no parameter value is present
      Returns:
      the converted parameter value; or

      the default value if no parameter value is present

      Since:
      1.0
      See Also:
    • parameterDouble

      public double parameterDouble(String name)
      Retrieves the value of a parameter and converts it to a double.
      Parameters:
      name - the name of the parameter
      Returns:
      the converted parameter value; or

      0.0d if no parameter value is present or if the parameter value is not a valid double

      Since:
      1.0
      See Also:
    • parameterDouble

      public double parameterDouble(String name, double defaultValue)
      Retrieves the value of a parameter and converts it to a double, using a default value if no parameter value is present.
      Parameters:
      name - the name of the parameter
      defaultValue - the default value that will be used when no parameter value is present
      Returns:
      the converted parameter value; or

      the default value if no parameter value is present

      Since:
      1.0
      See Also:
    • parameterFloat

      public float parameterFloat(String name)
      Retrieves the value of a parameter and converts it to a float.
      Parameters:
      name - the name of the parameter
      Returns:
      the converted parameter value; or

      0.0f if no parameter value is present or if the parameter value is not a valid float

      Since:
      1.0
      See Also:
    • parameterFloat

      public float parameterFloat(String name, float defaultValue)
      Retrieves the value of a parameter and converts it to a float, using a default value if no parameter value is present.
      Parameters:
      name - the name of the parameter
      defaultValue - the default value that will be used when no parameter value is present
      Returns:
      the converted parameter value; or

      the default value if no parameter value is present

      Since:
      1.0
      See Also:
    • parameterInts

      public int[] parameterInts(String name)
      Retrieves the values of a parameter as an array of integers.
      Parameters:
      name - the name of the parameter
      Returns:
      an integer array with all the parameter values; or

      null if no parameter values are present

      Since:
      1.0
      See Also:
    • parameterLongs

      public long[] parameterLongs(String name)
      Retrieves the values of a parameter as an array of longs.
      Parameters:
      name - the name of the parameter
      Returns:
      a long array with all the parameter values; or

      null if no parameter values are present

      Since:
      1.0
      See Also:
    • parameterFloats

      public float[] parameterFloats(String name)
      Retrieves the values of a parameter as an array of floats.
      Parameters:
      name - the name of the parameter
      Returns:
      a float array with all the parameter values; or

      null if no parameter values are present

      Since:
      1.0
      See Also:
    • parameterDoubles

      public double[] parameterDoubles(String name)
      Retrieves the values of a parameter as an array of doubles.
      Parameters:
      name - the name of the parameter
      Returns:
      a double array with all the parameter values; or

      null if no parameter values are present

      Since:
      1.0
      See Also:
    • parametersBean

      public <BeanType> BeanType parametersBean(Class<BeanType> beanClass) throws EngineException
      Creates an instance of a bean and populates the properties with the parameter values.

      This bean is not serialized or de-serialized, each property corresponds to a parameter and is individually sent by the client.

      Parameters:
      beanClass - the class of the submission bean
      Returns:
      the populated bean instance
      Throws:
      EngineException
      Since:
      1.0
      See Also:
    • parametersBean

      public <BeanType> BeanType parametersBean(Class<BeanType> beanClass, String prefix) throws EngineException
      Creates an instance of a bean and populates the properties with the parameter values, taking the provided prefix into account.

      This bean is not serialized or de-serialized, each property corresponds to a parameter and is individually sent by the client.

      Parameters:
      beanClass - the class of the submission bean
      prefix - the prefix that will be put in front of each property name
      Returns:
      the populated bean instance
      Throws:
      EngineException
      Since:
      1.0
      See Also:
    • parametersBean

      public void parametersBean(Object bean) throws EngineException
      Fills the properties of an existing bean with the parameter values.
      Parameters:
      bean - the submission bean instance that will be filled
      Throws:
      EngineException
      Since:
      1.0
      See Also:
    • parametersBean

      public void parametersBean(Object bean, String prefix) throws EngineException
      Fills the properties of an existing bean with the parameter values that were sent, taking the provided prefix into account.
      Parameters:
      bean - the submission bean instance that will be filled
      prefix - the prefix that will be put in front of each property name
      Throws:
      EngineException
      Since:
      1.0
      See Also:
    • body

      public String body()
      Retrieves the body of this context's request as a string.
      Returns:
      the string of the request body
      Since:
      1.0
      See Also:
    • bodyAsBytes

      public byte[] bodyAsBytes()
      Retrieves the body of this context's request as a byte array.
      Returns:
      the byte array of the request body
      Since:
      1.0
      See Also:
    • fileNames

      public Set<String> fileNames()
      Retrieves the list of uploaded file names.
      Returns:
      the set of uploaded file names
      Since:
      1.0
      See Also:
    • isFileEmpty

      public boolean isFileEmpty(String name)
      Checks if an uploaded file wasn't sent or if it is empty.
      Parameters:
      name - the name of the file
      Since:
      1.0
      See Also:
    • files

      public Map<String,UploadedFile[]> files()
      Retrieves the files that were uploaded in this context.
      Returns:
      a Map with all the uploaded files
      Since:
      1.0
      See Also:
    • hasFile

      public boolean hasFile(String name)
      Checks if a particular file has been uploaded in this context.
      Parameters:
      name - the name of the file
      Returns:
      true if the file was uploaded; or

      false otherwise

      Since:
      1.0
      See Also:
    • file

      public UploadedFile file(String name)
      Retrieves an uploaded file.
      Parameters:
      name - the name of the file
      Returns:
      the uploaded file; or

      null if no file was uploaded

      Since:
      1.0
      See Also:
    • files

      public UploadedFile[] files(String name)
      Retrieves all files that have been uploaded for a particular name.
      Parameters:
      name - the name of the file
      Returns:
      the uploaded files; or

      null if no files were uploaded for that name

      Since:
      1.0
      See Also:
    • hasCookie

      public boolean hasCookie(String name)
      Checks whether a cookie is present.
      Parameters:
      name - the name of the cookie
      Returns:
      true if the cookie was present; or

      false otherwise

      Since:
      1.0
      See Also:
    • cookieNames

      public List<String> cookieNames()
      Retrieves the names of the cookies.
      Returns:
      a list of strings with the cookie names
      Since:
      1.0
      See Also:
    • cookieValue

      public String cookieValue(String name)
      Retrieves the value of a cookie.
      Parameters:
      name - the name of the cookie
      Returns:
      the value of the cookie; or

      null if no such cookie is present

      Since:
      1.0
      See Also:
    • cookieValues

      public Map<String,String> cookieValues()
      Retrieves all current cookies names with their values.
      Returns:
      a new map of all the current cookies names with their values
      Since:
      1.0
      See Also:
    • cookieValue

      public String cookieValue(String name, String defaultValue)
      Retrieves the value of a named cookie, using a default value as fallback.
      Parameters:
      name - the name of the cookie
      defaultValue - the default value that will be used when no cookie value is present
      Returns:
      the cookie value; or

      the default value if no cookie value is present

      Since:
      1.0
      See Also:
    • cookieBoolean

      public boolean cookieBoolean(String name)
      Retrieves the value of a named cookie and converts it to a boolean.
      Parameters:
      name - the name of the cookie
      Returns:
      the converted cookie value; or

      false if no cookie value is present or if the cookie value is not a valid boolean

      Since:
      1.0
      See Also:
    • cookieBoolean

      public boolean cookieBoolean(String name, boolean defaultValue)
      Retrieves the value of a named cookie and converts it to a boolean, using a default value if no input value is present.
      Parameters:
      name - the name of the cookie
      defaultValue - the default value that will be used when no cookie value is present
      Returns:
      the converted cookie value; or

      the default value if no cookie value is present

      Since:
      1.0
      See Also:
    • cookieInt

      public int cookieInt(String name)
      Retrieves the value of a named cookie and converts it to an integer.
      Parameters:
      name - the name of the cookie
      Returns:
      the converted cookie value; or

      0 if no cookie value is present or if the cookie value is not a valid integer

      Since:
      1.0
      See Also:
    • cookieInt

      public int cookieInt(String name, int defaultValue)
      Retrieves the value of a named cookie and converts it to an integer, using a default value if no input value is present.
      Parameters:
      name - the name of the cookie
      defaultValue - the default value that will be used when no cookie value is present
      Returns:
      the converted cookie value; or

      the default value if no cookie value is present

      Since:
      1.0
      See Also:
    • cookieLong

      public long cookieLong(String name)
      Retrieves the value of a named cookie and converts it to a long.
      Parameters:
      name - the name of the cookie
      Returns:
      the converted cookie value; or

      0L if no cookie value is present or if the cookie value is not a valid long

      Since:
      1.0
      See Also:
    • cookieLong

      public long cookieLong(String name, long defaultValue)
      Retrieves the value of a named cookie and converts it to a long, using a default value if no input value is present.
      Parameters:
      name - the name of the cookie
      defaultValue - the default value that will be used when no cookie value is present
      Returns:
      the converted cookie value; or

      the default value if no cookie value is present

      Since:
      1.0
      See Also:
    • cookieDouble

      public double cookieDouble(String name)
      Retrieves the value of a named cookie and converts it to a double.
      Parameters:
      name - the name of the cookie
      Returns:
      the converted cookie value; or

      0.0d if no cookie value is present or if the cookie value is not a valid double

      Since:
      1.0
      See Also:
    • cookieDouble

      public double cookieDouble(String name, double defaultValue)
      Retrieves the value of a named cookie and converts it to a double, using a default value if no input value is present.
      Parameters:
      name - the name of the cookie
      defaultValue - the default value that will be used when no cookie value is present
      Returns:
      the converted cookie value; or

      the default value if no cookie value is present

      Since:
      1.0
      See Also:
    • cookieFloat

      public float cookieFloat(String name)
      Retrieves the value of a named cookie and converts it to a float.
      Parameters:
      name - the name of the cookie
      Returns:
      the converted cookie value; or

      0.0f if no cookie value is present or if the cookie value is not a valid float

      Since:
      1.0
      See Also:
    • cookieFloat

      public float cookieFloat(String name, float defaultValue)
      Retrieves the value of a named cookie and converts it to a float, using a default value if no input value is present.
      Parameters:
      name - the name of the cookie
      defaultValue - the default value that will be used when no cookie value is present
      Returns:
      the converted cookie value; or

      the default value if no cookie value is present

      Since:
      1.0
      See Also:
    • attribute

      public Object attribute(String name)
      Returns the value of the named attribute.
      Parameters:
      name - the name of the attribute
      Returns:
      an Object containing the value of the attribute; or

      null if the attribute does not exist

      Since:
      1.0
      See Also:
    • hasAttribute

      public boolean hasAttribute(String name)
      Checks if a request attribute exists.
      Parameters:
      name - a String specifying the name of the attribute

      false otherwise

      Since:
      1.0
      See Also:
    • attributeNames

      public List<String> attributeNames()
      Returns a list of attribute names available to this request.
      Returns:
      a list of strings containing the names of the request's attributes; or

      an empty list if not attributes are present

      Since:
      1.0
      See Also:
    • removeAttribute

      public void removeAttribute(String name)
      Removes an attribute from this request. This method is not generally needed as attributes only persist as long as the request is being handled.
      Parameters:
      name - the name of the attribute to remove
      Since:
      1.0
      See Also:
    • setAttribute

      public void setAttribute(String name, Object object)
      Stores an attribute in this request. Attributes are reset between requests.

      Attribute names should follow the same conventions as package names. If the object passed in is null, the effect is the same as calling removeAttribute.

      Parameters:
      name - the name of the attribute to set
      object - the object to store
      Since:
      1.0
      See Also:
    • characterEncoding

      public String characterEncoding()
      Returns the name of the character encoding used in the body of this request.
      Returns:
      a String containing the name of the character encoding; or

      null if the request does not specify a character encoding

      Since:
      1.0
    • contentType

      public String contentType()
      Returns the MIME type of the body of the request, or null if the type is not known.
      Returns:
      a String containing the name of the MIME type of the request; or null if the type is not known
      Since:
      1.0
    • header

      public String header(String name)
      Returns the value of the specified request header as a String.
      Parameters:
      name - the case-insensitive name of the header
      Returns:
      a String with the value of the requested header; or null if the request does not have a header of that name
      Since:
      1.0
      See Also:
    • headerDate

      public long headerDate(String name)
      Returns the value of the specified request header as a long value that represents a date. Use this method with headers that contain dates, such as If-Modified-Since.
      Parameters:
      name - the case-insensitive name of the header
      Returns:
      a long value representing the date specified in the header expressed as the number of milliseconds since January 1, 1970 GMT; or

      -1 if the named header was not included with the request

      Throws:
      IllegalArgumentException - if the header can't be converted to a date
      Since:
      1.0
      See Also:
    • headerInt

      public int headerInt(String name)
      Returns the value of the specified request header as an int.
      Parameters:
      name - the case-insensitive name of the header
      Returns:
      an integer expressing the value of the request header; or

      -1 if the request doesn't have a header of this name

      Throws:
      NumberFormatException - if the header value can't be converted to an int
      Since:
      1.0
      See Also:
    • headerNames

      public List<String> headerNames()
      Returns a list of all the header names in the request.
      Returns:
      a list of all the header names sent with this request;

      if the request has no headers, an empty list will be returned

      Since:
      1.0
      See Also:
    • headers

      public List<String> headers(String name)
      Returns all the values of the specified request header as a list of String objects.

      Some headers, such as Accept-Language can be sent by clients as several headers each with a different value rather than sending the header as a comma separated list.

      Parameters:
      name - the case-insensitive name of the header
      Returns:
      a list containing the values of the requested header;

      itf the request does not have any headers of that name an empty list will be returned

      Since:
      1.0
      See Also:
    • locale

      public Locale locale()
      Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.

      If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.

      Returns:
      the preferred Locale for the client
      Since:
      1.0
    • locales

      public List<Locale> locales()
      Returns a list of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language} header.

      If the client request doesn't provide an Accept-Language header, this method returns a list containing one Locale, the default locale for the server.

      Returns:
      a list of preferred Locale objects for the client
      Since:
      1.0
    • remoteAddr

      public String remoteAddr()
      Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
      Returns:
      a String containing the IP address of the client that sent the request
      Since:
      1.0
    • remoteUser

      public String remoteUser()
      Returns the login of the user making this request.

      Whether the username is sent with each subsequent request depends on the browser and type of authentication.

      Returns:
      a String specifying the login of the user making this request; or null if the user login is not known
      Since:
      1.0
    • remoteHost

      public String remoteHost()
      Returns the fully qualified name of the client or the last proxy that sent the request. If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address.
      Returns:
      a String containing the fully qualified name of the client
      Since:
      1.0
    • session

      public Session session()
      Returns the current session associated with this request, or if the request does not have a session, creates one.
      Returns:
      the Session associated with this request
      Since:
      1.0
      See Also:
    • session

      public Session session(boolean create)
      Returns the current Session associated with this request or, if there is no current session and create is true, returns a new session.

      If create is false and the request has no valid Session, this method returns null.

      Parameters:
      create - true to create a new session for this request if necessary; false to return null if there's no current session
      Returns:
      the Session associated with this request or null if create is false and the request has no valid session
      Since:
      1.0
    • serverPort

      public int serverPort()
      Returns the port number to which the request was sent.
      Returns:
      an integer specifying the port number
      Since:
      1.0
    • protocol

      public String protocol()
      Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
      Returns:
      a String containing the protocol name and version number
      Since:
      1.0
    • scheme

      public String scheme()
      Returns the name of the scheme used to make this request.
      Returns:
      the name of the scheme used to make this request
      Since:
      1.0
    • serverName

      public String serverName()
      Returns the host name of the server to which the request was sent.
      Returns:
      the name of the server
      Since:
      1.0
    • contextPath

      public String contextPath()
      Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "". The container does not decode this string.
      Returns:
      the portion of the request URI that indicates the context of the request
      Since:
      1.0
    • secure

      public boolean secure()
      Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
      Returns:
      a boolean indicating whether the request was made using a secure channel
      Since:
      1.0
    • enableTextBuffer

      public void enableTextBuffer(boolean enabled)
      Enables or disables the response text buffer. By default, it is enabled.

      Disabling an enabled text buffer, flushes the already buffered content first.

      If the text buffer is disabled, text content will be sent immediately to the client, this can decrease performance. Unless you need to stream content in real time, it's best to leave the text buffer enabled. It will be flushed and sent in one go at the end of the request.

      Parameters:
      enabled - true to enable the text buffer; or

      false to disable it

      Since:
      1.0
      See Also:
    • textBufferEnabled

      public boolean textBufferEnabled()
      Indicates whether the response text buffer is enabled or disabled.
      Returns:
      true if the text buffer is enabled; or

      false if it is disabled

      Since:
      1.0
      See Also:
    • clearBuffer

      public void clearBuffer()
      Clears the text buffer is it's enabled.

      If the text buffer is disabled, this method does nothing.

      Since:
      1.0
    • flush

      public void flush()
      Forces all the streamed content to be output to the client.

      If the text buffer is enabled, this will flush its content to the output stream first.

      Since:
      1.0
    • outputStream

      public OutputStream outputStream() throws EngineException
      Returns an output stream suitable for writing binary data in the response.

      When possible and applicable, this output stream will automatically handle gzip encoding.

      Returns:
      an OutputStream for binary data output
      Throws:
      EngineException
      Since:
      1.0
    • setContentType

      public void setContentType(String contentType)
      Sets the content type of the response being sent to the client.
      Parameters:
      contentType - the MIME type of the content
      Since:
      1.0
    • setContentLength

      public void setContentLength(int length)
      Sets the length of the content body in the response.
      Parameters:
      length - an integer specifying the length of the content being returned to the client
      Since:
      1.0
    • setLocale

      public void setLocale(Locale locale)
      Sets the locale of the response.
      Parameters:
      locale - the locale of the response
      Since:
      1.0
    • setParameter

      public void setParameter(String name, Object value)
      Sets a named parameter value for URL generation with urlFor(rife.engine.Route) or the `route:` filtered template value tags.

      The parameter value will be converted to a string array.

      Setting parameters acts on a different collection than incoming request parameters and is used for RIFE2 state-related features like URL generation.

      Parameters:
      name - the name of the parameter to set
      value - the value of the parameter
      Since:
      1.0
      See Also:
    • setParametersBean

      public void setParametersBean(Object bean)
      Sets named parameters values from bean properties for URL generation with urlFor(rife.engine.Route) or the `route:` filtered template value tags.
      Parameters:
      bean - the bean whose properties will be set as parameters
      Since:
      1.0
      See Also:
    • setParametersBean

      public void setParametersBean(Object bean, String prefix)
      Sets named parameters values from bean properties for URL generation with urlFor(rife.engine.Route) or the `route:` filtered template value tags.
      Parameters:
      bean - the bean whose properties will be set as parameters
      prefix - the prefix that will be added to the parameter names
      Since:
      1.0
      See Also:
    • removeParameter

      public void removeParameter(String name)
      Removes a name parameter that was previously set.
      Parameters:
      name - the name of the parameter to remove
      Since:
      1.0
      See Also:
    • addCookie

      public void addCookie(CookieBuilder builder)
      Adds the Cookie created by a CookieBuilder to the response. This method can be called multiple times to set more than one cookie.
      Parameters:
      builder - the CookieBuilder to use for building the Cookie
      Since:
      1.0
    • removeCookie

      public void removeCookie(String name)
      Removes a cookie with path "/".
      Parameters:
      name - name of the cookie
      Since:
      1.0
    • removeCookie

      public void removeCookie(String path, String name)
      Removes a cookie with given path and name.
      Parameters:
      path - path of the cookie
      name - name of the cookie
      Since:
      1.0
    • setHeader

      public void setHeader(String name, String value)
      Sets a response header with the given name and value.

      If the header had already been set, the new value overwrites the previous one.

      Parameters:
      name - the name of the header
      value - the additional header value
      Since:
      1.0
    • addHeader

      public void addHeader(String name, String value)
      Adds a response header with the given name and value.

      This method allows response headers to have multiple values.

      Parameters:
      name - the name of the header
      value - the additional header value
      Since:
      1.0
    • setDateHeader

      public void setDateHeader(String name, long date)
      Adds a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch.

      If the header had already been set, the new value overwrites the previous one.

      Parameters:
      name - the name of the header to set
      date - the additional date value
      Since:
      1.0
    • addDateHeader

      public void addDateHeader(String name, long date)
      Adds a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch.

      This method allows response headers to have multiple values.

      Parameters:
      name - the name of the header to set
      date - the additional date value
      Since:
      1.0
    • setHeader

      public void setHeader(String name, int value)
      Adds a response header with the given name and integer value.

      If the header had already been set, the new value overwrites the previous one.

      Parameters:
      name - the name of the header
      value - the assigned integer value
      Since:
      1.0
    • addHeader

      public void addHeader(String name, int value)
      Adds a response header with the given name and integer value.

      This method allows response headers to have multiple values.

      Parameters:
      name - the name of the header
      value - the assigned integer value
      Since:
      1.0
    • setStatus

      public void setStatus(int statusCode)
      Sets the status code for the response.
      Parameters:
      statusCode - the status code
      Since:
      1.0