Class w3c.jigsaw.forms.CgiResource
All Packages Class Hierarchy This Package Previous Next Index
Class w3c.jigsaw.forms.CgiResource
java.lang.Object
|
+----w3c.jigsaw.resources.AttributeHolder
|
+----w3c.jigsaw.resources.Resource
|
+----w3c.jigsaw.resources.HTTPResource
|
+----w3c.jigsaw.resources.ContainerResource
|
+----w3c.jigsaw.resources.FilteredResource
|
+----w3c.jigsaw.resources.FileResource
|
+----w3c.jigsaw.forms.CgiResource
- public class CgiResource
- extends FileResource
A class to handle the good old cgi scripts.
This should really not be used. I am writing it for fun only, you should
rather implement your own resources if you are to handle forms.
- See Also:
- Resource
-
ATTR_COMMAND
- Attribute index - The array of string that makes the command to run.
-
ATTR_GENERATES_FORM
- Attribute index - Does the script generates the form on GET ?
-
ATTR_NOHEADER
- Attribute index - Does the script takes care of its headers ?
-
CgiResource()
-
-
get(Request)
- GET method implementation.
-
getCommand()
- Get the command string array.
-
getGeneratesFormFlag()
- Get the generates form flag.
-
getNoheaderFlag()
- Get the noheader flag.
-
handleCGIOutput(Process, Request)
- Handle the CGI script output.
-
makeCgiCommand(Request)
- Prepare the command to run for this CGI script, and run it.
-
post(Request)
- Handle the POST method according to CGI/1.1 specification.
ATTR_COMMAND
protected static int ATTR_COMMAND
- Attribute index - The array of string that makes the command to run.
ATTR_NOHEADER
protected static int ATTR_NOHEADER
- Attribute index - Does the script takes care of its headers ?
ATTR_GENERATES_FORM
protected static int ATTR_GENERATES_FORM
- Attribute index - Does the script generates the form on GET ?
CgiResource
public CgiResource()
getCommand
public String[] getCommand()
- Get the command string array.
getNoheaderFlag
public boolean getNoheaderFlag()
- Get the noheader flag.
getGeneratesFormFlag
public boolean getGeneratesFormFlag()
- Get the generates form flag.
handleCGIOutput
protected Reply handleCGIOutput(Process process,
Request request) throws HTTPException
- Handle the CGI script output.
This methods handles the CGI script output. Depending on the
value of the noheader attribute it either:
- Sends back the script output directly,
- Parses the script output, looking for a status header or a
location header, or a content-length header, or any combination
of those three.
- Parameters:
- process - The underlying CGI process.
- request - The processed request.
- Throws: HTTPException
- If an HTTP error should be sent back to the
client.
makeCgiCommand
protected Process makeCgiCommand(Request request) throws HTTPException, IOException
- Prepare the command to run for this CGI script, and run it.
- Parameters:
- request - The request to handle.
- Returns:
- The running CGI process object.
- Throws: HTTPException
- If we weren't able to build the command or
the environment.
get
public Reply get(Request request) throws HTTPException
- GET method implementation.
this method is splitted into two cases:
If the resource is able to generates its form, than run the script
to emit the form. Otherwsie, use our super class (FileResource) ability
to send the file that contains the form.
Note that there is no need to feed the underlying process with
data in the GET case.
- Parameters:
- request - The request to handle.
- Throws: HTTPException
- If processing the request failed.
- Overrides:
- get in class FileResource
post
public Reply post(Request request) throws HTTPException
- Handle the POST method according to CGI/1.1 specification.
The request body is sent back to the launched CGI script, as is, and
the script output is handled by the handleCGIOutput method.
- Parameters:
- request - The request to process.
- Throws: HTTPException
- If the processing failed.
- Overrides:
- post in class HTTPResource
All Packages Class Hierarchy This Package Previous Next Index