[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
General (but important...) reminder - Plase check/clean up your web.xml  XML
Forum Index -> Development
Author Message
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5516
Offline

Hi,

we stumbled over this ourselves within an internal demo project - and want to re-emphasize: since Oct 2020 (some timge ago...) our default default web.xml is a quite reduced one (see below).

All the filter / servlet / listener configuration was moved from being explicitly part of web.xml into an API-based configuration (class CCInitializeServlets). This was done for two reasons:

1. you do not have to upgrade your web.xml each time CaptainCasa applies some changed there
2. Spring Boot scenarios are always based on dynamic configuration via API

The "nice" and same time "not nice at all" issue is: when there are double definitions (both by web.xml and by API) then applications servers (esp. Tomcat) is quite flexible when mixing thigns... But the result may not always be correct: in out case the new SecurityGeneral-filter (the one we introduced with 2022032 was not positioned in front of the other filters but behind... - causing e.g. problems when first time accessing the page in the layout editor's preview.

SO: PLEASE CHECK YOUR WEB.XML!...

(Info for users which still also use the Swing client: the web.xml here still contains some additional servlets, which are listed below.)

Kind regards! Björn

PS: the default web.xml is deliverd inside the eclntjsferver.jar library: WEB-INF/web.xml_template



This is the default web.xml:
Code:
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
 	The default configuration of the servlet context is done in class
 	CCInitialiServlets. 
  -->
 
 <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
          xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee <a href="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" target="_blank" rel="nofollow">http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd</a>"
          id="WebApp_ID" 
          version="3.1">         
          
   <display-name>CaptainCasa based application</display-name>
   <welcome-file-list>
     <welcome-file>index.html</welcome-file>
     <welcome-file>index.htm</welcome-file>
     <welcome-file>index.jsp</welcome-file>
     <welcome-file>default.html</welcome-file>
     <welcome-file>default.htm</welcome-file>
     <welcome-file>default.jsp</welcome-file>
   </welcome-file-list>
 
   <!-- ********** CONTEXT PARAMETERS *************************************** -->
 
   <!-- JBoss Deployment - use the reference implementation that comes
        with CapatainCasa by default -->
   <context-param>
     <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
     <param-value>true</param-value>
   </context-param>  
 
   <!-- ********** LISTENERS ************************************************ -->  
   <listener>
     <listener-class>org.eclnt.jsfserver.util.CCServletContextListener</listener-class>
   </listener>
   
   <!--
   PLEASE PAY ATTNETION: the registration of the CCServletContextListener in the web.xml
   is sufficient for many servlet engines (e.g. Tomcat). For other servlet engines (Glassfish,
   JBoss) the regsitration needs to be done through a file "META-INF/services/javax.servlet.ServletContainerInitializer".
   This file needs to be visible to the webapp classloader, i.e. needs to be part of WEB-INF/classes
   or part of one of the .jar libraries in WEB-INF/lib.
   <br><br>
   A template file is coming with CaptainCasa's eclntjsfserver*.jar file, here:
   "META-INF/services/javax.servlet.ServletContainerInitializer_template".
   -->
     
   <!-- ********** SESSION MANAGEMENT *************************************** -->
   <session-config>
       <session-timeout>60</session-timeout>
       <tracking-mode>URL</tracking-mode>
   </session-config>
   
   <!--
   Alternative session management via cookies. Also has to be configured in
   eclntjsfserver/config/system.xml!
   
   <session-config>
       <session-timeout>60</session-timeout>
       <tracking-mode>COOKIE</tracking-mode>
       <cookie-config>
           <http-only>true</http-only>
           <secure>true</secure>
       </cookie-config>
   </session-config>
   -->
   
 </web-app>
 



Only for users of "old" Swing client: these are the servlets that still need to be present:

Code:
   <servlet id="JnlpDownloadServlet">
     <servlet-name>JnlpDownloadServlet</servlet-name>
     <servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class>
     <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet id="AppletStarter">
     <servlet-name>AppletStarter</servlet-name>
     <servlet-class>org.eclnt.jsfserver.starter.AppletStarter</servlet-class>
     <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet id="FileUploadServlet">
     <servlet-name>FileUploadServlet</servlet-name>
     <servlet-class>org.eclnt.jsfserver.htfileupload.FileUploadServlet</servlet-class>
     <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet id="ClientLiteralServlet">
     <servlet-name>ClientLiteralServlet</servlet-name>
     <servlet-class>org.eclnt.jsfserver.clientliteralloader.ClientLiteralServlet</servlet-class>
     <load-on-startup>1</load-on-startup>
   </servlet>
   
   <servlet-mapping>
     <servlet-name>JnlpDownloadServlet</servlet-name>
     <url-pattern>*.jnlp</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>AppletStarter</servlet-name>
     <url-pattern>*.ccapplet</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>AppletStarter</servlet-name>
     <url-pattern>*.ccwebstart</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>AppletStarter</servlet-name>
     <url-pattern>*.ccwebstartfx</url-pattern>
   </servlet-mapping>  
   <servlet-mapping>
     <servlet-name>FileUploadServlet</servlet-name>
     <url-pattern>*.fileupload</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>ClientLiteralServlet</servlet-name>
     <url-pattern>*.ccclientliterals</url-pattern>
   </servlet-mapping>
 

Björn Müller, CaptainCasa GmbH
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5516
Offline

We extended the documentation "Developer's Guide" by the following chapter, talking about the start-up process and the registration of servlets/filters/listeners:

https://www.captaincasa.com/docu/eclnt_risc_developersguide/all.html#servletcontainerstartup

Kind regards! Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team