Tuesday, September 11, 2018

Redirects with parameters

Use Case: If you try to create 301 redirect for e.g. lets say /samples/defaultPage --> /samples/home, and then try to hit the url with parameters like http://www.example.com/samples/defaultPage?param1=param1value&param2=param2value, then the page gets redirect to the target page but the parameters are lost and thus, it is very inconvenient for customers who have generated various 301/302 redirects from old site to new re-design website or new navigation structure as redirects work but they fail to retain parameters. Customers might have shared their urls to various social media platforms or as marketing campaigns along with some extra parameters; in order to serve personal content to the end users and for analytics purposes as well or other. This issue is known in 11g8 WCS version and currently there is no resolution as of now until Patch 19. Issue is already resolved in WCS 12c v2.

Resolution: In order to tackle this issue, one of the simplest way is to write a Java EE filter which can help to retain the parameters by passing the parameters as it is to the target url along with response headers and thus, achieving the goal.

Here, I present a simple Java EE filter which we are already using in our project and works flawlessly. It is exactly similar solution to the implementation provided in WCS 12c v2.

Once you have created this class, shutdown WCS and deploy as jar file to WEB-INF/lib folder where assetapi.jar file recides. Add the following entry in web.xml just above "WebReferenceFilter" entry as shown below and save.

Restart WCS and test the redirects with parameters which should work now.

DisclaimerThe code and/or the configurations posted are not official recommendations and should be used at sole's discretion with proper testing before deploying on live WebCenter Sites systems. Cheers!!

A simple code compare functionality

One of the most important aspect of any development cycle is deployment and while deployment, it is very important to note the changes don...