|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.nitido.nimbox.http.HttpNimletDriver
public class HttpNimletDriver
The HttpNimletDriver is an adaptor for a J2EE container to support the dispatching of Nimlets. This module is also know as the HTTP NiMBox. It requires three types of configurations provided by NiM's Configuration Service:
HTTP NiMBox Configuration This object requires the following core configuration in order to function properly.
Skin Dispatcher Configuration Every skin dispatcher is registered under a skin type, for example, "nimlet", "dynamic", "static", etc. The configuration for each skin dispatcher type includes the full class name that implements the specific skin dispatcher and the settings for that class.
These configurations will start with the following prefixes:
Nimlet Configuration Similar to the skin dispatcher, each nimlet require specification for the implementation's full class name as well as the associated settings. The configurations should have the following format:
Parser Configuration The HttpNimletDriver supports two type of request parser: regular and multipart. The Multipart parser is usually invoked when the browser posts a request that contains a large attachment stream, usually a file for upload.
All multipart parser configuration should starts with the prefix "com.nitido.nimbox.http.parser.multipart." For example, the "maxpostsize" setting specifies the maximum byte a post data file can be handled by the multipart parser. If you want to make it to be 10K (10240 bytes), the corresponding configuration would be "com.nitido.nimbox.http.parser.multipart.maxpostsize=10240".
Field Summary |
---|
Constructor Summary | |
---|---|
HttpNimletDriver()
Default constructor. |
Method Summary | |
---|---|
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
This method is responsible for handling HTTP-GET requests and it is automatically invoked by the J2EE servlet container. |
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
This method is responsible for handling HTTP-POST requests and it is automatically invoked by the J2EE servlet container. |
protected Nimlet |
getNimlet(java.lang.String nimletName)
This method is used by the NimletSkinDispatcher for getting the actual instance of the Nimlet being dispatched. |
protected SkinDispatcher |
getSkinDispatcher(java.lang.String skinProtocol)
This method returns a reference to the instance of the SkinDispatcher used to dispatch the given skin protocol. |
protected void |
handleError(HttpNimletContainer container,
java.lang.Exception e)
This method is invoked by the handleRequest() method of the class when this method encounters an error. |
protected void |
handleRequest(java.lang.String requestType,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
This method is used to handle regular HTTP request from the client. |
void |
init()
This method is used to initialized the Nimlet driver. |
protected void |
notifyOfError(HttpNimletContainer container,
java.lang.Exception rootCause,
int errorCode)
This method notifies the user of a system exception. |
protected void |
sendSystemResponse(javax.servlet.http.HttpServletResponse response,
int errorCode,
java.lang.String errorMessage)
This method sends the given HTTP error code and error message back to the client browser. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpNimletDriver()
Method Detail |
---|
public void init() throws javax.servlet.ServletException
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
public void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
req
- Reference to the HttpServletRequest object with all the
parameters associated with the request sent from the client.res
- Reference to the response the server sends to the client.
javax.servlet.ServletException
- If the request for the GET could not be handled.
java.io.IOException
- If an input or output error is detected when the servlet
handles the GET requestpublic void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
doPost
in class javax.servlet.http.HttpServlet
req
- Reference to the HttpServletRequest object with all the
parameters associated with the request sent from the client.res
- Reference to the response the server sends to the client.
javax.servlet.ServletException
- If the request for the POST could not be handled.
java.io.IOException
- If an input or output error is detected when the servlet
handles the POST requestprotected Nimlet getNimlet(java.lang.String nimletName) throws javax.servlet.ServletException
nimletName
- The name of the nimlet to be dispatched.
javax.servlet.ServletException
- If the specified nimlet has not been configured to be used
with this driver. This is one of the standard Java Servlet
exceptions.protected SkinDispatcher getSkinDispatcher(java.lang.String skinProtocol) throws javax.servlet.ServletException
skinProtocol
- The skin protocol name. This parameter must include the
protocol postfix string "://". For e.g. "nimlet://" or
"static://"
javax.servlet.ServletException
- This exception is thrown if the driver does not support the
given skin protocol.protected void handleRequest(java.lang.String requestType, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
requestType
- The request type.req
- Reference to the request from the client to the serverres
- Reference to the response from the server to the client
javax.servlet.ServletException
- If the request could not be handled.
java.io.IOException
- If an input or output error is detected when the servlet
handles the requestprotected void handleError(HttpNimletContainer container, java.lang.Exception e) throws java.io.IOException, javax.servlet.ServletException
container
- Reference to the HttpNimletContainer object.e
- Reference to the exception associated with the problem when
handling the client request.
java.io.IOException
- If the system is unable to notify the client of the problem.
javax.servlet.ServletException
protected void sendSystemResponse(javax.servlet.http.HttpServletResponse response, int errorCode, java.lang.String errorMessage) throws java.io.IOException
response
- Reference to the HTTP Servlet Response objecterrorCode
- A valid HTTP error code. It must be one of the possible
HTTP error codes described in the HTTPServletResponse
interface.errorMessage
- The error message to be included in the response
java.io.IOException
protected void notifyOfError(HttpNimletContainer container, java.lang.Exception rootCause, int errorCode) throws java.io.IOException, javax.servlet.ServletException
container
- Reference to the NimletContainer.rootCause
- Reference to the exception that caused the error.errorCode
- The Http error code to send.
java.io.IOException
- If unable to notify the client.
javax.servlet.ServletException
|
Nitido NiM 2.5 Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2009 Nitido Inc. Proprietary and Confidential. All Rights Reserved.