public String getContentType() { return format.getContentType(); }
public String getContentTypeAsString() { String encoding = format.getCharSetEncoding(); String contentType = format.getContentType(); if (encoding != null) { contentType += "; charset=" + encoding; } // action header is not mandated in SOAP 1.2. So putting it, if available if (!msgCtxt.isSOAP11() && (soapActionString != null) && !"".equals(soapActionString.trim()) && !"\"\"".equals(soapActionString.trim())) { contentType = contentType + ";action=\"" + soapActionString + "\";"; } return contentType; }
public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException { try { if (format != null && format.getContentType() != null) { if (format.getContentType().contains("xml")) { inputStream.reset(); // reuse the stream JsonUtil.toXml(inputStream, false).serialize(writer, format); return; } } inputStream.reset(); IOUtils.copy(inputStream, writer); } catch (IOException e) { logger.error("#serialize:Writer. Could not serialize JSON payload. Error>>> " + e.getLocalizedMessage()); throw new OMException("Could not serialize JSON payload.", e); } }
public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException { try { if (format != null && format.getContentType() != null) { if (format.getContentType().contains("xml")) { inputStream.reset(); // reuse the stream JsonUtil.toXml(inputStream, false).serialize(output, format); return; } } inputStream.reset(); IOUtils.copy(inputStream, output); } catch (IOException e) { logger.error("#serialize:OutputStream. Could not serialize JSON payload. Error>>> " + e.getLocalizedMessage()); throw new OMException("Could not serialize JSON payload.", e); } }
public String getContentType(MessageContext msgCtxt, OMOutputFormat format, String soapActionString) { String encoding = format.getCharSetEncoding(); String contentType = format.getContentType(); if (log.isDebugEnabled()) { log.debug("contentType from the OMOutputFormat =" + contentType);
public String getContentType(MessageContext msgCtxt, OMOutputFormat format, String soapActionString) { String encoding = format.getCharSetEncoding(); String contentType = format.getContentType(); if (log.isDebugEnabled()) { log.debug("contentType from the OMOutputFormat =" + contentType);
public String getContentType(MessageContext messageContext, OMOutputFormat format, String soapAction) { String encoding = format.getCharSetEncoding(); String contentType; contentType = (String) messageContext.getProperty(Constants.Configuration.CONTENT_TYPE); if (log.isDebugEnabled()) { log.debug("contentType set from messageContext =" + contentType); log.debug("(NOTE) contentType from format is=" + format.getContentType()); } if (contentType == null) { contentType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } else if (isSOAPContentType(contentType)) { contentType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; if (log.isDebugEnabled()) { log.debug("contentType is set incorrectly for Application XML."); log.debug("It is changed to " + contentType); } } if (encoding != null) { contentType += "; charset=" + encoding; } if (log.isDebugEnabled()) { log.debug("contentType returned =" + contentType); } return contentType; }
public String getContentType(MessageContext messageContext, OMOutputFormat format, String soapAction) { String encoding = format.getCharSetEncoding(); String contentType; contentType = (String) messageContext.getProperty(Constants.Configuration.CONTENT_TYPE); if (log.isDebugEnabled()) { log.debug("contentType set from messageContext =" + contentType); log.debug("(NOTE) contentType from format is=" + format.getContentType()); } if (contentType == null) { contentType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } else if (isSOAPContentType(contentType)) { contentType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; if (log.isDebugEnabled()) { log.debug("contentType is set incorrectly for Application XML."); log.debug("It is changed to " + contentType); } } if (encoding != null) { contentType += "; charset=" + encoding; } if (log.isDebugEnabled()) { log.debug("contentType returned =" + contentType); } return contentType; }
/** * Get the content type for the message passed in * @param msgContext the message * @return content type of the message */ public static String getContentType(MessageContext msgContext) { Object contentTypeObject = msgContext.getProperty(Constants.Configuration.CONTENT_TYPE); if (contentTypeObject != null) { return (String) contentTypeObject; } else if (msgContext.isDoingREST()) { return HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } else { return getOMOutputFormat(msgContext).getContentType(); } }
out.writeBoolean(true); out.writeUTF(outputFormat.getContentType()); } else { out.writeBoolean(false); log.debug(correlationIDString + ":writeExternal(): " + "optimized=[" + outputFormat.isOptimized() + "] " + "optimizedContentType " + outputFormat.getContentType() + "] " + "charSetEnc=[" + outputFormat.getCharSetEncoding() + "] " + "namespaceURI=[" + envelope.getNamespace().getNamespaceURI() + "]");
out.writeBoolean(true); out.writeUTF(outputFormat.getContentType()); } else { out.writeBoolean(false); log.debug(correlationIDString + ":writeExternal(): " + "optimized=[" + outputFormat.isOptimized() + "] " + "optimizedContentType " + outputFormat.getContentType() + "] " + "charSetEnc=[" + outputFormat.getCharSetEncoding() + "] " + "namespaceURI=[" + envelope.getNamespace().getNamespaceURI() + "]");
if (outputStream instanceof TransportOutputStream) { TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream; String contentType = outputFormat.getContentType(); if (!(outputFormat.isDoingSWA() || outputFormat.isOptimized())) { String charsetEncoding = axiomMessage.getCharsetEncoding();
if (outputStream instanceof TransportOutputStream) { TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream; String contentType = outputFormat.getContentType(); if (!(outputFormat.isDoingSWA() || outputFormat.isOptimized())) { String charsetEncoding = axiomMessage.getCharsetEncoding();
if (outputStream instanceof TransportOutputStream) { TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream; String contentType = outputFormat.getContentType(); if (!(outputFormat.isDoingSWA() || outputFormat.isOptimized())) { String charsetEncoding = axiomMessage.getCharsetEncoding();
if (outputStream instanceof TransportOutputStream) { TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream; String contentType = outputFormat.getContentType(); if (!(outputFormat.isDoingSWA() || outputFormat.isOptimized())) { String charsetEncoding = axiomMessage.getCharsetEncoding();