|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.httpclient.HttpMethodBase | +--org.apache.commons.httpclient.methods.GetMethod
Implements the HTTP GET method.
The HTTP GET method is defined in section 9.3 of RFC2616:
The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.
GetMethods will follow redirect requests from the http server by default. This behavour can be disabled by calling setFollowRedirects(false).
The useDisk methods have been deprecated. Disk I/O is the responsibility of the client. If you need to write a response body to a file, you can use the following as an example:
out = new FileOutputStream(myFile); InputStream in = getResponseBodyAsStream(); byte[] buffer = new byte[10000]; int len ; while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } in.close(); out.close();
Fields inherited from class org.apache.commons.httpclient.HttpMethodBase |
USER_AGENT |
Constructor Summary | |
GetMethod()
No-arg constructor. |
|
GetMethod(java.lang.String uri)
Constructor specifying a URI. |
|
GetMethod(java.lang.String path,
java.io.File fileData)
Deprecated. the client is responsible for disk I/O |
|
GetMethod(java.lang.String path,
java.lang.String tempDir)
Deprecated. the client is responsible for disk I/O |
|
GetMethod(java.lang.String path,
java.lang.String tempDir,
java.lang.String tempFile)
Deprecated. the client is responsible for disk I/O |
Method Summary | |
java.io.File |
getFileData()
Deprecated. the client is responsible for disk I/O |
java.lang.String |
getName()
Returns "GET". |
java.lang.String |
getTempDir()
Deprecated. the client is responsible for disk I/O |
java.lang.String |
getTempFile()
Deprecated. the client is responsible for disk I/O |
boolean |
getUseDisk()
Deprecated. the client is responsible for disk I/O |
protected void |
readResponseBody(HttpState state,
HttpConnection conn)
Overrides method in HttpMethodBase to write data to the
appropriate buffer. |
void |
recycle()
Recycles the HTTP method so that it can be used again. |
void |
setFileData(java.io.File fileData)
Deprecated. the client is responsible for disk I/O |
void |
setTempDir(java.lang.String tempDir)
Deprecated. the client is responsible for disk I/O |
void |
setTempFile(java.lang.String tempFile)
Deprecated. the client is responsible for disk I/O |
void |
setUseDisk(boolean useDisk)
Deprecated. the client is responsible for disk I/O |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public GetMethod()
public GetMethod(java.lang.String uri)
uri
- either an absolute or relative URIpublic GetMethod(java.lang.String path, java.lang.String tempDir)
path
- the path to requesttempDir
- the directory in which to store temporary filespublic GetMethod(java.lang.String path, java.lang.String tempDir, java.lang.String tempFile)
path
- the path to requesttempDir
- the directory in which to store temporary filestempFile
- the file (under tempDir) to buffer contents topublic GetMethod(java.lang.String path, java.io.File fileData)
path
- the path to requestfileData
- the file to buffer contents toMethod Detail |
public void setFileData(java.io.File fileData)
fileData
- the file to buffer data topublic java.io.File getFileData()
public java.lang.String getName()
public void setTempDir(java.lang.String tempDir)
tempDir
- New value of tempDirpublic java.lang.String getTempDir()
public void setTempFile(java.lang.String tempFile)
tempFile
- New value of tempFilepublic java.lang.String getTempFile()
public void setUseDisk(boolean useDisk)
useDisk
- If true the entire response will be buffered in a
temporary file.public boolean getUseDisk()
public void recycle()
HttpMethodBase.releaseConnection()
protected void readResponseBody(HttpState state, HttpConnection conn) throws java.io.IOException, HttpException
HttpMethodBase
to write data to the
appropriate buffer.state
- the state
information associated with this methodconn
- the connection
used to execute
this HTTP methodHttpMethodBase.readResponse(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection)
,
HttpMethodBase.processResponseBody(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |