You just need to configure the HTTP connector, and your entire servlet will be available via HTTP.
For operations that require HTTPS, you need to force it yourself,
if (!request.isSecure()) { response.sendError(HttpServletResponse.SC_FORBIDDEN); return; }
In our case, the login URL can be entered by the user, so we redirect the user to the HTTPS page if the HTTP URL is entered.
If you are talking about servlet sessions (JSESSIONID), you should not have a problem with a joint session between HTTP and HTTPS, because Tomcat does not add a “safe” flag to cookies.
Zz coder
source share