org.jboss.resteasy.mock

## Class MockHttpRequest

- java.lang.Object
- - org.jboss.resteasy.plugins.server.BaseHttpRequest
  - - org.jboss.resteasy.mock.MockHttpRequest

- All Implemented Interfaces:
    HttpRequest

      public class MockHttpRequest
      extends BaseHttpRequest

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ResteasyAsynchronousContext` | `asynchronousContext`
    `protected Map<String,Object>` | `attributes`
    `protected static URI` | `EMPTY_URI`
    `protected ResteasyHttpHeaders` | `httpHeaders`
    `protected String` | `httpMethod`
    `protected InputStream` | `inputStream`

    - ### Fields inherited from class org.jboss.resteasy.plugins.server.BaseHttpRequest

      `decodedFormParameters, formParameters, uri`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `MockHttpRequest()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MockHttpRequest` | `accept(List<MediaType> accepts)`
    `MockHttpRequest` | `accept(MediaType accept)`
    `MockHttpRequest` | `accept(String type)`
    `MockHttpRequest` | `addFormHeader(String name, String value)` Set CONTENT-TYPE to ""application/x-www-form-urlencoded"
    `MockHttpRequest` | `content(byte[] bytes)`
    `MockHttpRequest` | `content(InputStream stream)`
    `MockHttpRequest` | `contentType(MediaType type)`
    `MockHttpRequest` | `contentType(String type)`
    `MockHttpRequest` | `cookie(String name, String value)`
    `static MockHttpRequest` | `create(String httpMethod, String uri)`
    `static MockHttpRequest` | `create(String httpMethod, URI uriObj, URI baseUri)`
    `static MockHttpRequest` | `deepCopy(HttpRequest request)`
    `static MockHttpRequest` | `delete(String uri)`
    `void` | `forward(String path)`
    `static MockHttpRequest` | `get(String uri)`
    `ResteasyAsynchronousContext` | `getAsyncContext()`
    `ResteasyAsynchronousContext` | `getAsynchronousContext()`
    `Object` | `getAttribute(String attribute)` Map of contextual data.
    `Enumeration<String>` | `getAttributeNames()`
    `HttpHeaders` | `getHttpHeaders()`
    `String` | `getHttpMethod()`
    `InputStream` | `getInputStream()`
    `MultivaluedMap<String,String>` | `getMutableHeaders()`
    `ResteasyUriInfo` | `getUri()` This method *MUST* always return the same instance.
    `static MockHttpRequest` | `head(String uri)`
    `MockHttpRequest` | `header(String name, String value)`
    `void` | `initialRequestThreadFinished()`
    `protected static MockHttpRequest` | `initWithUri(String uri)`
    `MockHttpRequest` | `language(String language)`
    `static MockHttpRequest` | `options(String uri)`
    `static MockHttpRequest` | `post(String uri)`
    `static MockHttpRequest` | `put(String uri)`
    `void` | `removeAttribute(String name)`
    `void` | `setAsynchronousContext(ResteasyAsynchronousContext asynchronousContext)`
    `void` | `setAttribute(String name, Object value)`
    `void` | `setHttpMethod(String method)`
    `void` | `setInputStream(InputStream stream)` If you are using a servlet container, this will *NOT* override the HttpServletRequest.getInputStream().
    `boolean` | `wasForwarded()`

    - ### Methods inherited from class org.jboss.resteasy.plugins.server.BaseHttpRequest

      `getDecodedFormParameters, getFormParameters, isInitial, setRequestUri, setRequestUri`

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

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

- - ### Field Detail

    - #### httpHeaders

          protected ResteasyHttpHeaders httpHeaders

    - #### inputStream

          protected InputStream inputStream

    - #### httpMethod

          protected String httpMethod

    - #### attributes

          protected Map<String,Object> attributes

    - #### asynchronousContext

          protected ResteasyAsynchronousContext asynchronousContext

    - #### EMPTY_URI

          protected static final URI EMPTY_URI

  - ### Constructor Detail

    - #### MockHttpRequest

          protected MockHttpRequest()

  - ### Method Detail

    - #### initWithUri

          protected static MockHttpRequest initWithUri(String uri)
                                                throws URISyntaxException

      Throws:
        `URISyntaxException`

    - #### create

          public static MockHttpRequest create(String httpMethod,
                               String uri)
                                        throws URISyntaxException

      Throws:
        `URISyntaxException`

    - #### create

          public static MockHttpRequest create(String httpMethod,
                               URI uriObj,
                               URI baseUri)

    - #### options

          public static MockHttpRequest options(String uri)
                                         throws URISyntaxException

      Throws:
        `URISyntaxException`

    - #### get

          public static MockHttpRequest get(String uri)
                                     throws URISyntaxException

      Throws:
        `URISyntaxException`

    - #### post

          public static MockHttpRequest post(String uri)
                                      throws URISyntaxException

      Throws:
        `URISyntaxException`

    - #### put

          public static MockHttpRequest put(String uri)
                                     throws URISyntaxException

      Throws:
        `URISyntaxException`

    - #### delete

          public static MockHttpRequest delete(String uri)
                                        throws URISyntaxException

      Throws:
        `URISyntaxException`

    - #### head

          public static MockHttpRequest head(String uri)
                                      throws URISyntaxException

      Throws:
        `URISyntaxException`

    - #### deepCopy

          public static MockHttpRequest deepCopy(HttpRequest request)
                                          throws IOException

      Throws:
        `IOException`

    - #### setHttpMethod

          public void setHttpMethod(String method)

    - #### getAsynchronousContext

          public ResteasyAsynchronousContext getAsynchronousContext()

    - #### setAsynchronousContext

          public void setAsynchronousContext(ResteasyAsynchronousContext asynchronousContext)

    - #### header

          public MockHttpRequest header(String name,
                               String value)

    - #### accept

          public MockHttpRequest accept(List<MediaType> accepts)

    - #### accept

          public MockHttpRequest accept(MediaType accept)

    - #### accept

          public MockHttpRequest accept(String type)

    - #### language

          public MockHttpRequest language(String language)

    - #### cookie

          public MockHttpRequest cookie(String name,
                               String value)

    - #### contentType

          public MockHttpRequest contentType(String type)

    - #### contentType

          public MockHttpRequest contentType(MediaType type)

    - #### content

          public MockHttpRequest content(byte[] bytes)

    - #### content

          public MockHttpRequest content(InputStream stream)

    - #### addFormHeader

          public MockHttpRequest addFormHeader(String name,
                                      String value)

      Set CONTENT-TYPE to ""application/x-www-form-urlencoded"
      Parameters:
        `name` -
        `value` -
      Returns:

    - #### getHttpHeaders

          public HttpHeaders getHttpHeaders()

    - #### getMutableHeaders

          public MultivaluedMap<String,String> getMutableHeaders()

    - #### getInputStream

          public InputStream getInputStream()

    - #### setInputStream

          public void setInputStream(InputStream stream)

      Description copied from interface: `HttpRequest`
      If you are using a servlet container, this will *NOT* override the HttpServletRequest.getInputStream(). It will only override it for the resteasy HttpRequest

    - #### getUri

          public ResteasyUriInfo getUri()

      Description copied from interface: `HttpRequest`
      This method *MUST* always return the same instance.
      Specified by:
        `getUri` in interface `HttpRequest`
      Overrides:
        `getUri` in class `BaseHttpRequest`

    - #### getHttpMethod

          public String getHttpMethod()

    - #### initialRequestThreadFinished

          public void initialRequestThreadFinished()

    - #### getAttribute

          public Object getAttribute(String attribute)

      Description copied from interface: `HttpRequest`
      Map of contextual data. Similar to HttpServletRequest attributes
      Returns:

    - #### setAttribute

          public void setAttribute(String name,
                          Object value)

    - #### removeAttribute

          public void removeAttribute(String name)

    - #### getAttributeNames

          public Enumeration<String> getAttributeNames()

    - #### getAsyncContext

          public ResteasyAsynchronousContext getAsyncContext()

    - #### forward

          public void forward(String path)

    - #### wasForwarded

          public boolean wasForwarded()

Copyright © 2014. All Rights Reserved.