Version 1

    WCI has 2 different registration features: generic and native

     

    WCI Native integrates with the underlying web container and as such does not require any modifications to a web archive for it to be detected upon deployment. As it requires access to internal web container services, it does not work on all web container. For the GateIn packages, it will use the native wci implementation.

     

    WCI Generic does not integrate with the underlying web container, and as such requires each web application to specify a special servlet and servlet mapping for it to be detected and registered. For GateIn packages, this is not used by default. See https://community.jboss.org/wiki/PortletDeployInGateIn

     

    Disabling Automatic Web Application in GateIn

     

    As GateIn uses the WCI Native implementation by default, all web applications will be detected by default. In order to prevent a web application from being detected by WCI, it is possible to specify the following in the web.xml of your web application:

    <!-- Disable the Native Application Registration -->

       <context-param>

        <param-name>gatein.wci.native.DisableRegistration</param-name>

        <param-value>true</param-value>

      </context-param>

    With the above specified the web application will be invisible to the WCI web application detection.

     

    Servlet Initialization and WCI Detection Ordering

     

    The ordering of servlets initialization with regards to portlet initialization is not guaranteed by either of the specifications. It is however possible to specify when a servlet is initialized in regards to when WCI detects the presence of the web application. Since the Portlet Container relies on WCI to inform it of web applications that are available, and hence when to look for portlets, we can use this to help specify the ordering.

     

    In order to complete this, you will need to first specify that you want to disable the automatic web application detection (see the previous set with adding the gatein.wci.native.DisableRegistration context param). This will prevent the native wci implementation from seeing the web application. You will also need to use the Generic WCI registration servlet to manually register the application.

     

    An example web.xml in which the MyCustomServlet will be initialised before the webapp is registered by WCI :

      <!-- Disable the Native Application Registration -->

       <context-param>

        <param-name>gatein.wci.native.DisableRegistration</param-name>

        <param-value>true</param-value>

      </context-param>

     

      <!-- Register Using the Generic Method -->

      <servlet>

        <servlet-name>GateInServlet</servlet-name>

        <servlet-class>org.gatein.wci.api.GateInServlet</servlet-class>

        <load-on-startup>1</load-on-startup>

      </servlet>

     

    <!-- Custom Servlet which will be initalised before the webapp is registered in WCI -->

      <servlet>

        <servlet-name>MyCustomServlet</servlet-name>

        <servlet-class>my.custom.Servlet</servlet-class>

        <load-on-startup>0</load-on-startup>

      </servlet>

     

    <!-- Servlet Mapping for the Manual Registration -->

      <servlet-mapping>

        <servlet-name>GateInServlet</servlet-name>

        <url-pattern>/gateinservlet</url-pattern>

      </servlet-mapping>

     

     

    NOTES:

    • This will only specify the ordering of servlets in regards to web application detection. It cannot be used to specify the ordering of portlet initializations themselves.
    • The GateInServlet is considered completed when it has registered itself with WCI, not when the portlet is initialized. If you need to have a servlet initialized after a portlet, you will need to make sure that the portlet container get initialized before the servlet.