|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nu.staldal.lsp.framework.ServiceBase
@Deprecated public abstract class ServiceBase
Abstract base class for Service. See Service
.
Field Summary | |
---|---|
protected javax.servlet.ServletContext |
context
Deprecated. The ServletContext . |
protected javax.sql.DataSource |
mainDB
Deprecated. The DataSource to main database,
or null if no database is setup. |
Fields inherited from interface nu.staldal.lsp.framework.Service |
---|
INCLUDE_ATTR_PREFIX, REQUEST_DELETE, REQUEST_GET, REQUEST_INCLUDE, REQUEST_POST, REQUEST_PUT |
Constructor Summary | |
---|---|
ServiceBase()
Deprecated. |
Method Summary | |
---|---|
void |
destroy()
Deprecated. Invoked once by the Servlet.destroy() method. |
void |
dumpRequestParameters(javax.servlet.http.HttpServletRequest request)
Deprecated. Dump all request parameters to the Servlet log. |
java.lang.String |
execute(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.util.Map<java.lang.String,java.lang.Object> pageParams,
int requestType)
Deprecated. Invoked for each request to this Service. |
abstract java.lang.String |
execute(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.util.Map<java.lang.String,java.lang.Object> pageParams,
int requestType,
DBConnection dbConn)
Deprecated. Invoked for each request to this Service. |
javax.servlet.ServletContext |
getServletContext()
Deprecated. Get the ServletContext . |
void |
init(DBConnection dbConn)
Deprecated. Invoked once directly after instantiation, before first use. |
void |
init(javax.servlet.ServletContext context)
Deprecated. Invoked once directly after instantiation, before first use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.servlet.ServletContext context
ServletContext
.
protected javax.sql.DataSource mainDB
DataSource
to main database,
or null
if no database is setup.
Constructor Detail |
---|
public ServiceBase()
Method Detail |
---|
public javax.servlet.ServletContext getServletContext()
ServletContext
.
ServletContext
public void init(DBConnection dbConn) throws java.lang.Exception
dbConn
- database connection,
or null
if no database has been setup
java.lang.Exception
- may throw any Exceptionpublic final void init(javax.servlet.ServletContext context) throws javax.servlet.ServletException
Service
The init method should not invoke DispatcherServlet.lookupService(String)
,
DispatcherServlet.doGet(HttpServletRequest, HttpServletResponse)
,
DispatcherServlet.doPost(HttpServletRequest, HttpServletResponse)
or
ServletExtLib.handleElement(String, org.xml.sax.Attributes, org.xml.sax.ContentHandler)
.
init
in interface Service
context
- the ServletContext
javax.servlet.ServletException
- may throw ServletExceptionpublic void dumpRequestParameters(javax.servlet.http.HttpServletRequest request)
request
- the HttpServletRequest
public abstract java.lang.String execute(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.Map<java.lang.String,java.lang.Object> pageParams, int requestType, DBConnection dbConn) throws java.lang.Exception
Service.execute(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.util.Map, int)
.
request
- the HttpServletRequest
response
- the HttpServletResponse
pageParams
- map for page parametersrequestType
- the type of request:
Service.REQUEST_GET
, Service.REQUEST_POST
, Service.REQUEST_PUT
, Service.REQUEST_DELETE
or Service.REQUEST_INCLUDE
dbConn
- database connection to use for this request,
or null
if no database has been setup
null
to not
use any page, or the name of an other service to forward to
prefixed by "*"
java.lang.Exception
- may throw any Exceptionpublic final java.lang.String execute(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.Map<java.lang.String,java.lang.Object> pageParams, int requestType) throws javax.servlet.ServletException, java.io.IOException
Service
May be invoked concurrently by several threads.
Is invoked for GET, POST, PUT, DELETE and HEAD requests. You should not treat
HEAD requests differently than GET requests, the framework will
automatically discard the body and only send the headers. The
requestType
parameter indicate the type of request.
See the HTTP specification for differences between GET, POST, PUT and DELETE
requests.
There are three choices to create the response:
pageParams
with parameters to this page.
In this case, response
should only be used
to set headers.response
and return null
. In this case the framework will not
touch response
after this method returns, and will not
use pageParams
. This can be used if you want
to use sendError
or sendRedirect
.pageParams
are
retained. You may add attributes to request
in order to
comnunicate with the other service.
If requestType
is Service.REQUEST_INCLUDE
,
choice 2 and 3 may not be used, and response
may not be
modified in any way. You may either return the name of page, or use
the SAX2 ContentHandler
passed as a request
attribute with name "org.xml.sax.ContentHandler" and
return null
. startDocument
and
endDocument
must not be invoked on the ContentHandler, use
ContentHandlerStartEndDocumentFilter
if this is
a problem.
execute
in interface Service
request
- the HttpServletRequest
response
- the HttpServletResponse
pageParams
- map for page parametersrequestType
- the type of request:
Service.REQUEST_GET
, Service.REQUEST_POST
, Service.REQUEST_PUT
, Service.REQUEST_DELETE
or Service.REQUEST_INCLUDE
null
to not
use any page, or the name of an other service to forward to
prefixed by "*"
javax.servlet.ServletException
- may throw ServletException
java.io.IOException
- may throw IOExceptionpublic void destroy()
Servlet.destroy()
method.
destroy
in interface Service
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |