java.lang.Object
cloud.piranha.http.webapp.HttpWebApplicationServer
- All Implemented Interfaces:
WebApplicationServer
,HttpServerProcessor
public class HttpWebApplicationServer
extends Object
implements HttpServerProcessor, WebApplicationServer
The default WebApplicationServer.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
Modifier and TypeFieldDescriptionprotected WebApplicationServerRequestMapper
Stores the request mapper.protected final Map<String,
WebApplication> Stores the web applications. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMapping
(String servletContextName, String contextPath) Add a context path mapping.void
addWebApplication
(WebApplication webApplication) Add a web application.createResponse
(HttpServerResponse httpResponse) Create the web application server response.Returns the request mapper.void
Initialize the server.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.
-
Field Details
-
requestMapper
Stores the request mapper. -
webApplications
Stores the web applications.
-
-
Constructor Details
-
HttpWebApplicationServer
public HttpWebApplicationServer()Constructor.
-
-
Method Details
-
addMapping
Add a context path mapping.- Parameters:
servletContextName
- the servlet context name.contextPath
- the context path.
-
addWebApplication
Description copied from interface:WebApplicationServer
Add a web application.- Specified by:
addWebApplication
in interfaceWebApplicationServer
- Parameters:
webApplication
- the web application to add.
-
createResponse
Create the web application server response.- Parameters:
httpResponse
- the HTTP server response.- Returns:
- the web application server response.
-
getRequestMapper
Returns the request mapper.- Specified by:
getRequestMapper
in interfaceWebApplicationServer
- Returns:
- the request mapper
-
initialize
public void initialize()Description copied from interface:WebApplicationServer
Initialize the server.- Specified by:
initialize
in interfaceWebApplicationServer
-
process
Description copied from interface:HttpServerProcessor
Process the request.- Specified by:
process
in interfaceHttpServerProcessor
- Parameters:
request
- the request.response
- the response.- Returns:
- the end state.
-
service
public void service(WebApplicationRequest request, WebApplicationResponse response) throws IOException, jakarta.servlet.ServletException Service method.- Specified by:
service
in interfaceWebApplicationServer
- Parameters:
request
- the request.response
- the response.- Throws:
IOException
- when an I/O error occurs.jakarta.servlet.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
-