url rewriting - How to redirect a http POST with urlrewritefilter -


i have question urlrewritefilter , until not find in net.

i want redirect http post in tomcat7. here example...

the call http post ulr

http://localhost:8080/oldapplication/example?a=123&b=2 

this call contains content either xml or json. filter configured works , urlrewrite.xml contains:

<?xml version="1.0" encoding="utf-8"?> <!doctype urlrewrite public "-//tuckey.org//dtd urlrewrite 4.0//en" "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">  <urlrewrite use-query-string="true">     <rule>         <condition type="method">post</condition>         <from>^(.*)$</from>         <to type="redirect">/newapplication$1</to>     </rule> </urlrewrite> 

in access log can see call

http://localhost:8080/oldapplication/example?a=123&b=2 

gets redirected

http://localhost:8080/newapplication/example?a=123&b=2 

fine until now. problem rewrite changes method, new url gets called http instead of http post. tried add condition on method got still http after rewrite.

does know how configure rewritefilter avoid this?

you using type attribute redirect on type="redirect"

this attribute equivalent httpservletresponse.sendredirect() new request destination using get method, parameters lost along http method.

the default value attribute if not informed forward equivalent httpservletrequest.getrequestdispatcher(url).forward()

forwarding keep request parameters , http method.

so, in order obtain desired result have omit type attribute or set forward.

<to>/newapplication$1</to> 

or

<to type="forward">/newapplication$1</to> 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -