org.eclipse.webdav.http.client
Class Request

java.lang.Object
  extended by org.eclipse.webdav.http.client.Message
      extended by org.eclipse.webdav.http.client.Request

public class Request
extends Message

An HTTP request message.

Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Field Summary
 
Fields inherited from class org.eclipse.webdav.http.client.Message
bufferPool, context, hasInputStream, inputRead, is
 
Constructor Summary
Request(String method, URL resourceUrl, IContext context)
          Creates a request.
Request(String method, URL resourceUrl, IContext context, InputStream is)
          Creates a request.
Request(String method, URL resourceUrl, IContext context, IRequestBodyWriter requestBodyWriter)
          Creates a request.
 
Method Summary
 long getContentLength()
          Returns the content length of this message's body, or -1 if the content length is unknown.
 String getMethod()
          Returns the type of this request, for example: "PUT".
 IRequestBodyWriter getRequestBodyWriter()
          Returns this request's request body writer, or null if this request does not have one.
 URL getResourceUrl()
          Returns the URL of this request's target resource.
 String toString()
           
 void write(OutputStream os)
          Writes this request's body to the given output stream.
 
Methods inherited from class org.eclipse.webdav.http.client.Message
close, getContext, getInputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Request

public Request(String method,
               URL resourceUrl,
               IContext context)
Creates a request.

Parameters:
method - the type of request, for example: "PUT"
resourceUrl - the URL of the target resource
context - the request's header, or null for an empty header

Request

public Request(String method,
               URL resourceUrl,
               IContext context,
               InputStream is)
        throws IOException
Creates a request. For efficiency, the given input stream should be a RequestInputStream or a ByteArrayInputStream.

Parameters:
method - the type of request, for example: "PUT"
resourceUrl - the URL of the target resource
context - the request's header, or null for an empty header
is - an input stream containing the message's body, or null for an empty body
Throws:
IOException - if there is an I/O error
See Also:
RequestInputStream

Request

public Request(String method,
               URL resourceUrl,
               IContext context,
               IRequestBodyWriter requestBodyWriter)
Creates a request.

Parameters:
method - the type of request, for example: "PUT"
resourceUrl - the URL of the target resource
context - the message header, or null for an empty header
requestBodyWriter - for obtaining the message's body
Method Detail

getContentLength

public long getContentLength()
Returns the content length of this message's body, or -1 if the content length is unknown.

Overrides:
getContentLength in class Message
Returns:
the content length of this message's body

getMethod

public String getMethod()
Returns the type of this request, for example: "PUT".

Returns:
the type of this request, for example: "PUT"

getRequestBodyWriter

public IRequestBodyWriter getRequestBodyWriter()
Returns this request's request body writer, or null if this request does not have one.

Returns:
this request's request body writer, or null

getResourceUrl

public URL getResourceUrl()
Returns the URL of this request's target resource.

Returns:
the URL of this request's target resource

toString

public String toString()
Overrides:
toString in class Message

write

public void write(OutputStream os)
           throws IOException
Writes this request's body to the given output stream. This method may be called more than once during the lifetime of this request.

Overrides:
write in class Message
Parameters:
os - an output stream
Throws:
IOException - if there is an I/O error


Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.