|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.httpgw.HTTPRequest
wt.httpgw.HTTPRequestImpl
This class is a carrier of HTTP request information to a Windchill method server. It uses customized serialization code to stream request bodies to the server. Instances contain information about the request (I.e. CGI environment values) and an input stream reference.
Client-side Serialization The client (HTTP gateway) constructs request objects to carry request information to a method server. The client stores the available HTTP request information in the object and sets the input stream reference to the actual HTTP request's input stream provided by the Web server.
Serialization of the object sends the request information followed by the content of the input stream. The content is forwarded by reading blocks of data from the input stream and writing them to the marshal stream until the entire body has been sent. The length of the body is determined from the content-length HTTP header. If no content-length is specified, it reads until EOF on the input stream.
Server-side Deserialization
The server (Windchill method server) receives the request object as
an argument to an RMI call. It is deserialized before the target
method is invoked. The deserialization code stores a reference to
the RMI marshal stream in the object and directly dispatches the target
method (HTTPServer.processRequest) prematurely. The body of the request
is then available as an input stream to the dispatched method. The
RMI marshal stream is simply being used as a pipe to connect the
input stream provided to the HTTP gateway by the Web server to an
input stream in the Windchill method server.
Supported API: true
Extendable: false
Field Summary | |
private static int |
BUFSIZ
|
private Properties |
cgiData
|
private boolean |
consumed
|
private Properties |
formData
|
private Hashtable |
formDataMultivalue
|
private static boolean |
REQUEST_URI_DECODE
Some webservers are appearing to decoding the RequestURI prior to passing it to the servlet engine. |
private static String |
RESOURCE
|
(package private) static long |
serialVersionUID
|
static boolean |
VERBOSE
|
private static boolean |
VERBOSE_CLIENT
|
private static boolean |
VERBOSE_SERVER
|
Fields inherited from class wt.httpgw.HTTPRequest |
bizData, inputStream, response |
Constructor Summary | |
HTTPRequestImpl()
Externalizable constructor used on receiving side. |
|
HTTPRequestImpl(Properties cgi_data,
InputStream input_stream)
Constructor used on sending side. |
Method Summary | |
String |
getBaseURL()
Deprecated. Use URLFactory |
String |
getEncoding()
Guess user agent's file encoding from request headers. |
Properties |
getFormData()
Retrieves the FORM data from the incoming input stream as x-www-form-urlencoded data. |
Properties |
getFormData(String encoding)
Retrieves the FORM data from the incoming input stream as x-www-form-urlencoded data. |
Hashtable |
getFormDataMultivalue()
Retrieves the FORM data from the incoming input stream as x-www-form-urlencoded data. |
Hashtable |
getFormDataMultivalue(String encoding)
Retrieves the FORM data from the incoming input stream as x-www-form-urlencoded data. |
String |
getFullURL()
Deprecated. Use URLFactory |
String |
getMultiPartBoundary(String ContentType)
Utility routine to parse out the multipart object-body boundary Supported API: true |
String |
getProperty(String key)
Public getter method for access to CGI data. |
String |
getProperty(String key,
String default_value)
Public getter method for access to CGI data. |
Enumeration |
getPropertyKeys()
Public getter method for access to CGI data keys. |
String |
getQueryString()
Gets the URLs query string in decoded format. |
String |
getQueryString(String encoding)
Gets the URLs query string in decoded format. |
boolean |
isGetRequest()
Determine if the REQUEST_METHOD used to send the data from the browser was the GET method. |
boolean |
isPostRequest()
Determine if the REQUEST_METHOD used to send the data from the browser was the POST method. |
boolean |
isUrlencodedContent()
Determine if the CONTENT_TYPE used to send the data from the browser was urlencoded form data. |
void |
listProperties(PrintWriter out)
Public lister method for debug access to CGI data. |
static void |
main(String[] args)
The main routine is included here as a test driver. |
PrintWriter |
newPrintWriter(OutputStream output_stream)
Utility routine to construct a buffered PrintWriter from an OutputStream. |
void |
printFormDataHTML(PrintWriter out)
Print all of the form data using HTML. |
void |
printHTMLBottom(PrintWriter out)
Generate some vanilla HTML that you usually want to include at the bottom of any HTML page you generate. |
void |
printHTMLHeader(PrintWriter out)
Print a standard HTTP HTML header. |
void |
printHTMLTop(PrintWriter out,
String title)
Generate some vanilla HTML that you usually want to include at the top of any HTML page you generate. |
void |
printPropertiesHTML(PrintWriter out)
Print all of the CGI properties and the associated values using HTML. |
void |
readExternal(ObjectInput input_stream)
|
private String |
readQueryString(InputStream input_stream)
Reads the query string from the incoming input stream. |
void |
setFormData(Properties p)
Sets the FORM data from a saved session. |
void |
setProperty(String key,
String value)
Public setter method for CGI data. |
Properties |
splitQueryString()
Splits the URLs query string into name value pairs based on the ampersand and equal character tokens. |
Hashtable |
splitQueryStringMultivalue()
Splits the URLs query string into name value pairs based on the ampersand and equal character tokens. |
void |
writeExternal(ObjectOutput output_stream)
|
Methods inherited from class wt.httpgw.HTTPRequest |
splitQueryString, splitQueryString, splitQueryStringMultivalue, splitQueryStringMultivalue, urlDecode |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static final long serialVersionUID
private static final String RESOURCE
private static boolean VERBOSE_SERVER
private static boolean VERBOSE_CLIENT
private static boolean REQUEST_URI_DECODE
private static final int BUFSIZ
public static boolean VERBOSE
private transient Properties cgiData
private transient Properties formData
private transient Hashtable formDataMultivalue
private transient boolean consumed
Constructor Detail |
public HTTPRequestImpl(Properties cgi_data, InputStream input_stream)
cgi_data
- Properties object of http headerspublic HTTPRequestImpl()
Method Detail |
public void readExternal(ObjectInput input_stream) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput output_stream) throws IOException
writeExternal
in interface Externalizable
IOException
private String readQueryString(InputStream input_stream)
public Properties getFormData()
getEncoding
.
getFormData
in class HTTPRequest
public Properties getFormData(String encoding)
getFormData
in class HTTPRequest
public void setFormData(Properties p)
setFormData
in class HTTPRequest
public Hashtable getFormDataMultivalue()
getEncoding
. Multivalue fields are stored in a Vector which can be
iterated for the individual values.
getFormDataMultivalue
in class HTTPRequest
public Hashtable getFormDataMultivalue(String encoding)
getFormDataMultivalue
in class HTTPRequest
public String getQueryString()
getQueryString
in class HTTPRequest
public String getQueryString(String encoding)
getQueryString
in class HTTPRequest
public Properties splitQueryString()
splitQueryString
in class HTTPRequest
public Hashtable splitQueryStringMultivalue()
splitQueryStringMultivalue
in class HTTPRequest
public boolean isGetRequest()
isGetRequest
in class HTTPRequest
public boolean isPostRequest()
isPostRequest
in class HTTPRequest
public boolean isUrlencodedContent()
isUrlencodedContent
in class HTTPRequest
public String getBaseURL()
URLFactory
getBaseURL
in class HTTPRequest
public String getFullURL()
URLFactory
getFullURL
in class HTTPRequest
public String getProperty(String key)
getProperty
in class HTTPRequest
public Enumeration getPropertyKeys()
getPropertyKeys
in class HTTPRequest
public void listProperties(PrintWriter out)
listProperties
in class HTTPRequest
public String getProperty(String key, String default_value)
getProperty
in class HTTPRequest
public void setProperty(String key, String value)
setProperty
in class HTTPRequest
public String getEncoding()
wt.httpgw.encoding.xxx=yyy
where xxx
is
the lower case IANA encoding name and yyy
is the
Java encoding name. If no Accept-Charset header is present,
use template encoding rules to guess.
getEncoding
in class HTTPRequest
public void printHTMLHeader(PrintWriter out) throws IOException
printHTMLHeader
in class HTTPRequest
out
- PrintWriter to receive output.
IOException
public void printHTMLTop(PrintWriter out, String title) throws IOException
printHTMLTop
in class HTTPRequest
out
- PrintWriter to receive output.
IOException
public void printHTMLBottom(PrintWriter out) throws IOException
printHTMLBottom
in class HTTPRequest
out
- PrintWriter to receive output.
IOException
public void printPropertiesHTML(PrintWriter out) throws IOException
printPropertiesHTML
in class HTTPRequest
out
- PrintWriter to receive output.
IOException
public void printFormDataHTML(PrintWriter out) throws IOException
printFormDataHTML
in class HTTPRequest
out
- PrintWriter to receive output.
IOException
public PrintWriter newPrintWriter(OutputStream output_stream)
newPrintWriter
in class HTTPRequest
output_stream
- OutputStream to be wrapped
public String getMultiPartBoundary(String ContentType)
getMultiPartBoundary
in class HTTPRequest
ContentType
- String containing the content-type and boundary,
separated by a semi-colon
public static void main(String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |