com.github.kristofa.test.http
Class FullHttpRequestImpl

java.lang.Object
  extended by com.github.kristofa.test.http.FullHttpRequestImpl
All Implemented Interfaces:
FullHttpRequest, HttpRequest

public final class FullHttpRequestImpl
extends Object
implements FullHttpRequest

Represents a HTTP request. Contains following properties:

Author:
kristof

Constructor Summary
FullHttpRequestImpl()
          Creates a new HTTP request object with no parameters set.
FullHttpRequestImpl(FullHttpRequest request)
          Copy constructor.
 
Method Summary
 FullHttpRequestImpl content(byte[] content)
          Sets content of message body for request.
 FullHttpRequestImpl domain(String domain)
          Sets host for request.
 boolean equals(Object obj)
          
 byte[] getContent()
          Get content for request.
 String getDomain()
          Gets domain / host for request.
 Set<HttpMessageHeader> getHttpMessageHeaders()
          Get http message headers.
 Method getMethod()
          Gets method for request.
 String getPath()
          Gets path for request without query parameters.
 Integer getPort()
          Gets port for request.
 Set<QueryParameter> getQueryParameters()
          Gets query parameters for request.
 String getUrl()
          Gets the url for the http request, including query parameters if defined.
 int hashCode()
          
 FullHttpRequestImpl httpMessageHeader(String name, String value)
          Adds a Http message header.
 FullHttpRequestImpl method(Method method)
          Sets method for request.
 FullHttpRequestImpl path(String path)
          Sets path for request.
 FullHttpRequestImpl port(Integer port)
          Sets port for request.
 FullHttpRequestImpl queryParameter(String key, String value)
          Adds a query parameter for request.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FullHttpRequestImpl

public FullHttpRequestImpl()
Creates a new HTTP request object with no parameters set.


FullHttpRequestImpl

public FullHttpRequestImpl(FullHttpRequest request)
Copy constructor.

Parameters:
request - Will copy properties from this request.
Method Detail

method

public FullHttpRequestImpl method(Method method)
Sets method for request.

Parameters:
method - Method for request.
Returns:
This http request.

httpMessageHeader

public FullHttpRequestImpl httpMessageHeader(String name,
                                             String value)
Adds a Http message header.

Parameters:
name - header name. Should not be null or blank.
value - header value. Should not be null or blank.
Returns:
The http request.

content

public FullHttpRequestImpl content(byte[] content)
Sets content of message body for request.

Parameters:
content - Message body for request.
Returns:
This http request.

domain

public FullHttpRequestImpl domain(String domain)
Sets host for request.

Parameters:
domain - Sets domain / host for request.
Returns:
This http request.

port

public FullHttpRequestImpl port(Integer port)
Sets port for request.

Parameters:
port - Sets port for request.
Returns:
This http request.

path

public FullHttpRequestImpl path(String path)
Sets path for request.

Parameters:
path - Sets path for request.
Returns:
This http request.

queryParameter

public FullHttpRequestImpl queryParameter(String key,
                                          String value)
Adds a query parameter for request.

Parameters:
key - Parameter key. Should not be empty or null.
value - Parameter value. Should not be empty or null
Returns:
This http request.

getMethod

public Method getMethod()
Gets method for request.

Specified by:
getMethod in interface HttpRequest
Returns:
Method for request.

getContent

public byte[] getContent()
Get content for request.

Specified by:
getContent in interface HttpRequest
Returns:
Content for request.

getDomain

public String getDomain()
Gets domain / host for request.

Specified by:
getDomain in interface FullHttpRequest
Returns:
Gets domain for request.

getPort

public Integer getPort()
Gets port for request.

Specified by:
getPort in interface FullHttpRequest
Returns:
Gets port for request.

getPath

public String getPath()
Gets path for request without query parameters.

Specified by:
getPath in interface HttpRequest
Returns:
Path for request.

getQueryParameters

public Set<QueryParameter> getQueryParameters()
Gets query parameters for request.

Specified by:
getQueryParameters in interface HttpRequest
Returns:
Query parameters for request.

getHttpMessageHeaders

public Set<HttpMessageHeader> getHttpMessageHeaders()
Get http message headers.

Specified by:
getHttpMessageHeaders in interface HttpRequest
Returns:
Http message headers.

getUrl

public String getUrl()
Gets the url for the http request, including query parameters if defined.

Specified by:
getUrl in interface FullHttpRequest
Returns:
Url for http request. The URL should be encoded so it can be submitted to a http server.

toString

public String toString()

Overrides:
toString in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object


Copyright © 2014. All Rights Reserved.