These are the only filters I'm using on the app. Here is the excerpt
from my web.xml
<!-- OSIV filter -->
<filter>
<filter-name>openSessionInViewFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate.support.OpenSessionInViewFilter
</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>openSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- mod_rewrite type filter -->
<filter>
<filter-name>urlRewriteFilter</filter-name>
<filter-class>
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
</filter-class>
<init-param>
<param-name>statusEnabled</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>urlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Sitemesh for templating -->
<filter>
<filter-name>siteMesh</filter-name>
<filter-class>
com.opensymphony.module.sitemesh.filter.PageFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>siteMesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Anybody have any ideas or can point me to a resource that might help
me understand what's going on?
I think your filter-mapping for sitemesh needs to be above the
filter-mapping for urlrewrite.
Cheers,
Paul.
Changing the order of filter-mappings does not seem to help... also
shouldn't urlrewrite filter come first anyway as the sitemesh filter
needs the actual url?
Regards,
AndreJ
On Mar 16, 12:53 am, "Paul Tuckey" <p...@tuckey.org> wrote:
> Hi,
>
> I think your filter-mapping for sitemesh needs to be above the
> filter-mapping for urlrewrite.
>
> Cheers,
> Paul.
>
Also I can't seem to get any log output from UrlRewriteFilter...
Any help is appreciated!
My setup:
Container: JBoss 4.0.4.GA (Tomcat 5.5)
web.xml
-----------
<servlet>
<servlet-name>TheApp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</
servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>TheApp</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</
filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</
filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>log4j:DEBUG</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
---
decorators.xml
---------------
<decorators defaultdir="/decorators">
<decorator name="main" page="main.jsp">
<pattern>/page.html*</pattern>
</decorator>
</decorators>
---
I'm accessing the page by http://localhost:8080/context/some/path
These are the rules I've tried:
<rule>
<from>^/some/path$</from>
<to type="forward">/page.html?id=41&menu=41</to>
</rule>
Result: page is not decorated by sitemesh filter
<rule>
<from>^/some/path$</from>
<to type="passthrough">/page.html?id=41&menu=41</to>
</rule>
Result: page is not decorated by sitemesh filter
<rule>
<from>^/some/path$</from>
<to type="redirect">%{context-path}/page.html?id=41&menu=41</to>
</rule>
Result: everything works, except the <to> url shows in address bar
<rule>
<from>^/some/path$</from>
<to type="redirect" encode="true">%{context-path}/page.html?
id=41&menu=41</to>
</rule>
<outbound-rule>
<from>/page.html?id=42&menu=42</from>
<to>/some/path</to>
</outbound-rule>
Result: same, outbound rule has no effect
<rule>
<from>^/some/path$</from>
<to type="redirect">%{context-path}/page.html?id=41&menu=41</to>
</rule>
<outbound-rule>
<from>/page.html?id=42&menu=42</from>
<to>/some/path</to>
</outbound-rule>
Result: same, outbound rule has no effect
<rule>
<from>^/some/path$</from>
<to type="redirect">%{context-path}/page.html?id=41&menu=41</to>
</rule>
<outbound-rule>
<from>%{context-path}/page.html?id=42&menu=42</from>
<to>%{context-path}/some/path</to>
</outbound-rule>
Result: 404 not found: /context/some/path
<rule>
<from>^/some/path$</from>
<to type="redirect">%{context-path}/page.html?id=41&menu=41</to>
</rule>
<outbound-rule>
<from>%{context-path}/page.html?id=42&menu=42</from>
<to>/some/path</to>
</outbound-rule>
Result: 404 not found: /context/some/path
<rule>
<from>^/some/path$</from>
<to type="forward">%{context-path}/page.html?id=42&menu=42</
to>
</rule>
<outbound-rule>
<from>/page.html?id=42&menu=42</from>
<to>/some/path</to>
</outbound-rule>
Result: [org.springframework.web.servlet.PageNotFound] No mapping for
[/context/context/page.html]
<filter>...</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<!-- Sitemesh filter -->
<!--
Sitemesh Filter must accept FORWARD Dispachter for Request
rewritten by UrlRewriterfilter
-->
<filter>...</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/webapp/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
I am having similar problem with the urlrewrite, The url's are been
rewritten correctly as expected but not for all the links. It is not
rewritting the urls for the jsp:include pages. for example.
This is my main template.
The urls in the<jsp:include page="/common/header.jsp"/> and
<jsp:include page="/common/footer.jsp"/> are not rewritten but only
urls in <decorator:body/> are rewritten.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<%-- Include common set of meta tags for each layout --%>
<%@ include file="/common/meta.jsp" %>
<title><decorator:title/></title>
<link rel="stylesheet" type="text/css" media="all"
href="<c:url value='/styles/default.css'/>" />
<link rel="stylesheet" type="text/css" media="all"
href="<c:url value='/styles/messages.css'/>" />
<link rel="stylesheet" type="text/css" media="all"
href="<c:url value='/styles/displaytag.css'/>" />
<decorator:head/>
</head>
<body <decorator:getProperty property="body.id"
writeEntireProperty="true"/> leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0" bgcolor="#f8f8f8">
<div style="background-color:transparent;width:1px;height:5px;"></
div>
<table cellpadding="0" cellspacing="0" border="0" width="1000"
align="center">
<tr>
<td id="header"><br><jsp:include page="/common/header.jsp"/></
td>
</tr>
<tr>
<td id="content" align="center"><decorator:body/></td>
</tr>
<tr>
<td id="footer"><jsp:include page="/common/footer.jsp"/></td>
</tr>
</table>
</body>
</html>
urlrewirte.xml This is my outbound rule to strip the jsessionId.
<outbound-rule encodefirst="true">
<name>remove outbound jsessionid</name>
<from>^(.*);jsessionid=[^\?]*(.*)$</from>
<to>$1$2</to>
</outbound-rule>
This is my web.xml file :
<filter-mapping>
<filter-name>pageCachingFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>compressionFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>rewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>localeFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
Help please....
Thanks.
On Mar 15, 7:53 pm, "Paul Tuckey" <p...@tuckey.org> wrote:
> Hi,
>
> I think your filter-mapping for sitemesh needs to be above the
> filter-mapping for urlrewrite.
>
> Cheers,
> Paul.
>