Example #1
0
 private void setContentType(HttpServletResponse pResp, String pContentType) {
   boolean encodingDone = false;
   try {
     pResp.setCharacterEncoding("utf-8");
     pResp.setContentType(pContentType);
     encodingDone = true;
   } catch (NoSuchMethodError error) {
     /* Servlet 2.3 */
   } catch (UnsupportedOperationException error) {
     /* Equinox HTTP Service */
   }
   if (!encodingDone) {
     // For a Servlet 2.3 container or an Equinox HTTP Service, set the charset by hand
     pResp.setContentType(pContentType + "; charset=utf-8");
   }
 }