1 package com.tonbeller.wcf.charset; 2 3 import java.util.Locale ; 4 5 import javax.servlet.ServletResponse ; 6 import javax.servlet.http.HttpServletResponse ; 7 import javax.servlet.http.HttpServletResponseWrapper ; 8 9 22 class CharsetResponse extends HttpServletResponseWrapper { 23 private String contentType; 24 private String encoding; 25 public CharsetResponse(HttpServletResponse resp, String contentType, String encoding) { 26 super(resp); 27 this.contentType = contentType; 28 this.encoding = encoding; 29 } 30 31 public void setLocale(Locale arg0) { 32 } 34 35 public void setContentType(String ct) { 36 if (contentType != null && ct != null && ct.startsWith(contentType)) 37 ct = contentType + ";charset=" + encoding; 38 super.setContentType(ct); 39 } 40 41 } 42 | Popular Tags |