Module cloud.piranha.appserver.impl
Package cloud.piranha.appserver.impl
Class DefaultWebApplicationServer
java.lang.Object
cloud.piranha.appserver.impl.DefaultWebApplicationServer
- All Implemented Interfaces:
WebApplicationServer
,HttpServerProcessor
public class DefaultWebApplicationServer extends java.lang.Object implements HttpServerProcessor, WebApplicationServer
The default WebApplicationServer.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
Fields Modifier and Type Field Description protected WebApplicationServerRequestMapper
requestMapper
Stores the request mapper.protected java.util.Map<java.lang.String,WebApplication>
webApplications
Stores the web applications. -
Constructor Summary
Constructors Constructor Description DefaultWebApplicationServer()
Constructor. -
Method Summary
Modifier and Type Method Description void
addMapping(java.lang.String servletContextName, java.lang.String contextPath)
Add a context path mapping.void
addWebApplication(WebApplication webApplication)
Add the web application.WebApplicationServerResponse
createResponse(HttpServerResponse httpResponse)
Create the web application server response.WebApplicationServerRequestMapper
getRequestMapper()
Get the request mapper.void
initialize()
Initialize the server.boolean
process(HttpServerRequest request, HttpServerResponse response)
Process the request.void
service(WebApplicationServerRequest request, WebApplicationServerResponse response)
Service method.void
setRequestMapper(WebApplicationServerRequestMapper requestMapper)
Set the request mapper.void
start()
Start the server.void
stop()
Stop the server.
-
Field Details
-
requestMapper
Stores the request mapper. -
webApplications
Stores the web applications.
-
-
Constructor Details
-
DefaultWebApplicationServer
public DefaultWebApplicationServer()Constructor.
-
-
Method Details
-
addMapping
public void addMapping(java.lang.String servletContextName, java.lang.String contextPath)Add a context path mapping.- Parameters:
servletContextName
- the servlet context name.contextPath
- the context path.
-
addWebApplication
Add the web application.- Specified by:
addWebApplication
in interfaceWebApplicationServer
- Parameters:
webApplication
- the web application.
-
createResponse
Create the web application server response.- Parameters:
httpResponse
- the HTTP server response.- Returns:
- the web application server response.
-
getRequestMapper
Get the request mapper.- Specified by:
getRequestMapper
in interfaceWebApplicationServer
- Returns:
- the request mapper.
-
initialize
public void initialize()Initialize the server.- Specified by:
initialize
in interfaceWebApplicationServer
-
process
Process the request.- Specified by:
process
in interfaceHttpServerProcessor
- Parameters:
request
- the request.response
- the response.- Returns:
- true if the request triggered async processing, false otherwise
-
service
public void service(WebApplicationServerRequest request, WebApplicationServerResponse response) throws java.io.IOException, ServletExceptionService method.- Specified by:
service
in interfaceWebApplicationServer
- Parameters:
request
- the request.response
- the response.- Throws:
java.io.IOException
- when an I/O error occurs.ServletException
- when a servlet error occurs.
-
setRequestMapper
Set the request mapper.- Specified by:
setRequestMapper
in interfaceWebApplicationServer
- Parameters:
requestMapper
- the request mapper.
-
start
public void start()Start the server.- Specified by:
start
in interfaceWebApplicationServer
-
stop
public void stop()Stop the server.- Specified by:
stop
in interfaceWebApplicationServer
-