com.nexaweb.client.netservice
Interface HttpRequest

All Superinterfaces:
java.lang.Cloneable

public interface HttpRequest
extends java.lang.Cloneable

HttpRequest is an outgoing request from an HTTP client.


Field Summary
static java.lang.String GET_METHOD
           
static java.lang.String POST_METHOD
           
 
Method Summary
 void addHeader(java.lang.String name, java.lang.String value)
          Adds an HTTP header to the request.
 java.lang.Object clone()
          Creates a deep copy of the HttpRequest.
 byte[] getContent()
          Returns the body of the HTTP request.
 java.lang.String getHeader(java.lang.String name)
          Returns the HTTP header value for the given name.
 java.lang.String[] getHeaderNames()
          Returns an array of the header name of the HTTP request.
 java.lang.String getRequestMethod()
          Returning the request's http method, either a "GET" or a "POST", or null if it's not set.
 java.lang.String getUri()
          Returns the uri destination of the message.
 void setContent(byte[] content)
          Sets the content of the message to the given byte[] which will be posted to the server.
 void setHeader(java.lang.String name, java.lang.String value)
          Add an HTTP header to the request.
 void setRequestMethod(java.lang.String method)
          This method will set the request http method to either "GET" or "POST" so that the server side scripts will process them accordingly.
 void setUri(java.lang.String uri)
          Sets the uri destination of the message.
 

Field Detail

POST_METHOD

public static final java.lang.String POST_METHOD
See Also:
Constant Field Values

GET_METHOD

public static final java.lang.String GET_METHOD
See Also:
Constant Field Values
Method Detail

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
Add an HTTP header to the request. If the header already exists it will be overwritten.

Parameters:
name - The name of the header
value - The value of the header
Since:
4.0

getHeader

public java.lang.String getHeader(java.lang.String name)
Returns the HTTP header value for the given name.

Parameters:
name - The name of the header
Returns:
The value of the header - can be null
Since:
4.0

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Adds an HTTP header to the request. If the header already exists, the value will be concatenated to the previous value separated by a ';'

Parameters:
name - header name
value - header value
Since:
4.0

setContent

public void setContent(byte[] content)
Sets the content of the message to the given byte[] which will be posted to the server.

Parameters:
content - byte array for the content.
Since:
4.0

getContent

public byte[] getContent()
Returns the body of the HTTP request.

Returns:
byte array of the body content
Since:
4.0

setUri

public void setUri(java.lang.String uri)
Sets the uri destination of the message.


getUri

public java.lang.String getUri()
Returns the uri destination of the message.

Returns:
the requested uri
Since:
4.0

getHeaderNames

public java.lang.String[] getHeaderNames()
Returns an array of the header name of the HTTP request.

Returns:
An string array
Since:
4.0

clone

public java.lang.Object clone()
Creates a deep copy of the HttpRequest.

Returns:
A cloned copy.
Since:
4.0

setRequestMethod

public void setRequestMethod(java.lang.String method)
                      throws java.lang.IllegalArgumentException
This method will set the request http method to either "GET" or "POST" so that the server side scripts will process them accordingly.

There is no default value for this property. If it's not set, at runtime, Netservice will check if the content is null. If the content is null, NetService will set a flag to let Nexaweb servlet know that this should be processed as a "GET" request, otherwise it will be a "POST" request.

When a user calls NetService.retrieve or retrieveAsynchronously to a URL that is relative to the current application context, the request is not going through the Nexel servlet.

Parameters:
method - string defined by GET_METHOD or POST_METHOD
Throws:
java.lang.IllegalArgumentException
Since:
4.1

getRequestMethod

public java.lang.String getRequestMethod()
Returning the request's http method, either a "GET" or a "POST", or null if it's not set.

Returns:
"GET" or "POST or null
Since:
4.1


Copyright © 2005 Nexaweb Technologies, Inc. All Rights Reserved.