Note that there are some explanatory texts on larger screens.

plurals
  1. POGot Problems with Tuckey UrlRewriteFilter and Spring 3 Web MVC
    text
    copied!<p>I have a Spring Web MVC application and I want to use RESTful URLs. Regrettably I haven't found any configuration that works for me with Tuckey's UrlRewriteFilter.</p> <p>I'm using the "DefaultAnnotationHandlerMapping" and I added "urlrewritefilter.jsp" to my classpath and copied "urlrewrite.xml" into "/WEB-INF/".</p> <p>I wan't to achieve that xyz://www.domain.com/abc will be redirected (invisible for the user) to xyz://www.domain.com/app/abc to catch it with my Controller and to let xyz://www.domain.com/css untouched.</p> <p>My "<strong>web.xml</strong>" is configured this way:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app version="3.0" xmlns="xyz://java.sun.com/xml/ns/javaee" xmlns:xsi="xyz://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="xyz://java.sun.com/xml/ns/javaee xyz://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt; &lt;!-- Context --&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt; /WEB-INF/applicationContext.xml /WEB-INF/applicationContext-security.xml &lt;/param-value&gt; &lt;/context-param&gt; &lt;!-- Context Loader --&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- Spring Security --&gt; &lt;filter&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;!-- Tuckey UrlRewriteFilter --&gt; &lt;filter&gt; &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt; &lt;filter-class&gt;org.tuckey.web.filters.urlrewrite.UrlRewriteFilter&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;!-- Dispatcher Servlet --&gt; &lt;servlet&gt; &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;2&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt; &lt;url-pattern&gt;/app/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;!-- All the rest... --&gt; &lt;session-config&gt; &lt;session-timeout&gt; 30 &lt;/session-timeout&gt; &lt;/session-config&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;redirect.jsp&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;/web-app&gt; </code></pre> <p>My "<strong>urlrewrite.xml</strong>" is configured this way:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN" "xyz://tuckey.org/res/dtds/urlrewrite3.2.dtd"&gt; &lt;urlrewrite default-match-type="wildcard"&gt; &lt;rule&gt; &lt;from&gt;/**&lt;/from&gt; &lt;to&gt;/app/$1&lt;/to&gt; &lt;/rule&gt; &lt;outbound-rule&gt; &lt;from&gt;/app/**&lt;/from&gt; &lt;to&gt;/$1&lt;/to&gt; &lt;/outbound-rule&gt; &lt;/urlrewrite&gt; </code></pre> <p>My <strong>AbcController.java</strong> for mapping xyz://www.domain.com/abc has such methods:</p> <pre><code>@RequestMapping(value = "/app/abc", method=RequestMethod.GET) public void displayRegistration(Model model) { ... } </code></pre> <p>But I always receive "HTTP Status 404" when trying to access xyz://www.domain.com/ or xyz://www.domain.com/abc :-(</p> <p>It would be very nice if somebody could help. </p> <p>Greetings</p> <p>Benny</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload