private String setEncoding(final Message inMessage, final HttpServletRequest req, final String contentType) throws IOException { String enc = HttpHeaderHelper.findCharset(contentType); if (enc == null) { enc = req.getCharacterEncoding(); } // work around a bug with Jetty which results in the character // encoding not being trimmed correctly. if (enc != null && enc.endsWith("\"")) { enc = enc.substring(0, enc.length() - 1); } if (enc != null || "POST".equals(req.getMethod()) || "PUT".equals(req.getMethod())) { //allow gets/deletes/options to not specify an encoding String normalizedEncoding = HttpHeaderHelper.mapCharset(enc); if (normalizedEncoding == null) { String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", LOG, enc).toString(); LOG.log(Level.WARNING, m); throw new IOException(m); } inMessage.put(Message.ENCODING, normalizedEncoding); } return contentType; } protected Message retrieveFromContinuation(HttpServletRequest req) {
String charset = HttpHeaderHelper.findCharset((String)inMessage.get(Message.CONTENT_TYPE)); String normalizedEncoding = HttpHeaderHelper.mapCharset(charset); if (normalizedEncoding == null) {
static String getEncoding(String ct) throws UnsupportedEncodingException { String enc = HttpHeaderHelper.findCharset(ct); String normalizedEncoding = HttpHeaderHelper.mapCharset(enc, StandardCharsets.UTF_8.name()); if (normalizedEncoding == null) { String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", LOG, new Object[] { enc }).toString(); LOG.log(Level.WARNING, m); throw new UnsupportedEncodingException(m); } return normalizedEncoding; }
protected void setCharsetWithContentType(Exchange camelExchange) { // setup the charset from content-type header String contentTypeHeader = ExchangeHelper.getContentType(camelExchange); if (contentTypeHeader != null) { String charset = HttpHeaderHelper.findCharset(contentTypeHeader); String normalizedEncoding = HttpHeaderHelper.mapCharset(charset, Charset.forName("UTF-8").name()); if (normalizedEncoding != null) { camelExchange.setProperty(Exchange.CHARSET_NAME, normalizedEncoding); } } }
private String setEncoding(final Message inMessage, final HttpServletRequest req, final String contentType) throws IOException { String enc = HttpHeaderHelper.findCharset(contentType); if (enc == null) { enc = req.getCharacterEncoding(); } // work around a bug with Jetty which results in the character // encoding not being trimmed correctly. if (enc != null && enc.endsWith("\"")) { enc = enc.substring(0, enc.length() - 1); } if (enc != null || "POST".equals(req.getMethod()) || "PUT".equals(req.getMethod())) { //allow gets/deletes/options to not specify an encoding String normalizedEncoding = HttpHeaderHelper.mapCharset(enc); if (normalizedEncoding == null) { String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", LOG, enc).toString(); LOG.log(Level.WARNING, m); throw new IOException(m); } inMessage.put(Message.ENCODING, normalizedEncoding); } return contentType; } protected Message retrieveFromContinuation(HttpServletRequest req) {
protected void setCharsetWithContentType(Exchange camelExchange) { // setup the charset from content-type header String contentTypeHeader = ExchangeHelper.getContentType(camelExchange); if (contentTypeHeader != null) { String charset = HttpHeaderHelper.findCharset(contentTypeHeader); String normalizedEncoding = HttpHeaderHelper.mapCharset(charset, Charset.forName("UTF-8").name()); if (normalizedEncoding != null) { camelExchange.setProperty(Exchange.CHARSET_NAME, normalizedEncoding); } } }
private String setEncoding(final Message inMessage, final HttpServletRequest req, final String contentType) throws IOException { String enc = HttpHeaderHelper.findCharset(contentType); if (enc == null) { enc = req.getCharacterEncoding(); } // work around a bug with Jetty which results in the character // encoding not being trimmed correctly. if (enc != null && enc.endsWith("\"")) { enc = enc.substring(0, enc.length() - 1); } if (enc != null || "POST".equals(req.getMethod()) || "PUT".equals(req.getMethod())) { //allow gets/deletes/options to not specify an encoding String normalizedEncoding = HttpHeaderHelper.mapCharset(enc); if (normalizedEncoding == null) { String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", LOG, enc).toString(); LOG.log(Level.WARNING, m); throw new IOException(m); } inMessage.put(Message.ENCODING, normalizedEncoding); } return contentType; } protected Message retrieveFromContinuation(HttpServletRequest req) {
String val = ih.getHeader("Content-Type", "; "); if (!StringUtils.isEmpty(val)) { String cs = HttpHeaderHelper.findCharset(val); if (!StringUtils.isEmpty(cs)) { message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));
String val = ih.getHeader("Content-Type", "; "); if (!StringUtils.isEmpty(val)) { String cs = HttpHeaderHelper.findCharset(val); if (!StringUtils.isEmpty(cs)) { message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));
String val = AttachmentUtil.getHeader(ih, "Content-Type", "; "); if (!StringUtils.isEmpty(val)) { String cs = HttpHeaderHelper.findCharset(val); if (!StringUtils.isEmpty(cs)) { message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));
String val = AttachmentUtil.getHeader(ih, "Content-Type", "; "); if (!StringUtils.isEmpty(val)) { String cs = HttpHeaderHelper.findCharset(val); if (!StringUtils.isEmpty(cs)) { message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));
String charset = HttpHeaderHelper.findCharset((String)inMessage.get(Message.CONTENT_TYPE)); String normalizedEncoding = HttpHeaderHelper.mapCharset(charset); if (normalizedEncoding == null) {
String charset = HttpHeaderHelper.findCharset((String)inMessage.get(Message.CONTENT_TYPE)); String normalizedEncoding = HttpHeaderHelper.mapCharset(charset); if (normalizedEncoding == null) {