Gonzalo Aguilar Delgado wrote:
Hi,
I'm trying to make the OpenSessionInViewFilter to work with my portlets
but it seems that does not initialize
nor work.

Can you check if something is wrong, please?

What I see is missing from your web.xml is needed dispatcher configurations for the OpenSessionInViewFilter filter-mapping to get it invoked when you invoke Wicket from the WicketPortlet.

By default a filter is *only* invoked during a direct client-side REQUEST, not during an include or forward from within another servlet (or portlet, which of course is also invoked as a servlet).
See also servlet spec 2.4, "SRV.6.2.5 Filters and the RequestDispatcher"

So you need to add additional dispatcher settings, just as with the 
WicketFilter, to the filter-mapping for openSessionInViewFilter:

  <filter-mapping>
    <filter-name>openSessionInViewFilter</filter-name>
    <url-pattern>/customer-detail/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

HTH,

Ate




Thank you


------------------------------------------------------------------
web.xml
-------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="2.4"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
    <display-name>My Portlet Application</display-name>
<!-- For deploying on Websphere: disable WebSphere default
portletcontainer
         However: if you actually want to deploy on WebSphere Portal,
comment the following out -->
    <context-param>

<param-name>com.ibm.websphere.portletcontainer.PortletDeploymentEnabled</param-name>
        <param-value>false</param-value>
    </context-param>

        <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/applicationContext.xml</param-value>
        </context-param>
<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>

<!-- Enable the filters for Hibernate -->
        <filter>
                <filter-name>openSessionInViewFilter</filter-name>

<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
                <init-param>
                        <param-name>singleSession</param-name>
                        <param-value>true</param-value>
                </init-param>
                <init-param>
                        <param-name>sessionFactoryBeanName</param-name>
                        <param-value>opRoyalCaninSessionFactory</param-value>
                </init-param>
        </filter>
    <filter-mapping>
                <filter-name>openSessionInViewFilter</filter-name>
                <url-pattern>/customer-detail/*</url-pattern>
        </filter-mapping>

        <!-- Wicket filters -->
<filter> <filter-name>CustomerDetailPortlet</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param>
            <param-name>applicationFactoryClassName</param-name>

<param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value>
        </init-param>
        <init-param>
            <param-name>applicationBean</param-name>
            <param-value>customerDetailPortletBean</param-value>
        </init-param>
</filter> <filter-mapping> <filter-name>CustomerDetailPortlet</filter-name> <url-pattern>/customer-detail/*</url-pattern> <dispatcher>REQUEST</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
<dispatcher>FORWARD</dispatcher> </filter-mapping>
        <!-- Added when deployed with maven -->
        <servlet>
                <description>MVC Servlet for Jetspeed Portlet
Applications</description>
                <display-name>Jetspeed Container</display-name>
                <servlet-name>JetspeedContainer</servlet-name>

<servlet-class>org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class>
                <init-param>
                        <param-name>contextName</param-name>
                        <param-value>crmportal-contact</param-value>
                </init-param>
                <load-on-startup>0</load-on-startup>
        </servlet>
        <servlet-mapping>
                <servlet-name>JetspeedContainer</servlet-name>
                <url-pattern>/container/*</url-pattern>
        </servlet-mapping>
        <jsp-config>
                <taglib>
                        <taglib-uri>http://java.sun.com/portlet</taglib-uri>
                        
<taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
                </taglib>
                <taglib>
                        <taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
                        
<taglib-location>/WEB-INF/tld/portlet_2_0.tld</taglib-location>
                </taglib>
        </jsp-config>
        
</web-app>




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to