/** * Returns the given character set, if it is supported on this system. * Returns UTF-8 otherwise. * * @param characterSet * the wished {@link CharacterSet} * @return a supported {@link CharacterSet}, never null. * @see #getCharsetName(MultivaluedMap, CharacterSet) */ public static CharacterSet getSupportedCharSet(CharacterSet characterSet) { if (characterSet == null) { return JAX_RS_DEFAULT_CHARACTER_SET; } if (Charset.isSupported(characterSet.toString())) { return characterSet; } return logUnsupportedCharSet(characterSet.toString()); }
@Override public void write(OutputStream outputStream) throws IOException { XmlWriter xmlWriter = new XmlWriter(outputStream, (getCharacterSet() == null) ? "UTF-8" : getCharacterSet() .toString()); write(xmlWriter); xmlWriter.flush(); }
@Override public void write(OutputStream outputStream) throws IOException { XmlWriter xmlWriter = new XmlWriter(outputStream, (getCharacterSet() == null) ? "UTF-8" : getCharacterSet() .toString()); write(xmlWriter); xmlWriter.flush(); }
/** * @return the character set of the current entity, or null, if no entity or * no character set is available. */ private String getCurrentResponseEntityCharset() { String result = null; Response rsp = Response.getCurrent(); if (rsp == null) { Context.getCurrentLogger().warning( "Unable to find the current response"); } else { Representation entity = Response.getCurrent().getEntity(); if (entity == null) return null; CharacterSet characterSet = entity.getCharacterSet(); if (characterSet == null) return null; result = characterSet.toString(); } return result; }
@Override public void write(OutputStream outputStream) throws IOException { XmlWriter xmlWriter = new XmlWriter(outputStream, (getCharacterSet() == null) ? "UTF-8" : getCharacterSet() .toString()); write(xmlWriter); xmlWriter.flush(); }