GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  SERVLET::GENERICSERVLET (3)

.ds Aq ’

NAME

Servlet::GenericServlet - Servlet base class

CONTENTS

SYNOPSIS



  # usually subclasses will be instantiated instead
  my $servlet = Servlet::GenericServlet->new();

  $servlet->init($config);

  for my $name ($getInitParameterNames()) {
      my $value = $servlet->getInitParameter($name);
  }

  my $config = $servlet->getServletConfig();

  my $context = $servlet->getServletContext();

  my $info = $servlet->getServletInfo();

  my $name = $servlet->getServletName();

  $servlet->service($request, $response);

  $servlet->log($message, $e);

  $servlet->destroy();



DESCRIPTION

Defines a generic, protocol-independent servlet. To write an HTTP servlet, extend <B>Servlet::Http::HttpServletB> instead.

Implements the <B>Servlet::ServletB> and <B>Servlet::ServletConfigB> interfaces. May be directly extended by a servlet, although it’s more common to extend a protocol-specific subclass.

To write a generic servlet, a developer need only override the service() method.

CONSTRUCTOR

new() Does nothing. All of the servlet initialization is done by the init() method.

METHODS

destroy() Called by the servlet container to indicate to a servlet that the servlet is being taken out of service.
getInitParameter($name) Returns the value of the named initialization parameter, or undef if the parameter does not exists.

This method is supplied for convenience. It gets the value of the named parameter from the servlet’s config object.

<B>Parameters:B>
$name the name of the parameter

getParameterNames() Returns an array containing the names of the servlet’s initialization parameters, or an empty array if the servlet has no initialization parameters.

This method is supplied for convenience. It gets the parameter names from the servlet’s config object.

getServletConfig() Returns this servlet’s <B>Servlet::ServletConfigB> object.
getServletContext() Returns the <B>Servlet::ServletContextB> object representing the web application in which the servlet is running.

This method is supplied for convenience. It gets the context from the servlet’s config object.

getServletInfo() Returns information about the servlet, such as author, version, and copyright. By default, this method returns an empty string. Override this method to have it return a meaningful value.
getServletName() Returns the name of this servlet instance.
init([$config]) Called by the servlet container to indicate to a servlet that the servlet is being placed into service.

This implementation stores the config object it receives from the servlet container for later use. When overriding this method, make sure to call



  $self->SUPER::init($config)



<B>Parameters:B>
$config the <B>Servlet::ServletConfigB> object that contains configuration information for this servlet

<B>Throws:B>
<B>Servlet::ServletExceptionB> if an exception occurs that interrupts the servlet’s normal operation

log($message, [$e]) Writes the specified message (and stack trace, if an optional exception is specified) to the servlet log, prepended by the servlet’s name.

<B>Parameters:B>
$message the error message
$e an instance of <B>Servlet::Util::ExceptionB> (optional)

service($request, $response) Called by the servlet container to allow the servlet to respond to a request. Subclasses should override it.

<B>Parameters:B>
$request the <B>Servlet::ServletRequestB> object that contains the client’s request
$response the <B>Servlet::ServletResponseB> object that contains the servlet’s response

<B>Throws:B>
<B>Servlet::ServletExceptionB> if an exception occurs that interferes with the servlet’s normal operation
<B>Servlet::Util::IOExceptionB> if an input or output exception occurs

SEE ALSO

Servlet::ServletConfig, Servlet::ServletContext, Servlet::ServletException, Servlet::Util::Exception

AUTHOR

Brian Moseley, bcm@maz.org
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 SERVLET::GENERICSERVLET (3) 2001-07-13

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.