org.nnsoft.shs.http
Class BaseRequestHandler

java.lang.Object
  extended by org.nnsoft.shs.http.BaseRequestHandler
All Implemented Interfaces:
RequestHandler
Direct Known Subclasses:
FileRequestHandler

public abstract class BaseRequestHandler
extends Object
implements RequestHandler

Provides an abstract class to be subclassed to create an HTTP handler. This class is inspired from HttpServlet. A subclass should override at least one method, usually one of:


Constructor Summary
BaseRequestHandler()
           
 
Method Summary
protected  void connect(Request request, Response response)
          HTTP CONNECT request.
protected  void delete(Request request, Response response)
          HTTP DELETE request.
protected  void get(Request request, Response response)
          HTTP GET request.
 void handle(Request request, Response response)
          Allows concrete implementations to populate Response parameters given the Request.
protected  void head(Request request, Response response)
          HTTP HEAD request.
protected  void options(Request request, Response response)
          HTTP OPTIONS request.
protected  void post(Request request, Response response)
          HTTP POST request.
protected  void put(Request request, Response response)
          HTTP PUT request.
protected  void trace(Request request, Response response)
          HTTP TRACE request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseRequestHandler

public BaseRequestHandler()
Method Detail

handle

public final void handle(Request request,
                         Response response)
                  throws IOException
Allows concrete implementations to populate Response parameters given the Request.

Specified by:
handle in interface RequestHandler
Parameters:
request - the received HTTP request
response - the HTTP response will be pushed out.
Throws:
IOException - if any I/0 error occur

options

protected void options(Request request,
                       Response response)
                throws IOException
HTTP OPTIONS request.

Parameters:
request - the HTTP request
response - the HTTP response
Throws:
IOException - if any error occurs while HTTP negotiation

get

protected void get(Request request,
                   Response response)
            throws IOException
HTTP GET request.

Parameters:
request - the HTTP request
response - the HTTP response
Throws:
IOException - if any error occurs while HTTP negotiation

head

protected void head(Request request,
                    Response response)
             throws IOException
HTTP HEAD request.

Parameters:
request - the HTTP request
response - the HTTP response
Throws:
IOException - if any error occurs while HTTP negotiation

post

protected void post(Request request,
                    Response response)
             throws IOException
HTTP POST request.

Parameters:
request - the HTTP request
response - the HTTP response
Throws:
IOException - if any error occurs while HTTP negotiation

put

protected void put(Request request,
                   Response response)
            throws IOException
HTTP PUT request.

Parameters:
request - the HTTP request
response - the HTTP response
Throws:
IOException - if any error occurs while HTTP negotiation

delete

protected void delete(Request request,
                      Response response)
               throws IOException
HTTP DELETE request.

Parameters:
request - the HTTP request
response - the HTTP response
Throws:
IOException - if any error occurs while HTTP negotiation

trace

protected void trace(Request request,
                     Response response)
              throws IOException
HTTP TRACE request.

Parameters:
request - the HTTP request
response - the HTTP response
Throws:
IOException - if any error occurs while HTTP negotiation

connect

protected void connect(Request request,
                       Response response)
HTTP CONNECT request.

Parameters:
request - the HTTP request
response - the HTTP response
Throws:
IOException - if any error occurs while HTTP negotiation


Copyright © 2012 99 Software Foundation. All Rights Reserved.