Интеграция grails с hdiv - сеанс завершается успешно, но возникает исключение HDIV_PARAMETER_NOT_EXISTS

Я пытаюсь интегрировать hdiv в приложение Grails 2.0.3.

Я внес все изменения, упомянутые в справочном документе hdiv для Spring MVC в моем приложении Grails. Когда приложение запускается, я вижу, что hdiv validatorfilter инициализируется и создается сеанс Hdiv.

Любая помощь приветствуется

Бала

В моем applicationcontext.xml у меня есть

<bean id="requestDataValueProcessor" class="org.hdiv.web.servlet.support.HdivRequestDataValueProcessor" />

Мой web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
         metadata-complete="true"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <display-name>/@grails.project.key@</display-name>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml,/WEB-INF/hdiv-config.xml,/WEB-INF/hdiv-validations.xml</param-value>
    </context-param>

    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>@grails.project.key@</param-value>
    </context-param>

  <!-- HDIV Validator Filter -->
    <filter>
        <filter-name>ValidatorFilter</filter-name>
        <filter-class>org.hdiv.filter.ValidatorFilter</filter-class>
    </filter>

    <filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter</filter-class>
    </filter>

    <filter>
        <filter-name>charEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        <init-param>
            <param-name>targetBeanName</param-name>
            <param-value>characterEncodingFilter</param-value>
        </init-param>
        <init-param>
            <param-name>targetFilterLifecycle</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>charEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>

    <filter-mapping>
        <filter-name>ValidatorFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


    <listener>
        <listener-class>org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener</listener-class>
    </listener>

<!-- HDIV Listener class -->
    <listener>
        <listener-class>org.hdiv.listener.InitListener</listener-class>
    </listener>

    <!-- Grails dispatcher servlet -->
    <servlet>
        <servlet-name>grails</servlet-name>
        <servlet-class>org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- The Groovy Server Pages servlet -->
    <servlet>
        <servlet-name>gsp</servlet-name>
        <servlet-class>org.codehaus.groovy.grails.web.pages.GroovyPagesServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>gsp</servlet-name>
        <url-pattern>*.gsp</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <!--
        The order of the welcome pages is important.  JBoss deployment will
        break if index.gsp is first in the list.
        -->
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.gsp</welcome-file>
    </welcome-file-list>

    <jsp-config>
        <taglib>
            <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
            <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
            <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>http://www.springframework.org/tags</taglib-uri>
            <taglib-location>/WEB-INF/tld/spring.tld</taglib-location>
        </taglib>

        <taglib>
                    <taglib-uri>http://grails.codehaus.org/tags</taglib-uri>
                    <taglib-location>/WEB-INF/tld/grails.tld</taglib-location>
                </taglib>        
        <taglib>
            <taglib-uri>http://www.springframework.org/tags/form</taglib-uri>
            <taglib-location>/WEB-INF/tld/spring-form.tld</taglib-location>
        </taglib>
    </jsp-config>

</web-app>

Мой hdiv-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hdiv="http://www.hdiv.org/schema/hdiv"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.hdiv.org/schema/hdiv http://www.hdiv.org/schema/hdiv/hdiv.xsd">

    <hdiv:config errorPage="/error.jsp">
        <hdiv:startPages>/,/attacks/.*,/index.gsp</hdiv:startPages>
    </hdiv:config>

</beans>

Однако я вижу ошибку

 2012-05-31 15:10:22,704 [pool-5-thread-1] DEBUG filter.ValidatorFilter  - Initializing filter 'ValidatorFilter'
    2012-05-31 15:10:22,705 [pool-5-thread-1] DEBUG filter.ValidatorFilter  - Filter 'ValidatorFilter' configured successfully
| Server running. 
2012-05-31 15:10:32,912 [http-bio-8080-exec-2] INFO  listener.InitListener  - HDIV's session created:39414F37F6E68615298D1B7B6FD4B3A0
2012-05-31 15:10:32,925 [http-bio-8080-exec-2] INFO  **logs.Logger  - HDIV_PARAMETER_NOT_EXISTS;/TestHdiv/author/index;_HDIV_STATE_;null;0:0:0:0:0:0:0:1;0:0:0:0:0:0:0:1;user**
2012-05-31 15:10:32,925 [http-bio-8080-exec-2] DEBUG dataComposer.DataComposerMemory  - The page [14] has no states, is not stored in session
2012-05-31 15:10:32,985 [http-bio-8080-exec-3] DEBUG dataComposer.DataComposerMemory  - The page [15] has no states, is not stored in session

person user558925    schedule 31.05.2012    source источник


Ответы (1)


Согласно документации по установке для HDIV, попробуйте следующее:

<filter-mapping>
    <filter-name>ValidatorFilter</filter-name>
    <!-- Grails dispatcher servlet -->
    <servlet-name>grails</servlet-name>
</filter-mapping>

Вам также может понадобиться добавить сопоставление сервлетов gsp, но я бы сначала попробовал использовать только передний контроллер grails.

<filter-mapping>
    <filter-name>ValidatorFilter</filter-name>
    <!-- Grails dispatcher servlet -->
    <servlet-name>grails</servlet-name>
    <!-- Groovy Server Pages servlet -->
    <servlet-name>gsp</servlet-name>
</filter-mapping>
person fourgablesguy    schedule 24.07.2012