Package snap.web

Class WebResponse

java.lang.Object
snap.web.WebResponse

public class WebResponse extends Object
The response.
  • Field Details

  • Constructor Details

    • WebResponse

      public WebResponse(WebRequest aReq)
      Creates a new WebResponse for given request.
  • Method Details

    • getRequest

      public WebRequest getRequest()
      Returns the request.
    • setRequest

      public void setRequest(WebRequest aRequest)
      Sets the request.
    • getURL

      public WebURL getURL()
      Returns the request URL.
    • getSite

      public WebSite 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

      public String getCodeString()
      Returns the code message.
    • getTime

      public long getTime()
      Returns the response time.
    • getPath

      public String getPath()
      Returns the path.
    • getPathName

      public String getPathName()
      Returns the path file name.
    • getPathType

      public String getPathType()
      Returns the path file type (extension in lowercase, no dot).
    • getMimeType

      public String getMimeType()
      Returns the response MIME type.
    • setMimeType

      protected void setMimeType(String aMIMEType)
      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.
    • getModTime

      public long getModTime()
      Returns the file modification time.
    • setModTime

      public void setModTime(long aTime)
      Sets the file modification time.
    • getSize

      public long getSize()
      Returns the file size.
    • setSize

      public void setSize(long aSize)
      Sets the file size.
    • getFileHeader

      public FileHeader getFileHeader()
      Returns the file header.
    • setFileHeader

      public void setFileHeader(FileHeader aFHdr)
      Sets the file header. Should go soon.
    • getFileHeaders

      public FileHeader[] getFileHeaders()
      Returns the files (for directory request).
    • setFileHeaders

      public void setFileHeaders(FileHeader[] fileHeaders)
      Sets the files (for directory request).
    • setFileHeaders

      @Deprecated public void setFileHeaders(List<FileHeader> theFile)
      Deprecated.
      Sets the files (for directory request).
    • getBytes

      public byte[] getBytes()
      Returns the bytes.
    • setBytes

      public void setBytes(byte[] theBytes)
      Sets the response bytes.
    • getException

      public Throwable getException()
      Returns the exception.
    • setException

      public void setException(Throwable aThrowable)
      Sets the exception.
    • isText

      public boolean isText()
      Returns whether response is text (regardless of what the data type is).
    • getText

      public String getText()
      Returns the text of the response.
    • getFile

      public WebFile getFile()
      Returns the file.
    • copyResponse

      public void copyResponse(HTTPResponse aResp)
      Copies an HTTP Response.
    • getJSON

      public JSValue getJSON()
      Returns the JSON.
    • toString

      public String toString()
      Standard toString implementation.
      Overrides:
      toString in class Object
    • toStringProps

      public String toStringProps()
      Returns a string representation.
    • getCodeString

      public static String getCodeString(int aCode)
      Returns the code message.