java.lang.Object
cloud.piranha.http.webapp.HttpWebApplicationServer
- All Implemented Interfaces:
HttpServerProcessor
,WebApplicationServer
public class HttpWebApplicationServer 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 HttpWebApplicationServer()
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.DefaultWebApplicationResponse
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(WebApplicationRequest request, WebApplicationResponse response)
Service method.void
setRequestMapper(WebApplicationServerRequestMapper requestMapper)
Set the request mapper.void
start()
Start the server.void
stop()
Stop the server.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
requestMapper
Stores the request mapper. -
webApplications
Stores the web applications.
-
-
Constructor Details
-
HttpWebApplicationServer
public HttpWebApplicationServer()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(WebApplicationRequest request, WebApplicationResponse 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
-