uPortal IRC Logs-2013-07-18
[10:36:09 CDT(-0500)] <jwennmacher> Just out of curiosity does anyone know if there is an issue with using a Resource request to obtain an HTML page from a JSP? I tried it yesterday but even though SpringWeb indicated it was resolving the JSP, the JSP was never invoked.
[10:36:29 CDT(-0500)] <EricDalquist> heh
[10:36:30 CDT(-0500)] <jwennmacher> I set it aside for another approach, but I don't see any reason why that shouldn't work
[10:36:34 CDT(-0500)] <EricDalquist> so this is a pain
[10:36:53 CDT(-0500)] <EricDalquist> spring can dispatch to its rendering servlet either via forward or include
[10:37:00 CDT(-0500)] <EricDalquist> JSPs appear to only work if you do an include
[10:37:20 CDT(-0500)] <EricDalquist> but setting HTTP headers only work if you do a forward (per the portlet spec)
[10:37:45 CDT(-0500)] <EricDalquist> let me see if I can find the change ...
[10:38:08 CDT(-0500)] <jwennmacher> Was this a Spring fix? I vaguely remember you posting something ...
[10:38:18 CDT(-0500)] <EricDalquist> https://jira.springsource.org/browse/SPR-9876
[10:38:28 CDT(-0500)] <EricDalquist> funny enough my own comment damned you
[10:38:39 CDT(-0500)] <EricDalquist> you can try extending DispatcherPortlet in your app
[10:38:50 CDT(-0500)] <EricDalquist> and overriding doDispatch to allow for doing an include instead of a forward
[10:39:00 CDT(-0500)] <EricDalquist> but then you lose all control over setting HTTP headers on the response
[10:40:10 CDT(-0500)] <EricDalquist> it is essentially a side effect of how spring uses a servlet to render views for portlets
[10:40:28 CDT(-0500)] <EricDalquist> and the weirdness that then results with multiple layers of include/forward
[10:44:09 CDT(-0500)] <jwennmacher> Not sure I fully follow how this ties together. What I think I saw was that I returned a ModelAndView from the controller which should resolve to a JSP page. However no content (0 bytes) was returned to the browser. SPR-9876 makes it sound like it would return content but not allow headers to be set.
[10:44:45 CDT(-0500)] <EricDalquist> so SPR-9876 was done to switch from calling request.include to request.forward
[10:45:06 CDT(-0500)] <EricDalquist> I have seen issues with how Spring's JSP view works because of this change though
[10:45:15 CDT(-0500)] <EricDalquist> I never spent a lot of time figuring out why exactly
[10:45:32 CDT(-0500)] <EricDalquist> but the change seems to break using JSPs via Springs view rendering in resources
[10:47:22 CDT(-0500)] <jwennmacher> So switching to request.forward allows setting of the headers, but you lose the content? Interesting. I'd think the content would still be present with a forward (which I guess is the bug).
[10:47:37 CDT(-0500)] <EricDalquist> no, content should still be sent
[10:47:47 CDT(-0500)] <EricDalquist> I believe there is a bug specifically around how Spring's view layer renders JSPs
[10:47:57 CDT(-0500)] <EricDalquist> and the interaction of that with the forward call
[10:48:18 CDT(-0500)] <EricDalquist> oh rhm
[10:48:19 CDT(-0500)] <EricDalquist> hrm
[10:48:22 CDT(-0500)] <EricDalquist> just a sec
[10:48:56 CDT(-0500)] <EricDalquist> one thing to try
[10:49:14 CDT(-0500)] <EricDalquist> in your configuration of JstlView try toggling: http://static.springsource.org/spring/docs/3.2.x/javadoc-api/org/springframework/web/servlet/view/InternalResourceView.html#useInclude(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
[10:49:19 CDT(-0500)] <EricDalquist> hrm
[10:49:21 CDT(-0500)] <EricDalquist> that didn't paste well
[10:49:46 CDT(-0500)] <EricDalquist> oh here it is: http://static.springsource.org/spring/docs/3.2.x/javadoc-api/org/springframework/web/servlet/view/InternalResourceView.html#setAlwaysInclude(boolean)
[10:50:02 CDT(-0500)] <EricDalquist> try toggling setAlwaysInclude on the JSTL view used for JSP rendering
[10:50:08 CDT(-0500)] <EricDalquist> I think that may have been the fix
[10:50:44 CDT(-0500)] <EricDalquist> essentially this is bad interaction between the JstlView (actually it is the InternalResourceView) and how the portlet spec says resource requests should be handled
[10:51:55 CDT(-0500)] <jwennmacher> OK thanks! I'll give that a try.