Hi,

As I have discussed in earlier threads, our current project is
migration from Spring-MVC based application backed by Teamsite to Day
CQ. Its planned to migrated thin slices of the application from
Spring-MVC to CQ/Sling.
One of the proposed approaches is to migrate just the View JSPs in CQ.
This means migrate just the JSPs and create CQ components (which will
be based on same JSPs).
No changes will be done in existing Spring controllers. CQ will be
used just for rendering pages. An interceptor is written which
forwards request to CQ/Sling instead of JSPs.

So the flow looks as following.

Existing spring MVC

HTTP POST ----> Spring MVC Controller ---> Request forward (Using
request dispatcher forward) ---> JSP page.

With CQ co existing with Spring MVC

HTTP POST ---> Spring MVC Controller ---> Spring Interceptor --->
Request forward (Using ServletContext.dispatcher.forward) --->
CQ/Sling Page URL

The problem with the interceptor is that while it can forward requests
to CQ/Sling (Just as you forward request to other web app in same
container), the HTTP request still remains as POST. CQ/Sling (because
its based on Restful model) have very different meaning for POST and
GET.

So, an proof of concept was done, where before forwarding a request to
CQ, its wrapped in custom RequestWrapper which overrides getMethod
method and returns 'GET'.
e.g.
CustomerRequestWrapper extends HttpServletRequestWrapper {

   public String getMethod() {
         return "GET";
  }

}

This seems to be working.

But I want to know if this kind of verb changing in the same request
can run into any issues?

Thanks,
Unmesh

Reply via email to