|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.faceless.util.HttpRequestWriter
public class HttpRequestWriter
Represents an outgoing HTTP Request. More flexible than the java.net.URL class, this class has improved error handling and better access to the details of the request.
HttpRequestReader,
HttpResponseReader| Constructor Summary | |
|---|---|
HttpRequestWriter(HttpRequestReader request)
Create a new HttpRequestWriter request which is an outgoing version of the specified HttpRequestReader. |
|
HttpRequestWriter(String targeturl)
Create a new HttpRequestWriter request to the specified URL. |
|
| Method Summary | |
|---|---|
void |
addDateHeader(String name,
long val)
Adds a response header with the given name and date-value. |
void |
addHeader(String name,
String value)
Adds a response header with the given name and value. |
void |
addIntHeader(String name,
int val)
Sets a response header with the given name and integer value. |
void |
clearHeader(String name)
Remove a header from the request. |
void |
close()
Close the connection and free any resources associated with it |
boolean |
containsHeader(String name)
Returns a boolean indicating whether the named response header has already been set. |
void |
finalize()
|
String |
getHeader(String name)
Returns the value of the header if it's set, or null if it's not |
HttpResponseReader |
getResponse()
Open the connection to the URL and read it in. |
HttpResponseReader |
getResponse(int timeout)
Open the connection to the URL and read it in. |
String |
getURL()
Get the URL this request was originally set to retrieve |
void |
setDateHeader(String name,
long val)
Sets a response header with the given name and date-value. |
void |
setFollowRedirects(boolean follow)
Whether to follow redirects in the response. |
void |
setHeader(String name,
String value)
Sets a response header with the given name and value. |
void |
setIntHeader(String name,
int val)
Adds a response header with the given name and integer value. |
void |
setURL(String targeturl)
Set the target URL of this request |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpRequestWriter(String targeturl)
throws IOException
IOException
public HttpRequestWriter(HttpRequestReader request)
throws IOException
HttpRequestReader. The URL is left unchanged,
and should probably be set via the setURL(java.lang.String) method.
IOException| Method Detail |
|---|
public void setURL(String targeturl)
throws IOException
IOExceptionpublic void setFollowRedirects(boolean follow)
follow - whether to follow redirects
public HttpResponseReader getResponse()
throws IOException
IOException
public HttpResponseReader getResponse(int timeout)
throws IOException
timeout - the number of ms to wait for a connection or a response
IOExceptionpublic String getURL()
public void close()
public void finalize()
finalize in class Object
public void setHeader(String name,
String value)
name - the name of the headervalue - the header valuepublic String getHeader(String name)
name - the name of the header
public void addHeader(String name,
String value)
name - the name of the headervalue - the additional header valuepublic void clearHeader(String name)
name - the name of the headerpublic boolean containsHeader(String name)
name - the header name
public void setDateHeader(String name,
long val)
name - the name of the header to setvalue - the assigned date value
public void addDateHeader(String name,
long val)
name - the name of the header to setvalue - the additional date value
public void addIntHeader(String name,
int val)
name - the name of the headervalue - the assigned integer value
public void setIntHeader(String name,
int val)
name - the name of the headervalue - the assigned integer value
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||