Bypassing grails view resolvers?
I'm trying to build a portlet within a grails application, and I've created a simple controller extending AbstractController
which returns
new ModelAndView('myportlet')
from handleRequestInternal
. I also have a standard Jstl view resolver
setup for /WEB-INF/jsp
b开发者_Python百科ut no matter what I try, when I try to view the portlet within liferay I get the following stacktrace:
13:19:39,723 ERROR [DispatcherPortlet:559] Could not complete request
java.lang.ClassCastException: org.springframework.web.portlet.context.PortletRequestAttributes cannot be cast to org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
at org.codehaus.groovy.grails.web.util.WebUtils.retrieveGrailsWebRequest(WebUtils.java:497)
at org.codehaus.groovy.grails.web.servlet.view.GrailsViewResolver.loadView(GrailsViewResolver.java:87)
at org.codehaus.groovy.grails.scaffolding.view.ScaffoldingViewResolver.loadView(ScaffoldingViewResolver.java:61)
at org.springframework.web.servlet.view.AbstractCachingViewResolver.createView(AbstractCachingViewResolver.java:158)
at org.springframework.web.servlet.view.UrlBasedViewResolver.createView(UrlBasedViewResolver.java:384)
at org.springframework.web.servlet.view.AbstractCachingViewResolver.resolveViewName(AbstractCachingViewResolver.java:77)
at org.springframework.web.portlet.DispatcherPortlet.resolveViewName(DispatcherPortlet.java:1110)
It seems that if I could get around the GrailsViewResolver
, I should be able to get my portlet up and running as I would in a normal spring application.
I'm using liferay 6, so the grails liferay plugin isn't an option. Is there anything I can do to make sure GrailsViewResolver doesn't try to resolve my view in /WEB-INF/jsp
?
If you're using Grails, use it 100% and don't try to mix wildly different technologies. It'll save you pain in the long run.
精彩评论