Announcement Announcement Module
Collapse
No announcement yet.
problem with SpringRoo application and DWR 3.0 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem with SpringRoo application and DWR 3.0

    Hello,

    I am investigating the use of DWR 3.0 (or lower) to see if it's possible to come up with an application.

    I checked out the following, http://www.codercorp.com/blog/spring...notations.html

    I have so far been unable to get simple /dwr/* mapping to work

    following are web.xml and dwrexample-servlet.xml files
    any pointers would be appreciated.

    You can also suggest an alternative for remoting other than DWR

    Code:
    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <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>RooSample</display-name>
    	<description>Roo generated RooSample application</description>
    
    
    	<context-param>
    		<param-name>webAppRootKey</param-name>
    		<param-value>RooSample.root</param-value>
    	</context-param>
    
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>
    	</context-param>
    	<filter>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    	</filter>
    
    	<filter>
    		<filter-name>etagFilter</filter-name>
    		<filter-class>org.springframework.web.filter.ShallowEtagHeaderFilter</filter-class>
    	</filter>
    
    	<filter>
    		<filter-name>CharacterEncodingFilter</filter-name>
    		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    		<init-param>
    			<param-name>encoding</param-name>
    			<param-value>UTF-8</param-value>
    		</init-param>
    		<init-param>
    			<param-name>forceEncoding</param-name>
    			<param-value>true</param-value>
    		</init-param>
    	</filter>
    
    	<filter>
    		<filter-name>httpMethodFilter</filter-name>
    		<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
    	</filter>
    
    	<filter>
    		<filter-name>UrlRewriteFilter</filter-name>
    		<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
    	</filter>
    	<filter>
    		<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
    		<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
    	</filter>
    	<filter-mapping>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    
    	<filter-mapping>
    		<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    	<filter-mapping>
    		<filter-name>etagFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    
    	<filter-mapping>
    		<filter-name>CharacterEncodingFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    
    	<filter-mapping>
    		<filter-name>httpMethodFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    
    	<filter-mapping>
    		<filter-name>UrlRewriteFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    
    	<servlet>
    		<servlet-name>RooSample</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<init-param>
    			<param-name>contextConfigLocation</param-name>
    			<param-value>/WEB-INF/config/webmvc-config.xml</param-value>
    		</init-param>
    	</servlet>
    
    	<!--
    		Serves static resource content from .jar files such as spring-js.jar
    	-->
    	<servlet>
    		<servlet-name>Resource Servlet</servlet-name>
    		<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
    	</servlet>
    
    	<servlet-mapping>
    		<servlet-name>RooSample</servlet-name>
    		<url-pattern>/app/*</url-pattern>
    	</servlet-mapping>
    
    	<!--
    		Map all /resources requests to the Resource Servlet for handling
    	-->
    	<servlet-mapping>
    		<servlet-name>Resource Servlet</servlet-name>
    		<url-pattern>/resources/*</url-pattern>
    	</servlet-mapping>
    
    	<session-config>
    		<session-timeout>10</session-timeout>
    	</session-config>
    
    	<welcome-file-list>
    		<welcome-file>index.jspx</welcome-file>
    	</welcome-file-list>
    
    	<error-page>
    		<exception-type>java.lang.Exception</exception-type>
    		<location>/app/uncaughtException</location>
    	</error-page>
    
    	<error-page>
    		<error-code>404</error-code>
    		<location>/app/resourceNotFound</location>
    	</error-page>
    
    
    	<servlet>
    		<servlet-name>dwrexample</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
     
    	<servlet-mapping>
    		<servlet-name>dwrexample</servlet-name>
    		<url-pattern>*.html</url-pattern>
    	</servlet-mapping>
    
    	<servlet-mapping>
    		<servlet-name>dwrexample</servlet-name>
    		<url-pattern>/dwr/*</url-pattern>
    	</servlet-mapping>
    
    </web-app>
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    	<beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
    		xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
    		xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
    		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    		xsi:schemaLocation="http://www.directwebremoting.org/schema/spring-dwr  http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd   http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
    		<context:annotation-config />
    		<tx:annotation-driven />
    		<dwr:configuration />
    		<dwr:annotation-config />
    		<dwr:url-mapping />
    		<dwr:controller id="dwrController" debug="true" />
    		<dwr:component-scan base-package="com.hatimonline.code.javaee.roosample"  scoped-proxy="interfaces" />
    		
    		<!-- 
    		<context:component-scan base-package="com.hatimonline.code.javaee.roosample"  scoped-proxy="interfaces" />
    		 -->
    		<bean
    			class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
    			<property name="order" value="1" />
    		</bean>
    		<bean
    			class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
    			<property name="order" value="2" />
    		</bean>
    		<bean id="viewResolver"
    			class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    			<property name="viewClass"
    				value="org.springframework.web.servlet.view.JstlView" />
    			<property name="prefix" value="/WEB-INF/jsp/" />
    			<property name="suffix" value=".jsp" />
    		</bean>
    	</beans>

  • #2
    Hej

    I suspect the issue is URL rewriting. If you take a peek in src/main/webapp/WEB-INF/urlrewrite.xml I think you'll find this rule is causing you grief:

    Code:
    	<rule>
    		<from>/**</from>
    		<to>/app/$1</to>
    	</rule>
    You probably want to add a DWR-specific rule to the top of the file. Just guessing here (untested) it might be something like:

    Code:
    	<rule>
    		<from>/dwr/**</from>
    		<to last="true">/dwr/$1</to>
    	</rule>

    Comment

    Working...
    X