本文整理了Java中org.apache.cxf.message.Message.put()
方法的一些代码示例,展示了Message.put()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.put()
方法的具体详情如下:
包路径:org.apache.cxf.message.Message
类名称:Message
方法名:put
暂无
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
protected void propagateConduit(Exchange exchange, Message in) {
if (exchange != null) {
Message out = exchange.getOutMessage();
if (out != null) {
in.put(Conduit.class, out.get(Conduit.class));
}
}
}
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
/**
* Send an outbound message, assumed to contain all the name-value
* mappings of the corresponding input message (if any).
*
* @param message the message to be sent.
*/
public void prepare(Message message) throws IOException {
message.put(HTTP_RESPONSE, response);
OutputStream os = message.getContent(OutputStream.class);
if (os == null) {
message.setContent(OutputStream.class,
new WrappedOutputStream(message));
}
}
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
inMessage.setContent(DelegatingInputStream.class, in);
inMessage.setContent(InputStream.class, in);
inMessage.put(HTTP_REQUEST, req);
inMessage.put(HTTP_RESPONSE, resp);
inMessage.put(HTTP_CONTEXT, context);
inMessage.put(HTTP_CONFIG, config);
inMessage.put(HTTP_CONTEXT_MATCH_STRATEGY, contextMatchStrategy);
inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod());
String requestURI = req.getRequestURI();
inMessage.put(Message.REQUEST_URI, requestURI);
String requestURL = req.getRequestURL().toString();
inMessage.put(Message.REQUEST_URL, requestURL);
String contextPath = req.getContextPath();
if (contextPath == null) {
String pathInfo = req.getPathInfo();
if (pathInfo != null) {
inMessage.put(Message.PATH_INFO, contextServletPath + pathInfo);
} else {
inMessage.put(Message.PATH_INFO, requestURI);
inMessage.put(HTTP_BASE_PATH, basePathWithContextOnly);
inMessage.put(HTTP_BASE_PATH, requestURL.substring(0, index));
inMessage.put(Message.CONTENT_TYPE, contentType);
setEncoding(inMessage, req, contentType);
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
public void handleMessage(Message message) throws Fault {
if (binding.getHandlerChain().isEmpty()) {
return;
}
HandlerChainInvoker invoker = getInvoker(message);
if (invoker.getLogicalHandlers().isEmpty()) {
return;
}
XMLStreamWriter origWriter = message.getContent(XMLStreamWriter.class);
Document doc = DOMUtils.newDocument();
message.setContent(Node.class, doc);
W3CDOMStreamWriter writer = new W3CDOMStreamWriter(doc);
// set up the namespace context
try {
writer.setNamespaceContext(origWriter.getNamespaceContext());
} catch (XMLStreamException ex) {
// don't set the namespaceContext
}
// Replace stax writer with DomStreamWriter
message.setContent(XMLStreamWriter.class, writer);
message.put(ORIGINAL_WRITER, origWriter);
message.getInterceptorChain().add(ending);
}
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
public void handleMessage(Message message) throws Fault {
MessageContentsList outObjects = MessageContentsList.getContentsList(message);
Exchange exchange = message.getExchange();
OperationInfo op = exchange.getBindingOperationInfo() == null
? null
if (!Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE))) {
List<MessagePartInfo> parts = op.getOutput().getMessageParts();
MessageContentsList inObjects = MessageContentsList.getContentsList(exchange.getInMessage());
message.put(HolderInInterceptor.CLIENT_HOLDERS, holders);
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
private void validatePossibleFault(Message message, BindingOperationInfo bop, Node ds) {
Element el = DOMUtils.getFirstElement(ds);
if (!"Fault".equals(el.getLocalName())) {
return;
}
message.put(Message.RESPONSE_CODE, 500);
el = DOMUtils.getFirstElement(el);
while (el != null && !"detail".equals(el.getLocalName())) {
el = DOMUtils.getNextElement(el);
}
if (el != null) {
Schema schema = EndpointReferenceUtils.getSchema(message.getExchange().getService()
.getServiceInfos().get(0),
message.getExchange().getBus());
try {
validateFaultDetail(el, schema, bop);
} catch (Exception e) {
throw new Fault(e);
}
//We validated what we can from a fault standpoint
message.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE);
}
}
private void validateFaultDetail(Element detail, Schema schema, BindingOperationInfo bop) throws Exception {
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
public void handleMessage(Message message) throws Fault {
Exchange ex = message.getExchange();
BindingOperationInfo boi = ex.getBindingOperationInfo();
if (Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE))
|| boi == null) {
return;
BindingMessageInfo bmi;
MessageInfo wrappedMessageInfo = message.get(MessageInfo.class);
MessageInfo messageInfo;
if (wrappedMessageInfo == boi.getOperationInfo().getInput()) {
return;
message.put(MessageInfo.class, messageInfo);
message.put(BindingMessageInfo.class, bmi);
ex.put(BindingOperationInfo.class, boi2);
Service service = ServiceModelUtil.getService(message.getExchange());
DataBinding dataBinding = service.getDataBinding();
if (dataBinding instanceof WrapperCapableDatabinding) {
message.setContent(List.class, newParams);
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
} else if (DataSource.class.isAssignableFrom(type)) {
MessageContentsList list = (MessageContentsList)message.getContent(List.class);
DataSource ds = (DataSource)list.get(0);
String ct = ds.getContentType();
if (ct.toLowerCase().contains("multipart/related")) {
Message msg = new MessageImpl();
msg.setExchange(message.getExchange());
msg.put(Message.CONTENT_TYPE, ct);
try {
msg.setContent(InputStream.class, ds.getInputStream());
AttachmentDeserializer deser = new AttachmentDeserializer(msg);
deser.initializeAttachments();
final InputStream in = msg.getContent(InputStream.class);
final String ct2 = (String)msg.get(Message.CONTENT_TYPE);
list.set(0, new DataSource() {
OutputStream out = message.getContent(OutputStream.class);
message.put(Message.CONTENT_TYPE, ct);
try {
InputStream in = ds.getInputStream();
message.setContent(OutputStream.class, out);
XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
message.setContent(XMLStreamWriter.class, writer);
代码示例来源:origin: apache/cxf
public void prepare(Message message) throws IOException {
message.put(CorbaConstants.ORB, orb);
message.put(CorbaConstants.CORBA_ENDPOINT_OBJECT, targetObject);
message.setContent(OutputStream.class, new CorbaOutputStream(message));
if (message instanceof CorbaMessage) {
((CorbaMessage) message).setCorbaTypeMap(typeMap);
}
}
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-jbi
/**
* Send an outbound message, assumed to contain all the name-value
* mappings of the corresponding input message (if any).
*
* @param message the message to be sent.
*/
public void prepare(Message message) throws IOException {
// setup the message to be send back
DeliveryChannel dc = channel;
message.put(MessageExchange.class, inMessage.get(MessageExchange.class));
message.setContent(OutputStream.class,
new JBIDestinationOutputStream(inMessage, message, dc));
}
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
private void handleAbort(Message message, W3CDOMStreamWriter writer) {
message.getInterceptorChain().abort();
if (!message.getExchange().isOneWay()) {
//server side inbound
Endpoint e = message.getExchange().getEndpoint();
Message responseMsg = new MessageImpl();
responseMsg.setExchange(message.getExchange());
responseMsg = e.getBinding().createMessage(responseMsg);
message.getExchange().setOutMessage(responseMsg);
XMLStreamReader reader = message.getContent(XMLStreamReader.class);
if (reader == null && writer != null) {
reader = StaxUtils.createXMLStreamReader(writer.getDocument());
}
InterceptorChain chain = OutgoingChainInterceptor
.getOutInterceptorChain(message.getExchange());
responseMsg.setInterceptorChain(chain);
responseMsg.put("LogicalHandlerInterceptor.INREADER", reader);
chain.doIntercept(responseMsg);
}
}
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
inMessage.getExchange().put(Bus.class, bus);
inMessage.put(Message.DECOUPLED_CHANNEL_MESSAGE, Boolean.TRUE);
inMessage.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_OK);
InputStream in = inMessage.getContent(InputStream.class);
if (in != null) {
CachedOutputStream cos = new CachedOutputStream();
IOUtils.copy(in, cos);
inMessage.setContent(InputStream.class, cos.getInputStream());
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
String scheme = (String)message.get("http.scheme");
final MessageTrustDecider orig = message.get(MessageTrustDecider.class);
MessageTrustDecider trust = new HttpsMessageTrustDecider(certConstraints, orig);
message.put(MessageTrustDecider.class, trust);
} else {
throw new UntrustedURLConnectionIOException(
TLSSessionInfo tlsInfo = message.get(TLSSessionInfo.class);
final Certificate[] certs = tlsInfo.getPeerCertificates();
if (certs == null || certs.length == 0) {
代码示例来源:origin: stackoverflow.com
@Override
public void handleFault(Message message) {
FaultMode mode = message.get(FaultMode.class);
Exception exception = message.getContent(Exception.class);
if (exception != null && exception.getCause() != null) {
if (mode != FaultMode.CHECKED_APPLICATION_FAULT) {
if (exception.getCause() instanceof NotificationFailedException) {
message.put(FaultMode.class, FaultMode.CHECKED_APPLICATION_FAULT);
}
}
}
}
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
private void doSoap(Message message) {
MessageContentsList list = (MessageContentsList)message.getContent(List.class);
if (list == null || list.isEmpty()) {
return;
message.put("write.attachments", Boolean.TRUE);
Object enc = soapMessage.getProperty(SOAPMessage.CHARACTER_SET_ENCODING);
if (enc instanceof String) {
message.put(Message.ENCODING, enc);
if (xmlDec != null) {
boolean b = PropertyUtils.isTrue(xmlDec);
message.put(StaxOutInterceptor.FORCE_START_DOCUMENT, b);
代码示例来源:origin: Talend/tesb-rt-se
protected void transformXWriter(Message message, XMLStreamWriter xWriter) {
CachedWriter writer = new CachedWriter();
XMLStreamWriter delegate = StaxUtils.createXMLStreamWriter(writer);
XSLTStreamWriter wrapper = new XSLTStreamWriter(getXSLTTemplate(), writer, delegate, xWriter);
message.setContent(XMLStreamWriter.class, wrapper);
message.put(AbstractOutDatabindingInterceptor.DISABLE_OUTPUTSTREAM_OPTIMIZATION,
Boolean.TRUE);
TransformationOutEndingInterceptor si = new TransformationOutEndingInterceptor();
message.getInterceptorChain().add(si);
}
代码示例来源:origin: apache/cxf
@Override
public void handleMessage(final Message message) throws Fault {
if (message.containsKey(WIRE_TAP_STARTED)) {
return;
}
message.put(WIRE_TAP_STARTED, Boolean.TRUE);
try {
InputStream is = message.getContent(InputStream.class);
if (is != null) {
handleInputStream(message, is);
} else {
Reader reader = message.getContent(Reader.class);
if (reader != null) {
handleReader(message, reader);
}
}
} catch (Exception e) {
throw new Fault(e);
}
}
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
public void handleMessage(Message message) throws Fault {
if (binding.getHandlerChain().isEmpty()) {
return;
}
HandlerChainInvoker invoker = getInvoker(message);
if (invoker.getLogicalHandlers().isEmpty()) {
return;
}
XMLStreamWriter origWriter = message.getContent(XMLStreamWriter.class);
Node nd = message.getContent(Node.class);
SOAPMessage m = message.getContent(SOAPMessage.class);
Document document = null;
if (m != null) {
document = m.getSOAPPart();
} else if (nd != null) {
document = nd.getOwnerDocument();
} else {
document = DOMUtils.newDocument();
message.setContent(Node.class, document);
}
W3CDOMStreamWriter writer = new W3CDOMStreamWriter(document.createDocumentFragment());
// Replace stax writer with DomStreamWriter
message.setContent(XMLStreamWriter.class, writer);
message.put(ORIGINAL_WRITER, origWriter);
message.getInterceptorChain().add(ending);
}
@Override
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
private int getReponseCodeFromMessage(Message message) {
Integer i = (Integer)message.get(Message.RESPONSE_CODE);
if (i != null) {
return i.intValue();
}
int code = hasNoResponseContent(message) ? HttpURLConnection.HTTP_ACCEPTED : HttpURLConnection.HTTP_OK;
// put the code in the message so that others can get it
message.put(Message.RESPONSE_CODE, code);
return code;
}
代码示例来源:origin: apache/cxf
private String getEncoding(Message message) {
Exchange ex = message.getExchange();
String encoding = (String) message.get(Message.ENCODING);
if (encoding == null && ex.getInMessage() != null) {
encoding = (String) ex.getInMessage().get(Message.ENCODING);
message.put(Message.ENCODING, encoding);
}
if (encoding == null) {
encoding = StandardCharsets.UTF_8.name();
message.put(Message.ENCODING, encoding);
}
return encoding;
}
内容来源于网络,如有侵权,请联系作者删除!