Class w3c.jigsaw.http.Request
All Packages Class Hierarchy This Package Previous Next Index
Class w3c.jigsaw.http.Request
java.lang.Object
|
+----w3c.mime.MIMEHeaders
|
+----w3c.jigsaw.http.Request
- public class Request
- extends MIMEHeaders
this class extends the normal MIMEHeader object to cope with HTTP request.
One subtely here: note how each field acessor never throws an
exception, but rather is provided with a default value: this is in the hope
that sometime, HTTP will not require all the parsing it requires right now.
-
client
-
-
getAccept(Accept[])
- Get the request accepted MIME types.
-
getAcceptEncodings(String[])
- Get the request accept-encodings.
-
getAcceptLanguage()
-
-
getAcceptLanguage(Language[])
- Get the list of accepted languages for this request.
-
getAuthorization()
-
-
getAuthorization(String)
- Get any authorization information associated with the request.
-
getClient()
- Get the client of this request.
-
getConnection(String)
- Get this request connection header.
-
getContentLength()
-
-
getContentLength(int)
- Get the request content length.
-
getContentType()
-
-
getContentType(MIMEType)
- Get the request content type.
-
getFieldBag(String)
-
-
getFieldBag(String, Bag)
- HTTP defines a new format for header value, namely bag.
-
getHTTPVersion()
-
-
getHTTPVersion(String)
- Get the String version of this request.
-
getIfModifiedSince()
-
-
getIfModifiedSince(long)
- Get this request if-modified-since header field value.
-
getInputStream()
- Get this request input stream.
-
getMethod()
-
-
getMethod(String)
- Get the name of the method of this request.
-
getProxyConnection(String)
- Get the proxy connection header for this request.
-
getQueryString()
-
-
getQueryString(String)
- Get this request query string.
-
getURI()
-
-
getURI(String)
- Get the request requested URI.
-
getUser(String)
- Get the authentifuiied user behind this request.
-
makeReply(int)
-
-
makeReply(Integer)
- Make an empty Reply object matching this request version.
-
parseBag(String)
- Parse a Bag formatted header.
-
parseSingleBag(PushbackInputStream)
-
-
setUser(String)
- Mark this user as being authorizedf for the request.
-
unescape(String)
- Unescape a HTTP escaped string
client
protected Client client
unescape
public static String unescape(String s)
- Unescape a HTTP escaped string
- Parameters:
- s - The string to be unescaped
- Returns:
- the unescaped string.
getContentType
public MIMEType getContentType(MIMEType def)
- Get the request content type.
- Parameters:
- def - The default return value.
- Returns:
- A MIMEType object giving the request content type, or the
provided default if content-type isn't properly defined.
- See Also:
- MIMEType
getContentType
public MIMEType getContentType()
getContentLength
public int getContentLength(int def)
- Get the request content length.
- Parameters:
- def - The default value.
- Returns:
- An integer, giving the content length, or the provided
default value if not properly defined.
getContentLength
public int getContentLength()
getAcceptEncodings
public String[] getAcceptEncodings(String def[])
- Get the request accept-encodings.
- Parameters:
- def - The default value.
- Returns:
- An array of String, each string being a content encoding
scheme, or the provided default value.
getAccept
public Accept[] getAccept(Accept def[])
- Get the request accepted MIME types.
- Parameters:
- def - The default value.
- Returns:
- An array of instances of Accept, or the provided default value.
- See Also:
- Accept
getIfModifiedSince
public long getIfModifiedSince(long def)
- Get this request if-modified-since header field value.
- Parameters:
- def - The default value.
- Returns:
- A long, giving the header's value, or the default value.
- Throws: HTTPException
- If no such header was defined.
getIfModifiedSince
public long getIfModifiedSince()
getURI
public String getURI(String def)
- Get the request requested URI.
- Parameters:
- def - The default value.
- Returns:
- A String giving the unparsed requested URI, or the provided
default value.
getURI
public String getURI()
getInputStream
public InputStream getInputStream()
- Get this request input stream.
- Returns:
- An instance of InputStream, or null if the
request doesn't have an input stream.
getAcceptLanguage
public Language[] getAcceptLanguage(Language def[])
- Get the list of accepted languages for this request.
- Parameters:
- def - The default value.
- Returns:
- An array of Language objects, or the provided default value.
- See Also:
- Language
getAcceptLanguage
public Language[] getAcceptLanguage()
getMethod
public String getMethod(String def)
- Get the name of the method of this request.
- Returns:
- A String giving the name of the method, or the provided
default value.
getMethod
public String getMethod()
getAuthorization
public String getAuthorization(String def)
- Get any authorization information associated with the request.
- Parameters:
- def - The default value.
- Returns:
- A String containing the autorization informations, or the
default value.
getAuthorization
public String getAuthorization()
getConnection
public String getConnection(String def)
- Get this request connection header.
- Returns:
- The String value of the connectionm header, or the provided
default value.
getProxyConnection
public String getProxyConnection(String def)
- Get the proxy connection header for this request.
- Parameters:
- def - The default value.
- Returns:
- A String giving the value of the header, or the provided
default value.
getQueryString
public String getQueryString(String def)
- Get this request query string.
- Parameters:
- def - The default value.
- Returns:
- A String giving the value of the query string for this request
or the provided default value.
getQueryString
public String getQueryString()
getHTTPVersion
public String getHTTPVersion(String def)
- Get the String version of this request.
- Parameters:
- def - The default value.
- Returns:
- A String describing the version of the request.
getHTTPVersion
public String getHTTPVersion()
parseSingleBag
protected Bag parseSingleBag(PushbackInputStream in) throws HTTPException
parseBag
protected Bag parseBag(String bagstr) throws HTTPException
- Parse a Bag formatted header.
I wonder why PEP specifies that headers are a sequence of bags,
rather than one single bag.
- Parameters:
- bagstr - The string MIME compliant representation of the bag.
- Returns:
- An instance of Bag, describing the Bag value.
- See Also:
- Bag
getFieldBag
public Bag getFieldBag(String name,
Bag def)
- HTTP defines a new format for header value, namely bag.
This method returns the value of a named header as a parsed Bag object.
- Parameters:
- name - The name of the header.
- def - The default value to be returned if undefined.
- Returns:
- A bag object.
- See Also:
- Bag
getFieldBag
public Bag getFieldBag(String name)
setUser
public void setUser(String user)
- Mark this user as being authorizedf for the request.
- Parameters:
- user - The name under wich the user has been authentified.
getUser
public String getUser(String def)
- Get the authentifuiied user behind this request.
- Parameters:
- def - The default value if no user authentified.
- Returns:
- A String giving the user name, or the default value.
makeReply
public Reply makeReply(Integer status)
- Make an empty Reply object matching this request version.
- Parameters:
- status - The status of the reply.
makeReply
public Reply makeReply(int status)
getClient
public Client getClient()
- Get the client of this request.
All Packages Class Hierarchy This Package Previous Next Index