Reputation: 2558
I have seen many examples on how to configure Jetty for HTTPS SSL for Jetty but they all seem to utilize a separate Server class containing a main
method for execution. I want to execute my WebServlet as a standard servlet configured via the web.xml file. I currently have:
@WebServlet
public class MonitoringServlet extends WebSocketServlet {
@Override
public void configure(WebSocketServletFactory factory) {
factory.register(MonitoringSocket.class);
}
}
Where would I place my SSL Servlet configuration code? In the configure
method of this Servlet? In the init
method?
I do understand that in this case there is no need for instantiating a Server
object and using .start()
and .join
Upvotes: 0
Views: 99
Reputation: 49555
Servlets are just a means of producing a response to a request.
Typically a request can be from HTTP/0.9, HTTP/1.0, HTTP/1.1, or HTTP/2.
Using SSL/TLS for the secure part of the protocol.
Technically speaking, HTTP isn't even required for Servlets to function.
The protocol used to submit the request is outside of the control of the Servlet you are implementing to provide a response.
In Jetty, you'll want:
WEB-INF/web.xml
, WEB-INF/classes
, and WEB-INF/lib/*.jar
) this would be a ServletContextHandler
WebAppContext
This setup can come from a configured ${jetty.base}
in the jetty-distribution
or via embedded-jetty use of Java to build up the server, its connectors, and its handlers.
Upvotes: 1