Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jersey.api.core
Interface HttpResponseContext

All Known Implementing Classes:
  ContainerResponse

    public interface HttpResponseContext

An abstraction of a HTTP response.

The default state is a HTTP response with a status code of 204 (No Content) with no headers and entity.

Method Summary
`java.lang.annotation.Annotation[]` | `getAnnotations()` Get the annotations associated with the response entity (if any).
`java.lang.Object` | `getEntity()`
`java.lang.reflect.Type` | `getEntityType()`
`javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object>` | `getHttpHeaders()` Get the HTTP response headers.
`java.io.OutputStream` | `getOutputStream()` Get an `OutputStream` to which an entity may be written.
`javax.ws.rs.core.Response` | `getResponse()` Get the response that was set.
`int` | `getStatus()`
`boolean` | `isCommitted()` Ascertain if a response has been committed to the container.
`boolean` | `isResponseSet()` Check if the response has been set using the setReponse methods.
`void` | `setAnnotations(java.lang.annotation.Annotation[] annotations)` Set the annotations associated with the response entity (if any).
`void` | `setEntity(java.lang.Object entity)` Set the entity of the response.
`void` | `setResponse(javax.ws.rs.core.Response response)` Set the response state from a Response instance.
`void` | `setStatus(int status)` Set the status of the response.

Method Detail

### getResponse

    javax.ws.rs.core.Response getResponse()

  Get the response that was set.

  Returns:
    the response.

### setResponse

    void setResponse(javax.ws.rs.core.Response response)

  Set the response state from a Response instance. This replaces a pre-existing response state.

  Parameters:
    `response` - the response.

### isResponseSet

    boolean isResponseSet()

  Check if the response has been set using the setReponse methods.

  Returns:
    true if the response has been set.

### getStatus

    int getStatus()

  Returns:
    the status of the response

### setStatus

    void setStatus(int status)

  Set the status of the response.

  Parameters:
    `status` - the status.

### getEntity

    java.lang.Object getEntity()

  Returns:
    the entity of the response.

### getEntityType

    java.lang.reflect.Type getEntityType()

  Returns:
    the type of the entity.

### setEntity

    void setEntity(java.lang.Object entity)

  Set the entity of the response.

  Parameters:
    `entity` - the entity. If the entity is an instance of `GenericEntity` then the entity and entity type are set from the entity and type of that `GenericEntity`.

### getAnnotations

    java.lang.annotation.Annotation[] getAnnotations()

  Get the annotations associated with the response entity (if any).

  Returns:
    the annotations.

### setAnnotations

    void setAnnotations(java.lang.annotation.Annotation[] annotations)

  Set the annotations associated with the response entity (if any).

  Parameters:
    `annotations` - the annotations.

### getHttpHeaders

    javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> getHttpHeaders()

  Get the HTTP response headers. The returned map is case-insensitive with respect to the keys (header values). The method `setResponse(javax.ws.rs.core.Response)` will replace any headers previously set.

  Returns:
    a mutable map of headerd.

### getOutputStream

    java.io.OutputStream getOutputStream()
                                         throws java.io.IOException

  Get an `OutputStream` to which an entity may be written.

  The first byte written will result in the writing of thethe status code and headers.

  Returns:
    the output stream
  Throws:
    `java.io.IOException` - if an IO error occurs

### isCommitted

    boolean isCommitted()

  Ascertain if a response has been committed to the container.

  A response is committed if the status code, headers have been written to the container.

  Returns:
    true if the response has been committed.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.