org.apache.struts2.rest

## Class DefaultHttpHeaders

- java.lang.Object
- - org.apache.struts2.rest.DefaultHttpHeaders

- All Implemented Interfaces:
    HttpHeaders

      public class DefaultHttpHeaders
      extends Object
      implements HttpHeaders

  Default implementation of rest info that uses fluent-style construction

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultHttpHeaders()`
    `DefaultHttpHeaders(String result)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `apply(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object target)` Applies the configured information to the response
    `DefaultHttpHeaders` | `disableCaching()`
    `String` | `getResultCode()`
    `int` | `getStatus()`
    `DefaultHttpHeaders` | `lastModified(Date date)`
    `DefaultHttpHeaders` | `renderResult(String code)`
    `DefaultHttpHeaders` | `setLocation(String loc)`
    `DefaultHttpHeaders` | `setLocationId(Object id)`
    `void` | `setStatus(int s)`
    `DefaultHttpHeaders` | `withETag(Object etag)`
    `DefaultHttpHeaders` | `withNoETag()`
    `DefaultHttpHeaders` | `withStatus(int code)`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultHttpHeaders

          public DefaultHttpHeaders()

    - #### DefaultHttpHeaders

          public DefaultHttpHeaders(String result)

  - ### Method Detail

    - #### renderResult

          public DefaultHttpHeaders renderResult(String code)

    - #### withStatus

          public DefaultHttpHeaders withStatus(int code)

    - #### withETag

          public DefaultHttpHeaders withETag(Object etag)

    - #### withNoETag

          public DefaultHttpHeaders withNoETag()

    - #### setLocationId

          public DefaultHttpHeaders setLocationId(Object id)

    - #### setLocation

          public DefaultHttpHeaders setLocation(String loc)

    - #### lastModified

          public DefaultHttpHeaders lastModified(Date date)

    - #### disableCaching

          public DefaultHttpHeaders disableCaching()

    - #### apply

          public String apply(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response,
                              Object target)

      Description copied from interface: `HttpHeaders`
      Applies the configured information to the response
      Specified by:
        `apply` in interface `HttpHeaders`
      Parameters:
        `request` - The request
        `response` - The response
        `target` - The target object, usually the action
      Returns:
        The result code to process

    - #### getStatus

          public int getStatus()

      Specified by:
        `getStatus` in interface `HttpHeaders`
      Returns:
        The HTTP status code

    - #### setStatus

          public void setStatus(int s)

      Specified by:
        `setStatus` in interface `HttpHeaders`
      Parameters:
        `s` - set the HTTP status code

    - #### getResultCode

          public String getResultCode()

      Specified by:
        `getResultCode` in interface `HttpHeaders`
      Returns:
        The result code to process

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.