|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.microsoft.tfs.core.httpclient.HttpMethodBase
com.microsoft.tfs.core.httpclient.methods.ExpectContinueMethod
com.microsoft.tfs.core.httpclient.methods.EntityEnclosingMethod
public abstract class EntityEnclosingMethod
This abstract class serves as a foundation for all HTTP methods that can enclose an entity within requests
Field Summary | |
---|---|
static long |
CONTENT_LENGTH_AUTO
Deprecated. Use InputStreamRequestEntity.CONTENT_LENGTH_AUTO . |
static long |
CONTENT_LENGTH_CHUNKED
Deprecated. Use setContentChunked(boolean) . |
Fields inherited from class com.microsoft.tfs.core.httpclient.HttpMethodBase |
---|
effectiveVersion, statusLine |
Constructor Summary | |
---|---|
EntityEnclosingMethod()
No-arg constructor. |
|
EntityEnclosingMethod(java.lang.String uri)
Constructor specifying a URI. |
Method Summary | |
---|---|
protected void |
addContentLengthRequestHeader(HttpState state,
HttpConnection conn)
Generates Content-Length or Transfer-Encoding: Chunked request header, as long as no Content-Length request header already exists. |
protected void |
addRequestHeaders(HttpState state,
HttpConnection conn)
Populates the request headers map to with additional headers to be submitted to
the given HttpConnection . |
protected void |
clearRequestBody()
Clears the request body. |
protected byte[] |
generateRequestBody()
Generates the request body. |
protected RequestEntity |
generateRequestEntity()
|
boolean |
getFollowRedirects()
Entity enclosing requests cannot be redirected without user intervention according to RFC 2616. |
java.lang.String |
getRequestCharSet()
Returns the request's charset. |
protected long |
getRequestContentLength()
Returns the length of the request body. |
RequestEntity |
getRequestEntity()
|
protected boolean |
hasRequestContent()
Returns true if there is a request body to be sent. |
void |
recycle()
Deprecated. no longer supported and will be removed in the future version of HttpClient |
void |
setContentChunked(boolean chunked)
Sets whether or not the content should be chunked. |
void |
setFollowRedirects(boolean followRedirects)
Entity enclosing requests cannot be redirected without user intervention according to RFC 2616. |
void |
setRequestBody(java.io.InputStream body)
Deprecated. use setRequestEntity(RequestEntity) |
void |
setRequestBody(java.lang.String body)
Deprecated. use setRequestEntity(RequestEntity) |
void |
setRequestContentLength(int length)
Deprecated. Use setContentChunked(boolean) or
setRequestEntity(RequestEntity) |
void |
setRequestContentLength(long length)
Deprecated. Use setContentChunked(boolean) or
setRequestEntity(RequestEntity) |
void |
setRequestEntity(RequestEntity requestEntity)
|
protected boolean |
writeRequestBody(HttpState state,
HttpConnection conn)
Writes the request body to the given connection . |
Methods inherited from class com.microsoft.tfs.core.httpclient.methods.ExpectContinueMethod |
---|
getUseExpectHeader, setUseExpectHeader |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Deprecated public static final long CONTENT_LENGTH_AUTO
InputStreamRequestEntity.CONTENT_LENGTH_AUTO
.
-2L
@Deprecated public static final long CONTENT_LENGTH_CHUNKED
setContentChunked(boolean)
.
-1L
Constructor Detail |
---|
public EntityEnclosingMethod()
public EntityEnclosingMethod(java.lang.String uri)
uri
- either an absolute or relative URIMethod Detail |
---|
protected boolean hasRequestContent()
This method must be overridden by sub-classes that implement alternative request content input methods
hasRequestContent
in class ExpectContinueMethod
protected void clearRequestBody()
This method must be overridden by sub-classes that implement alternative request content input methods.
protected byte[] generateRequestBody()
This method must be overridden by sub-classes that implement alternative request content input methods.
protected RequestEntity generateRequestEntity()
public boolean getFollowRedirects()
getFollowRedirects
in interface HttpMethod
getFollowRedirects
in class HttpMethodBase
false
.public void setFollowRedirects(boolean followRedirects)
setFollowRedirects
in interface HttpMethod
setFollowRedirects
in class HttpMethodBase
followRedirects
- must always be false
@Deprecated public void setRequestContentLength(int length)
setContentChunked(boolean)
or
setRequestEntity(RequestEntity)
Note: If you specify a content length the request is unbuffered. This prevents redirection and automatic retry if a request fails the first time. This means that the HttpClient can not perform authorization automatically but will throw an Exception. You will have to set the necessary 'Authorization' or 'Proxy-Authorization' headers manually.
length
- size in bytes or any of CONTENT_LENGTH_AUTO,
CONTENT_LENGTH_CHUNKED. If number of bytes or
CONTENT_LENGTH_CHUNKED is specified the content will not be
buffered internally and the Content-Length header of the request
will be used. In this case the user is responsible to supply the
correct content length. If CONTENT_LENGTH_AUTO is specified the
request will be buffered before it is sent over the network.public java.lang.String getRequestCharSet()
getRequestCharSet
in class HttpMethodBase
RequestEntity.getContentType()
@Deprecated public void setRequestContentLength(long length)
setContentChunked(boolean)
or
setRequestEntity(RequestEntity)
Note: If you specify a content length the request is unbuffered. This prevents redirection and automatic retry if a request fails the first time. This means that the HttpClient can not perform authorization automatically but will throw an Exception. You will have to set the necessary 'Authorization' or 'Proxy-Authorization' headers manually.
length
- size in bytes or any of CONTENT_LENGTH_AUTO,
CONTENT_LENGTH_CHUNKED. If number of bytes or
CONTENT_LENGTH_CHUNKED is specified the content will not be
buffered internally and the Content-Length header of the request
will be used. In this case the user is responsible to supply the
correct content length. If CONTENT_LENGTH_AUTO is specified the
request will be buffered before it is sent over the network.public void setContentChunked(boolean chunked)
chunked
- true
if the content should be chunkedprotected long getRequestContentLength()
protected void addRequestHeaders(HttpState state, HttpConnection conn) throws java.io.IOException, HttpException
headers
to be submitted to
the given HttpConnection
.
This implementation adds tt>Content-Length or Transfer-Encoding headers.
Subclasses may want to override this method to to add additional headers, and may choose to invoke this implementation (via super) to add the "standard" headers.
addRequestHeaders
in class ExpectContinueMethod
state
- the state
information associated with this
methodconn
- the connection
used to execute this HTTP
methodHttpMethodBase.writeRequestHeaders(com.microsoft.tfs.core.httpclient.HttpState, com.microsoft.tfs.core.httpclient.HttpConnection)
java.io.IOException
- if an I/O (transport) error occurs. Some transport exceptions can
be recovered from.
HttpException
- if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.protected void addContentLengthRequestHeader(HttpState state, HttpConnection conn) throws java.io.IOException, HttpException
state
- current state of http requestsconn
- the connection to use for I/O
java.io.IOException
- when errors occur reading or writing to/from the connection
HttpException
- when a recoverable error occurs@Deprecated public void setRequestBody(java.io.InputStream body)
setRequestEntity(RequestEntity)
body
- Request body content as InputStream
@Deprecated public void setRequestBody(java.lang.String body)
setRequestEntity(RequestEntity)
setRequestHeader("Content-type", "text/xml; charset=UTF-8");
default
content encoding is used (ISO-8859-1).
body
- Request body content as a stringprotected boolean writeRequestBody(HttpState state, HttpConnection conn) throws java.io.IOException, HttpException
connection
.
writeRequestBody
in class HttpMethodBase
state
- the state
information associated with this
methodconn
- the connection
used to execute this HTTP
method
java.io.IOException
- if an I/O (transport) error occurs. Some transport exceptions can
be recovered from.
HttpException
- if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.@Deprecated public void recycle()
recycle
in interface HttpMethod
recycle
in class HttpMethodBase
HttpMethodBase.releaseConnection()
public RequestEntity getRequestEntity()
public void setRequestEntity(RequestEntity requestEntity)
requestEntity
- The requestEntity to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |