$obj = new Apache::Servlet( $request, $servlet_dir, $servlet_class, $env_ref, $header_ref, $entity_ref, $entity_type);
$hashref = $obj->
get_headers()
;
$scalar = $obj->get_header( $name );
$scalar = $obj->
get_entity()
;
$obj->
return_results()
;
$obj->
dump_results()
;
$obj = new Apache::Servlet( $request, $servlet_dir, $servlet_class, $env_ref, $header_ref, $entity_ref, $entity_type);
$request is a reference to the Apache API's request structure.
Use $r for the HTTP client request.
Or if needed, you may use a subrequest if you create one.
$servlet_dir is the full path of the directory where the servlet class
file can be found.
$servlet_class is a string with the name of the Java servlet class that
will be invoked by the servlet engine.
$env_ref is a reference to a hash containing a CGI-like environment.
You may construct your own environment from scratch if needed.
Otherwise, the default is the CGI environment from mod_perl
for the current HTTP request via $r->cgi_env().
$header_ref is a reference to a hash containing the
servlet request headers.
You may construct your own request headers.
Otherwise, the default is the HTTP client headers from mod_perl
for the current HTTP request via $r->headers_in().
$entity_ref is a scalar string with the entity contents.
The default is an empty input entity.
$entity_type is the MIME type of the HTTP input entity.
The default is an empty value,
which is appropriate if the input itself is empty.
The servlet response can then be found in variables inside $obj.
$obj->{resp_headers} is a reference to a hash containing the
response headers and their values.
(The header names have been converted to lower case for case-insensitive
lookup capability.)
$obj->{resp_entity} contains the response entity.
The response type may be any MIME type.
For the most common example, if $obj->{resp_headers}{``content-type''}
is ``text/html'' then the response entity contains HTML text.
However, there's nothing to prevent a servlet from returning
something humanly-unreadable like an audio clip
if the MIME type is appropriately set.
$obj->{resp_logs} contains a reference to an array of log entries.
$obj->{resp_errors} contains a reference to an array of error messages
from the servlet.
$hashref = $obj->
get_headers()
;
returns a reference to a hash containing the response headers returned from the servlet.
$scalar = $obj->get_header( $name );
returns the value of a single header by name.
$scalar = $obj->
get_entity()
;
returns a scalar containing the full response entity from the servlet. (Caution: this could be enormous!)
$obj->
return_results()
;
Send the collected servlet results back to the HTTP client. This could possibly have been done after modifying the results.
$obj->
dump_results()
;
For debugging purposes, this dumps the servlet output on the HTTP client output, breaking it down by parts of the response.
Your Apache configuration must include ServletAuthExport On
in order for Apache::Servlet to obtain the authentication and host
information needed to contact the Apache JServ engine. Otherwise
mod_jserv will not export this information to other Apache modules.
In order to build and install Apache::Servlet, you must first have Apache HTTPD 1.2 or greater, mod_jserv 0.9.10, mod_perl 1.00 or greater, and any version (preferably current) of the Net::TCP perl5 module.
Note: mod_jserv and the Apache JServ engine will undergo a change in their protocol around the time frame of 0.9.11 or some release after that. Once that change occurs, this version of Apache::Servlet will no longer work and will be forever obsolete. However, a new updated version will be included with the new Apache JServ engine.
.Java-Apache Project Documentation
.mod_perl Home Page and other documentation