Search code examples
javajspstruts2servlet-filterstuckey-urlrewrite-filter

Unable to find urlrewrite conf file at /WEB-INF/urlrewrite.xml


I am implementing URL Rewrite functionality and I have included all that is necessary for it in my project i.e. urlrewritefilter-4.0.3.jar in WEB-INF/lib and urlrewrite.xml in WEB-INF and added the following in web.xml

<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

But i am getting the following error,

unable to find urlrewrite conf file at /WEB-INF/urlrewrite.xml

Please give me suggestions as to what can be done to solve this.


Solution

  • You could change the conf file in params. This could be added to the filter conf.

    <!-- if you need to the conf file path can be changed
        it is specified as a path relative to the root of your context
        (default /WEB-INF/urlrewrite.xml) -->
        <init-param>
            <param-name>confPath</param-name>
            <param-value>/WEB-INF/urlrewrite.xml</param-value>
        </init-param>