Example #1
0
  protected void setConverter() throws IOException {

    if (coyoteResponse != null) enc = coyoteResponse.getCharacterEncoding();

    gotEnc = true;
    if (enc == null) enc = DEFAULT_ENCODING;
    conv = encoders.get(enc);
    if (conv == null) {

      if (Globals.IS_SECURITY_ENABLED) {
        try {
          conv =
              AccessController.doPrivileged(
                  new PrivilegedExceptionAction<C2BConverter>() {

                    @Override
                    public C2BConverter run() throws IOException {
                      return new C2BConverter(bb, enc);
                    }
                  });
        } catch (PrivilegedActionException ex) {
          Exception e = ex.getException();
          if (e instanceof IOException) throw (IOException) e;
        }
      } else {
        conv = new C2BConverter(bb, enc);
      }

      encoders.put(enc, conv);
    }
  }
Example #2
0
 /** Return the character encoding used for this Response. */
 @Override
 public String getCharacterEncoding() {
   return (coyoteResponse.getCharacterEncoding());
 }