Default Headers

The following annotations are provided for specifying default header values for requests and responses:

- {@link oajr.annotation.RestResource#defaultRequestHeaders() @RestResource(defaultRequestHeaders)}
  Defines default headers on request when the client doesn't specify them.
- {@link oajr.annotation.RestResource#defaultResponseHeaders() @RestResource(defaultResponseHeaders)}
  Appends the specified headers if they weren't already set programmatically.

##### Example:

// Servlet with default headers @RestResource( // Assume "text/json" Accept value when Accept not specified defaultRequestHeaders={"Accept: text/json"}, // Add a version header attribute to all responses defaultResponseHeaders={"X-Version: 1.0"} ) public MyRestServlet extends BasicRestServlet { ... }

Default headers can also be specified programmatically by overriding the following methods:

- {@link oajr.RestContextBuilder}
  - {@link oajr.RestContextBuilder#defaultRequestHeaders(String[])}
  - {@link oajr.RestContextBuilder#defaultResponseHeaders(String[])}