本文整理了Java中org.apache.cxf.message.Message.getInterceptorChain()
方法的一些代码示例,展示了Message.getInterceptorChain()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getInterceptorChain()
方法的具体详情如下:
包路径:org.apache.cxf.message.Message
类名称:Message
方法名:getInterceptorChain
[英]Returns a live copy of the messages interceptor chain. This is useful when an interceptor wants to modify the interceptor chain on the fly.
[中]返回消息侦听器链的实时副本。当拦截器想要动态修改拦截器链时,这很有用。
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
private void handle401response(Message message, Endpoint e) {
HttpServletResponse response = (HttpServletResponse)message.get("HTTP.RESPONSE");
response.setHeader(HEADER_WWW_AUTHENTICATE, AUTHENTICATION_SCHEME_BASIC + " realm=\"" + contextName + "\"");
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setContentLength(0);
message.getInterceptorChain().pause();
}
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
@Override
public void handleFault(Message message) {
Exception ex = message.getContent(Exception.class);
if (ex instanceof AuthenticationException) {
HttpServletResponse resp = (HttpServletResponse)message.getExchange()
.getInMessage().get(AbstractHTTPDestination.HTTP_RESPONSE);
resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
resp.setHeader("WWW-Authenticate", authenticationType + " realm=\"" + realm + "\"");
resp.setContentType("text/plain");
try {
resp.getOutputStream().write(ex.getMessage().getBytes());
resp.getOutputStream().flush();
message.getInterceptorChain().setFaultObserver(null); //avoid return soap fault
message.getInterceptorChain().abort();
} catch (IOException e) {
// TODO
}
}
}
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
public void run() {
try {
handleResponseInternal();
} catch (Throwable e) {
((PhaseInterceptorChain)outMessage.getInterceptorChain()).abort();
outMessage.setContent(Exception.class, e);
((PhaseInterceptorChain)outMessage.getInterceptorChain()).unwind(outMessage);
MessageObserver mo = outMessage.getInterceptorChain().getFaultObserver();
if (mo == null) {
mo = outMessage.getExchange().get(MessageObserver.class);
}
mo.onMessage(outMessage);
}
}
};
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
protected void updateMessageForSuspend() {
inMessage.getExchange().getInMessage().getInterceptorChain().suspend();
}
public void redispatch() {
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
@Override
protected void updateMessageForSuspend() {
Message currentMessage = PhaseInterceptorChain.getCurrentMessage();
if (currentMessage.get(WriteListener.class) != null) {
// CXF Continuation WriteListener will likely need to be introduced
// for NIO supported with non-Servlet specific mechanisms
getOutputStream().setWriteListener(currentMessage.get(WriteListener.class));
currentMessage.getInterceptorChain().suspend();
} else {
inMessage.getExchange().getInMessage().getInterceptorChain().suspend();
}
}
代码示例来源: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 {
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-frontend-jaxws
true)
&& (res != null && !res.isEmpty() && res.get(0) == null)
&& exchange.getInMessage().getInterceptorChain().getState() == InterceptorChain.State.EXECUTING) {
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
message.getInterceptorChain().add(internal);
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
message.getInterceptorChain().add(CertConstraintsInterceptor.INSTANCE);
代码示例来源: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-frontend-jaxws
if (requestor) {
message.getInterceptorChain().abort();
if (!message.getExchange().isOneWay()) {
Endpoint e = message.getExchange().getEndpoint();
代码示例来源:origin: apache/cxf
@Override
public Void run() {
InterceptorChain chain = message.getInterceptorChain();
if (chain != null) {
message.put("suspend.chain.on.current.interceptor", Boolean.TRUE);
chain.doIntercept(message);
}
return null;
}
});
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
exchange.setOutFaultMessage(faultMessage);
InterceptorChain ic = message.getInterceptorChain();
ic.reset();
代码示例来源:origin: apache/cxf
public void handleMessage(Message message) throws Fault {
Exchange ex = message.getExchange();
Boolean forceDisabled = Boolean.FALSE.equals(ex.get("org.apache.cxf.management.counter.enabled"));
if (!forceDisabled && isServiceCounterEnabled(ex)) {
message.getInterceptorChain().add(new ResponseTimeMessageInvokerEndingInteceptor());
}
}
代码示例来源:origin: apache/cxf
public void handleMessage(Message message) throws Fault {
if (!canDocumentBeRead(message)) {
return;
}
prepareMessage(message);
message.getInterceptorChain().add(
new StaxActionInInterceptor(requireSignature, requireEncryption));
}
代码示例来源:origin: apache/cxf
@Override
protected void updateMessageForSuspend() {
Message currentMessage = PhaseInterceptorChain.getCurrentMessage();
if (currentMessage.get(WriteListener.class) != null) {
// CXF Continuation WriteListener will likely need to be introduced
// for NIO supported with non-Servlet specific mechanisms
getOutputStream().setWriteListener(currentMessage.get(WriteListener.class));
currentMessage.getInterceptorChain().suspend();
} else {
inMessage.getExchange().getInMessage().getInterceptorChain().suspend();
}
}
代码示例来源:origin: apache/cxf
private Object handleAsyncFault(Exchange exchange, AsyncResponseImpl ar, Throwable t) {
try {
return handleFault(new Fault(t), exchange.getInMessage(), null, null);
} catch (Fault ex) {
ar.setUnmappedThrowable(ex.getCause() == null ? ex : ex.getCause());
if (isSuspended(exchange)) {
ar.reset();
exchange.getInMessage().getInterceptorChain().unpause();
}
return new MessageContentsList(Response.serverError().build());
}
}
代码示例来源:origin: org.apache.cxf/cxf-core
public void handleMessage(Message message) {
try {
getConduit(message).prepare(message);
} catch (IOException ex) {
throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_SEND", BUNDLE), ex);
}
// Add a final interceptor to close the conduit
message.getInterceptorChain().add(ending);
}
代码示例来源:origin: org.apache.cxf/cxf-api
public void handleMessage(Message message) {
try {
getConduit(message).prepare(message);
} catch (IOException ex) {
throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_SEND", BUNDLE), ex);
}
// Add a final interceptor to close the conduit
message.getInterceptorChain().add(ending);
}
内容来源于网络,如有侵权,请联系作者删除!