DocsRoxen2.1Programmer ManualJava
   

  • Frame
  • HTTP
  • RoxenLib
  • Module
  • AbstractLocationModule
  • RoxenConfiguration
  • RoxenRequest
  • RoxenResponse
  • RoxenFileResponse
  • RoxenStringResponse
  • RoxenRXMLResponse
  • ExperimentalModule
  • FileExtensionModule
  • LocationModule
  • ParserModule
  • ProviderModule
  • SecurityModule
  • SimpleTagCaller
  • UniqueModule
  • HTTP

    : Class HTTP

    com.roxen.roxen
    Class HTTP


    java.lang.Object
      |
      +--com.roxen.roxen.HTTP
    Direct Known Subclasses:
    RoxenLib
    public class HTTP
    extends java.lang.Object

    A support class providing HTTP related functionality. Rather than using this class directly, all these functions can be accessed through the RoxenLib class.

    Method Summary
    static RoxenResponse httpAuthRequired(java.lang.String realm)
              Create a response requesting authentication information.
    static RoxenResponse httpAuthRequired(java.lang.String realm, java.lang.String message)
              Create a response requesting authentication information
    static java.lang.String httpEncodeString(java.lang.String f)
              Quotes "dangerous" characters in an URL for sending it with HTTP.
    static RoxenResponse httpFileAnswer(java.io.File text)
              Create an HTTP response from a File
    static RoxenResponse httpFileAnswer(java.io.File text, java.lang.String type)
              Create a response with a specific media type from a File
    static RoxenResponse httpFileAnswer(java.io.File text, java.lang.String type, long len)
              Create a response of known length with a specific media type from a File
    static RoxenResponse httpFileAnswer(java.io.InputStream text)
              Create an HTTP response from an InputStream.
    static RoxenResponse httpFileAnswer(java.io.InputStream text, java.lang.String type)
              Create a response with a specific media type from an InputStream.
    static RoxenResponse httpFileAnswer(java.io.InputStream text, java.lang.String type, long len)
              Create a response of known length with a specific media type from an InputStream.
    static RoxenResponse httpFileAnswer(java.io.Reader text)
              Create an HTML response from a Reader.
    static RoxenResponse httpFileAnswer(java.io.Reader text, java.lang.String type)
              Create a response with a specific media type from a Reader.
    static RoxenResponse httpFileAnswer(java.io.Reader text, java.lang.String type, long len)
              Create a response of known length with a specific media type from a Reader.
    static RoxenResponse httpLowAnswer(int error)
              Create a response object with a specific error code and no body text.
    static RoxenResponse httpLowAnswer(int error, java.lang.String data)
              Create a response object with a specific error code and HTML message.
    static RoxenResponse httpProxyAuthRequired(java.lang.String realm)
              Create a response requesting proxy authentication information.
    static RoxenResponse httpProxyAuthRequired(java.lang.String realm, java.lang.String message)
              Create a response requesting proxy authentication information
    static RoxenResponse httpRedirect(java.net.URL url)
              Create a redirect response to a specified URL
    static RoxenResponse httpRXMLAnswer(java.lang.String text)
              Create an HTML response from an RXML parsed string value.
    static RoxenResponse httpRXMLAnswer(java.lang.String text, java.lang.String type)
              Create a response with a specific media type from an RXML parsed string value.
    static RoxenResponse httpStringAnswer(java.lang.String text)
              Create an HTML response from a string value.
    static RoxenResponse httpStringAnswer(java.lang.String text, java.lang.String type)
              Create a response with a specific media type from a string value.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Method Detail

    httpEncodeString


    public static java.lang.String httpEncodeString(java.lang.String f)
    Quotes "dangerous" characters in an URL for sending it with HTTP.

    The following characters are replaced with % escapes: SP, TAB, LF, CR, %, ', ", NUL.

    Parameters:
    f - the string to quote
    Returns:
    the quoted result

    httpLowAnswer


    public static RoxenResponse httpLowAnswer(int error,
                                              java.lang.String data)
    Create a response object with a specific error code and HTML message.
    Parameters:
    error - the HTTP error code
    data - the HTML text message
    Returns:
    a response object

    httpLowAnswer


    public static RoxenResponse httpLowAnswer(int error)
    Create a response object with a specific error code and no body text.
    Parameters:
    error - the HTTP error code
    Returns:
    a response object

    httpStringAnswer


    public static RoxenResponse httpStringAnswer(java.lang.String text,
                                                 java.lang.String type)
    Create a response with a specific media type from a string value.
    Parameters:
    text - the content of the response
    type - the media type of the response
    Returns:
    a response object

    httpStringAnswer


    public static RoxenResponse httpStringAnswer(java.lang.String text)
    Create an HTML response from a string value.
    Parameters:
    text - the content of the response
    Returns:
    a response object

    httpRXMLAnswer


    public static RoxenResponse httpRXMLAnswer(java.lang.String text,
                                               java.lang.String type)
    Create a response with a specific media type from an RXML parsed string value.
    Parameters:
    text - the content of the response
    type - the media type of the response
    Returns:
    a response object

    httpRXMLAnswer


    public static RoxenResponse httpRXMLAnswer(java.lang.String text)
    Create an HTML response from an RXML parsed string value.
    Parameters:
    text - the content of the response
    Returns:
    a response object

    httpFileAnswer


    public static RoxenResponse httpFileAnswer(java.io.Reader text,
                                               java.lang.String type,
                                               long len)
    Create a response of known length with a specific media type from a Reader.
    Parameters:
    text - the Reader which should produce the content of the response
    type - the media type of the response
    len - the number of bytes in the content
    Returns:
    a response object

    httpFileAnswer


    public static RoxenResponse httpFileAnswer(java.io.Reader text,
                                               java.lang.String type)
    Create a response with a specific media type from a Reader.
    Parameters:
    text - the Reader which should produce the content of the response
    type - the media type of the response
    Returns:
    a response object

    httpFileAnswer


    public static RoxenResponse httpFileAnswer(java.io.Reader text)
    Create an HTML response from a Reader.
    Parameters:
    text - the Reader which should produce the content of the response
    Returns:
    a response object

    httpFileAnswer


    public static RoxenResponse httpFileAnswer(java.io.InputStream text,
                                               java.lang.String type,
                                               long len)
    Create a response of known length with a specific media type from an InputStream.
    Parameters:
    text - the InputStream which should produce the content of the response
    type - the media type of the response
    len - the number of bytes in the content
    Returns:
    a response object

    httpFileAnswer


    public static RoxenResponse httpFileAnswer(java.io.InputStream text,
                                               java.lang.String type)
    Create a response with a specific media type from an InputStream.
    Parameters:
    text - the InputStream which should produce the content of the response
    type - the media type of the response
    Returns:
    a response object

    httpFileAnswer


    public static RoxenResponse httpFileAnswer(java.io.InputStream text)
    Create an HTTP response from an InputStream.
    Parameters:
    text - the InputStream which should produce the content of the response
    Returns:
    a response object

    httpFileAnswer


    public static RoxenResponse httpFileAnswer(java.io.File text,
                                               java.lang.String type,
                                               long len)
                                        throws java.io.FileNotFoundException
    Create a response of known length with a specific media type from a File
    Parameters:
    text - the File from which the content should be read
    type - the media type of the response
    len - the number of bytes in the content
    Returns:
    a response object
    Throws:
    java.io.FileNotFoundException - if the file doesn't exist

    httpFileAnswer


    public static RoxenResponse httpFileAnswer(java.io.File text,
                                               java.lang.String type)
                                        throws java.io.FileNotFoundException
    Create a response with a specific media type from a File
    Parameters:
    text - the File from which the content should be read
    type - the media type of the response
    Returns:
    a response object
    Throws:
    java.io.FileNotFoundException - if the file doesn't exist

    httpFileAnswer


    public static RoxenResponse httpFileAnswer(java.io.File text)
                                        throws java.io.FileNotFoundException
    Create an HTTP response from a File
    Parameters:
    text - the File from which the content should be read
    type - the media type of the response
    Returns:
    a response object
    Throws:
    java.io.FileNotFoundException - if the file doesn't exist

    httpRedirect


    public static RoxenResponse httpRedirect(java.net.URL url)
    Create a redirect response to a specified URL
    Parameters:
    url - the URL to which the client should be redirected
    Returns:
    a response object

    httpAuthRequired


    public static RoxenResponse httpAuthRequired(java.lang.String realm,
                                                 java.lang.String message)
    Create a response requesting authentication information
    Parameters:
    realm - the security realm for which authentication is required
    message - an HTTP string to be displayed if no authentication is provided
    Returns:
    a response object

    httpAuthRequired


    public static RoxenResponse httpAuthRequired(java.lang.String realm)
    Create a response requesting authentication information. A default message is provided if authentication fails.
    Parameters:
    realm - the security realm for which authentication is required
    Returns:
    a response object

    httpProxyAuthRequired


    public static RoxenResponse httpProxyAuthRequired(java.lang.String realm,
                                                      java.lang.String message)
    Create a response requesting proxy authentication information
    Parameters:
    realm - the security realm for which authentication is required
    message - an HTTP string to be displayed if no authentication is provided
    Returns:
    a response object

    httpProxyAuthRequired


    public static RoxenResponse httpProxyAuthRequired(java.lang.String realm)
    Create a response requesting proxy authentication information. A default message is provided if authentication fails.
    Parameters:
    realm - the security realm for which authentication is required
    Returns:
    a response object