|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.zenkey.net.prowser.Response
public class Response
The Response
class represents the data resulting from a web
page request made by a Tab
instance. A Response
object is generated when a Tab
executes a Request
.
The data available in a Response
object includes:
Request
object.
Response
objects are only created by the Tab
class; there are no public constructors for them.
A Response
object is thread-safe. Once created, it cannot be
altered.
Tab
,
Request
Field Summary | |
---|---|
static int |
ERR_GENERAL
General error. |
static int |
ERR_IO
HTTP I/O (transport) error. |
static int |
ERR_MAX_REDIRECTS
Max HTTP redirects exceeded. |
static int |
ERR_NO_LOCATION
No "Location" field in header of redirection response. |
static int |
ERR_NONE
No error condition exists. |
static int |
ERR_PROTOCOL
HTTP protocol error. |
static int |
ERR_TIMEOUT
Request timed out. |
static int |
ERR_URI
URI error. |
static int |
STATUS_NOT_OBTAINED
The value returned by getStatus() when HTTP status information
has not been obtained for the response. |
Method Summary | |
---|---|
String |
getContentType()
Returns the value of the HTTP Content-type header
associated with this Response . |
long |
getDuration()
Returns the number of milliseconds that it took to complete the request/response transaction that generated this Response . |
int |
getError()
Returns a code indicating the error condition of the page request that generated this Response . |
String |
getErrorText()
Returns text describing the error condition of the request that generated this Response . |
String |
getFilename()
Returns the name of the web page file associated with this Response . |
byte[] |
getPageBytes()
Returns the binary form of the retrieved web page associated with this Response . |
String |
getPageSource()
Returns the textual form of the retrieved web page associated with this Response . |
Request |
getRequest()
Returns the Request object that generated this
Response . |
int |
getStatus()
Returns the HTTP status code associated with this Response . |
String |
getStatusText()
Returns the HTTP status text associated with this Response . |
String |
getStatusVersion()
Returns the HTTP status version associated with this Response . |
Tab |
getTab()
Returns the Tab that generated this Response . |
String |
getTitle()
Returns the title of the web page associated with this Response , as specified in the <title>
tag of the page's HTML source code. |
URI |
getUri()
Returns the final URI of this Response . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ERR_NONE
getError()
,
getErrorText()
,
Constant Field Valuespublic static final int ERR_GENERAL
getError()
,
getErrorText()
,
Constant Field Valuespublic static final int ERR_PROTOCOL
getError()
,
getErrorText()
,
Constant Field Valuespublic static final int ERR_IO
getError()
,
getErrorText()
,
Constant Field Valuespublic static final int ERR_MAX_REDIRECTS
getError()
,
getErrorText()
,
Constant Field Valuespublic static final int ERR_NO_LOCATION
getError()
,
getErrorText()
,
Constant Field Valuespublic static final int ERR_URI
getError()
,
getErrorText()
,
Constant Field Valuespublic static final int ERR_TIMEOUT
getError()
,
getErrorText()
,
Constant Field Valuespublic static final int STATUS_NOT_OBTAINED
getStatus()
when HTTP status information
has not been obtained for the response.
getStatus()
,
getStatusText()
,
getError()
,
Constant Field ValuesMethod Detail |
---|
public String getContentType()
Content-type
header
associated with this Response
.
Content-type
header
associated with this Response
.public long getDuration()
Response
.
public int getError()
Response
. If no error condition exists, ERR_NONE
is returned; otherwise, one of the other ERR_xxx
values are returned.
Response
.ERR_NONE
,
getErrorText()
public String getErrorText()
Response
.
String
describing the error condition of the
request that generated this Response
, or
null
if no error condition exists (i.e.,
getError()
returns ERR_NONE
).getError()
,
ERR_NONE
public String getFilename()
Response
. If the URI did not contain a filename, then an
empty string is returned.
Response
, or an empty string if the URI did not
contain a filename.public byte[] getPageBytes()
Response
.
getPageSource()
public String getPageSource()
Response
. The returned value is a String
encoded with the character set specified in the response header. If no
encoding was supplied, the default encoding is used.
getPageBytes()
public Request getRequest()
Request
object that generated this
Response
.
Request
object that generated this
Response
.Request
,
Tab
public int getStatus()
Response
.
If the response was not completed due to an error during the request,
STATUS_NOT_OBTAINED
will be returned.
Response
,
or STATUS_NOT_OBTAINED
if an error occurred during the
request.getStatusText()
,
getStatusVersion()
,
getError()
public String getStatusText()
Response
.
Response
,
or null
if an error occurred during the request
(i.e., getStatus()
returns STATUS_NOT_OBTAINED
).getStatus()
,
getStatusVersion()
,
getError()
public String getStatusVersion()
Response
.
Response
, or null
if an error
occurred during the request (i.e., getStatus()
returns
STATUS_NOT_OBTAINED
).getStatus()
,
getStatusText()
,
getError()
public Tab getTab()
Tab
that generated this Response
.
Tab
that generated this Response
.public String getTitle()
Response
, as specified in the <title>
tag of the page's HTML source code. If the page is not HTML source
(i.e., it's a binary file), then the filename is returned instead.
Note that all leading and trailing whitespace is trimmed from the title string before it is returned.
Response
, or the filename of the retrieved page
if it is not in the form of HTML source code.public URI getUri()
Response
. Note that this can
be different from the Request
URI because of server-side
redirects that can occur during request processing. Think of this value
as the URI that appears in a web browser's address bar after the page
has completed loading.
Response
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |