org.apache.myfaces.trinidad.util

## Enum RequestType

- java.lang.Object
- - java.lang.Enum<RequestType>
  - - org.apache.myfaces.trinidad.util.RequestType

- All Implemented Interfaces:
    Serializable, Comparable<RequestType>

      public enum RequestType
      extends Enum<RequestType>

  Represents the type of request currently in the ExternalContext. All servlet requests will be of the SERVLET requestType whereas all of the other RequestTypes will be portlet type requests. There are a number of convenience methods on the RequestType enumeration which can be used to determine the capabilities of the current request.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `ACTION` The type for a portlet ActionRequest.
    `EVENT` The type for a portlet EventRequest.
    `RENDER` The type for a portlet RenderRequest.
    `RESOURCE` The type for a portlet ResourceRequest.
    `SERVLET` The type for all servlet requests.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isPortlet()` Returns `true` if the response for this RequestType originated from a JSR-168 or JSR-286 portlet container.
    `boolean` | `isRequestFromClient()` Returns `true` if this request was a direct result of a call from the client.
    `boolean` | `isResponseWritable()` Returns `true` if the response for this RequestType is intended to produce output to the client.
    `static RequestType` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static RequestType[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### SERVLET

          public static final RequestType SERVLET

      The type for all servlet requests. SERVLET request types are both client requests and response writable.

    - #### RENDER

          public static final RequestType RENDER

      The type for a portlet RenderRequest. RENDER request types are for portlets and are response writable but are NOT client requests.

    - #### ACTION

          public static final RequestType ACTION

      The type for a portlet ActionRequest. ACTION request types are for portlets and are client requests but are NOT response writable.

    - #### RESOURCE

          public static final RequestType RESOURCE

      The type for a portlet ResourceRequest. RESOURCE request types are for portlets and are both client requests and response writable. RESOURCE request types will only be returned in a Portlet 2.0 portlet container.

    - #### EVENT

          public static final RequestType EVENT

      The type for a portlet EventRequest. EVENT request types are for portlets and are neither client requests nor response writable. EVENT request types will only be returned in a Portlet 2.0 portlet container.

  - ### Method Detail

    - #### values

          public static RequestType[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (RequestType c : RequestType.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static RequestType valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### isRequestFromClient

          public boolean isRequestFromClient()

      Returns `true` if this request was a direct result of a call from the client. This implies that the current application is the "owner" of the current request and that it has access to the inputStream, can get and set character encodings, etc. Currently all SERVLET, ACTION, and RESOURCE RequestTypes are client requests.
      Returns:
        `true` if the current request is a client data type request and `false` if it is not.

    - #### isResponseWritable

          public boolean isResponseWritable()

      Returns `true` if the response for this RequestType is intended to produce output to the client. Currently the SERVLET, RENDER, and RESOURCE request are response writable.
      Returns:
        `true` if the current request is intended to produce output and `false` if it is not.

    - #### isPortlet

          public boolean isPortlet()

      Returns `true` if the response for this RequestType originated from a JSR-168 or JSR-286 portlet container. Currently RENDER, ACTION, RESOURCE, and EVENT RequestTypes are all portlet requests.
      Returns:
        `true` if the current request originated inside of a JSR-168 or JSR-286 Portlet Container or `false` if it did not.

Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.