/**
  * Determine the JSON encoding to use for the given content type.
  *
  * @param contentType the media type as requested by the caller
  * @return the JSON encoding to use (never {@code null})
  */
 protected JsonEncoding getJsonEncoding(MediaType contentType) {
   if (contentType != null && contentType.getCharset() != null) {
     Charset charset = contentType.getCharset();
     for (JsonEncoding encoding : JsonEncoding.values()) {
       if (charset.name().equals(encoding.getJavaName())) {
         return encoding;
       }
     }
   }
   return JsonEncoding.UTF8;
 }
Exemple #2
0
 static 
 {
     $SwitchMap$com$fasterxml$jackson$core$JsonEncoding = new int[JsonEncoding.values().length];
     try
     {
         $SwitchMap$com$fasterxml$jackson$core$JsonEncoding[JsonEncoding.UTF32_BE.ordinal()] = 1;
     }
     catch (NoSuchFieldError nosuchfielderror4) { }
     try
     {
         $SwitchMap$com$fasterxml$jackson$core$JsonEncoding[JsonEncoding.UTF32_LE.ordinal()] = 2;
     }
     catch (NoSuchFieldError nosuchfielderror3) { }
     try
     {
         $SwitchMap$com$fasterxml$jackson$core$JsonEncoding[JsonEncoding.UTF16_BE.ordinal()] = 3;
     }
     catch (NoSuchFieldError nosuchfielderror2) { }
     try
     {
         $SwitchMap$com$fasterxml$jackson$core$JsonEncoding[JsonEncoding.UTF16_LE.ordinal()] = 4;
     }
     catch (NoSuchFieldError nosuchfielderror1) { }
     try
     {
         $SwitchMap$com$fasterxml$jackson$core$JsonEncoding[JsonEncoding.UTF8.ordinal()] = 5;
     }
     catch (NoSuchFieldError nosuchfielderror)
     {
         return;
     }
 }