/** * Gets the encoding for the current message. For potocols that send encoding * Information with the message, this method should be overriden to expose the * transport encoding, otherwise the default encoding in the Mule configuration * will be used * * @return the encoding for this message. This method must never return null */ public String getEncoding() { return event.getEncoding(); }
public String getCharacterEncoding() { return event.getEncoding(); }
public String getCharacterEncoding() { return event.getEncoding(); }
private HttpEntity createUrlEncodedEntity(MuleEvent event, Map payload) { final Map mapPayload = payload; HttpEntity entity = new EmptyHttpEntity(); if (!mapPayload.isEmpty()) { String encodedBody; if (mapPayload instanceof ParameterMap) { encodedBody = HttpParser.encodeString(event.getEncoding(), ((ParameterMap) mapPayload).toListValuesMap()); } else { encodedBody = HttpParser.encodeString(event.getEncoding(), mapPayload); } entity = new ByteArrayHttpEntity(encodedBody.getBytes()); } return entity; }
protected HttpMethod createEntityMethod(MuleEvent event, Object body, EntityEnclosingMethod postMethod) throws TransformerException { HttpMethod httpMethod; if (body instanceof String) { httpMethod = (HttpMethod) sendTransformer.transform(body.toString()); } else if (body instanceof byte[]) { byte[] buffer = event.transformMessage(DataType.BYTE_ARRAY_DATA_TYPE); postMethod.setRequestEntity(new ByteArrayRequestEntity(buffer, event.getEncoding())); httpMethod = postMethod; } else { if (!(body instanceof OutputHandler)) { body = event.transformMessage(DataTypeFactory.create(OutputHandler.class)); } OutputHandler outputHandler = (OutputHandler) body; postMethod.setRequestEntity(new StreamPayloadRequestEntity(outputHandler, event)); postMethod.setContentChunked(true); httpMethod = postMethod; } return httpMethod; }
m.put(Message.ENCODING, ctx.getEncoding()); m.setContent(InputStream.class, payload); m.put(Message.ENCODING, ctx.getEncoding()); m.setContent(InputStream.class, is);
String body = HttpParser.encodeString(muleEvent.getEncoding(), (Map) payload); requestBuilder.addHeader(CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED); return new ByteArrayHttpEntity(body.getBytes());
this.encoding = rewriteEvent.getEncoding(); this.exchangePattern = messageExchangePattern; this.messageSourceName = rewriteEvent.getMessageSourceName();