Package snap.web
Class WebResponse
java.lang.Object
snap.web.WebResponse
The response.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
copyResponse
(HTTPResponse aResp) Copies an HTTP Response.byte[]
getBytes()
Returns the bytes.int
getCode()
Returns the response code.Returns the code message.static String
getCodeString
(int aCode) Returns the code message.Returns the exception.getFile()
Returns the file.Returns the file header.Returns the files (for directory request).Returns the file type (extension in lowercase, no dot).getJSON()
Returns the JSON.long
Returns the file last modified time.Returns the response MIME type.getPath()
Returns the path.Returns the path file name.Returns the request.getSite()
Returns the site for the request/response.long
getSize()
Returns the file size.getText()
Returns the text of the response.getURL()
Returns the request URL.boolean
isDir()
Returns whether file is a directory.boolean
isFile()
Returns whether file is a plain file.boolean
isText()
Returns whether response is text (regardless of what the data type is).void
setBytes
(byte[] theBytes) Sets the response bytes.void
setCode
(int aCode) Sets the response code.void
setDir
(boolean aValue) Sets whether file is a directory.void
setException
(Throwable aThrowable) Sets the exception.void
setFileHeader
(FileHeader aFHdr) Sets the file header.void
setFileHeaders
(FileHeader[] fileHeaders) Sets the files (for directory request).void
setLastModTime
(long aTime) Sets the file last modified time.protected void
setMimeType
(String aMIMEType) Sets the response MIME type.void
setRequest
(WebRequest aRequest) Sets the request.void
setSize
(long aSize) Sets the file size.toString()
Standard toString implementation.Returns a string representation.
-
Field Details
-
OK
public static final int OK- See Also:
-
BAD_REQUEST
public static final int BAD_REQUEST- See Also:
-
UNAUTHORIZED
public static final int UNAUTHORIZED- See Also:
-
FORBIDDEN
public static final int FORBIDDEN- See Also:
-
NOT_FOUND
public static final int NOT_FOUND- See Also:
-
METHOD_NOT_ALLOWED
public static final int METHOD_NOT_ALLOWED- See Also:
-
EXCEPTION_THROWN
public static final int EXCEPTION_THROWN- See Also:
-
INTERNAL_SERVER_ERROR
public static final int INTERNAL_SERVER_ERROR- See Also:
-
-
Constructor Details
-
WebResponse
Creates a new WebResponse for given request.
-
-
Method Details
-
getRequest
Returns the request. -
setRequest
Sets the request. -
getURL
Returns the request URL. -
getSite
Returns the site for the request/response. -
getCode
public int getCode()Returns the response code. -
setCode
public void setCode(int aCode) Sets the response code. -
getCodeString
Returns the code message. -
getPath
Returns the path. -
getPathName
Returns the path file name. -
getFileType
Returns the file type (extension in lowercase, no dot). -
getMimeType
Returns the response MIME type. -
setMimeType
Sets the response MIME type. -
isDir
public boolean isDir()Returns whether file is a directory. -
setDir
public void setDir(boolean aValue) Sets whether file is a directory. -
isFile
public boolean isFile()Returns whether file is a plain file. -
getLastModTime
public long getLastModTime()Returns the file last modified time. -
setLastModTime
public void setLastModTime(long aTime) Sets the file last modified time. -
getSize
public long getSize()Returns the file size. -
setSize
public void setSize(long aSize) Sets the file size. -
getFileHeader
Returns the file header. -
setFileHeader
Sets the file header. Should go soon. -
getFileHeaders
Returns the files (for directory request). -
setFileHeaders
Sets the files (for directory request). -
getBytes
public byte[] getBytes()Returns the bytes. -
setBytes
public void setBytes(byte[] theBytes) Sets the response bytes. -
getException
Returns the exception. -
setException
Sets the exception. -
isText
public boolean isText()Returns whether response is text (regardless of what the data type is). -
getText
Returns the text of the response. -
getFile
Returns the file. -
copyResponse
Copies an HTTP Response. -
getJSON
Returns the JSON. -
toString
Standard toString implementation. -
toStringProps
Returns a string representation. -
getCodeString
Returns the code message.
-