Announcement Announcement Module
Collapse
No announcement yet.
How to change Content-Type of VelocityView? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to change Content-Type of VelocityView?

    I only wanted to change the page encoding, but realized that
    response.setContentType() which I called in my interceptor were overridden by VelocityView's response.setContentType().

    So, is there a way to change default Content-Type
    (text/html; charset=ISO-8859-1) in VelocityViews without having to write own custom VelocityViewResolver which would do that?

    Is there a way to do it with standard VelocityView and VelocityViewResolver class at all?

  • #2
    VelocityView / VelocityViewResolver have a method:
    Code:
    	/**
    	 * Set the content type for all views.
    	 * May be ignored by view classes if the view itself is assumed
    	 * to set the content type, e.g. in case of JSPs.
    	 * @param contentType the content type
    	 */
    	public void setContentType(String contentType) {
    		this.contentType = contentType;
    	}
    that allows to specify contentType.
    HTH

    Comment


    • #3
      Thanks, I don't know how I missed it.

      Comment

      Working...
      X