Issue Details (XML | Word | Printable)

Key: SPR-2327
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Juergen Hoeller
Reporter: Hamster
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Spring Framework

AbstractTemplateView and getContentType() method

Created: 19/Jul/06 06:19 PM   Updated: 25/Feb/08 05:58 PM
Component/s: SpringWEB
Affects Version/s: 2.0 RC2, 2.0.8, 2.5.1
Fix Version/s: 2.5.2, 2.0.9

Time Tracking:
Not Specified

Environment: jboss-portal-2.4, velocity 1.4


 Description  « Hide
I've been trying to use spring with jboss portal.
I've configured velocityResolver and velocityConfigurer, I've configured ViewRendererServlet and found that in AbstractTemplateView there is code:

private static boolean responseGetContentTypeAvailable;

static {
// Determine whether the Servlet 2.4 ServletResponse.getContentType method
// is available.
try {
ServletResponse.class.getMethod("getContentType", new Class[] {});
responseGetContentTypeAvailable = true;
}
catch (NoSuchMethodException ex) {
responseGetContentTypeAvailable = false;
}
}

http://springframework.cvs.sourceforge.net/springframework/spring/src/org/springframework/web/servlet/view/AbstractTemplateView.java?revision=1.13&view=markup

However in JBoss Portal there is:
  public String getContentType()
  {
  throw new UnsupportedOperationException("Not specified by spec");
  }

http://fisheye.labs.jboss.com/viewrep/JBoss/jboss-portal/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java?r=1.1

Shouldn't spring code tries to call getContentType when found and handle other exceptions?

I know that I can reimplement my templte view however it would be still good if we could use as much as possible out of the box.


 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
John Lewis added a comment - 03/Jul/07 01:34 PM
Looks like this affects both Velocity and FreeMarker. ( see forum discussion: http://forum.springframework.org/showthread.php?p=129902 )

Juergen Hoeller added a comment - 25/Feb/08 05:58 PM
I've finally addressed this for 2.5.2 / 2.0.9, simply catching exceptions thrown from "HttpServletResponse.getContentType()" and proceeding like if the method wasn't there to begin with...

Juergen