Dear Tech geeks,
Greetings of the day.
First of all heartiest accolades for such a great utility from this
newbie. This utility shall allow me exactly what i am trying to
achieve. However as of now i am unable to set up the UrlRewriteFilter
with my application.
I am running an web application on Tomcat (for testing) & WebSpehere
(for Production). The application is made on Struts 2.1.6 framework &
have integration with tiles 2.1.2.
The concern i am having is that i wish to rewrite the following url
<b>
http://localhost:8080/myapp/musicLink.action</b>
to
<b>
http://localhost:8080/myapp/music</b>
And
url <b>
http://localhost:8080/myapp/musicLink.action?
param1=1212¶m2=1313¶m3=1414</b>
to
<b>
http://localhost:8080/myapp/music/1212/1313/1414</b>
Below is my web.xml configuration
<code>
<listener>
<listener-class>com.ibm.vas.controller.impl.StartupListener</
listener-class>
</listener>
<context-param>
<param-
name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</
param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<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>sysout:DEBUG</param-value>
</init-param>
</filter>
<filter>
<filter-name>struts-prepare</filter-name>
<filter-
class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</
filter-class>
</filter>
<filter>
<filter-name>struts-execute</filter-name>
<filter-
class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</
filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>struts-prepare</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>struts-execute</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</
listener-class>
</listener>
</code>
My Urlrewrite Configuration
<code>
<urlrewrite>
<rule>
<from>^/music/([a-z0-9]+)/([a-z0-9]+)/([a-z0-9]+)$</from>
<to>/musicLink.action\?param1=$1&param2=$2&param3=$3</to>
</rule>
<outbound-rule>
<from>^/musicLink\.action\?param1=([a-z0-9]+)&param2=([a-
z0-9]+)&param3=([a-z0-9]+)$</from>
<to>/music/$1/$2/$3</to>
</outbound-rule>
</urlrewrite>
</code>
My Struts.xml Configuration
<code>
<struts>
<constant name="struts.action.extension" value="action" />
<package name="default" extends="struts-default">
<result-types>
<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="musicLink" class="com.controller.MusicAction">
<result name="success" type="tiles">/music.tiles</result>
</action>
</code>
Can anyone please throw some light upon where am i doing wrong in this
following configuration or why am i unable to acheive my desired
rewritten url.
Any help in this regard shall be highly appreciated.
Kindly respond. Looking forward to read from you very soon.
Thanks & Regards
Vivek J