本文整理汇总了Java中org.apache.cxf.message.Exchange.get方法的典型用法代码示例。如果您正苦于以下问题:Java Exchange.get方法的具体用法?Java Exchange.get怎么用?Java Exchange.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.message.Exchange
的用法示例。
在下文中一共展示了Exchange.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performInvocation
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
protected Object performInvocation(Exchange cxfExchange, final Object serviceObject, Method method,
Object[] paramArray) throws Exception {
Object response = null;
if (endpoint.isPerformInvocation()) {
response = super.performInvocation(cxfExchange, serviceObject, method, paramArray);
}
paramArray = insertExchange(method, paramArray, cxfExchange);
OperationResourceInfo ori = cxfExchange.get(OperationResourceInfo.class);
if (ori.isSubResourceLocator()) {
// don't delegate the sub resource locator call to camel processor
return method.invoke(serviceObject, paramArray);
}
Continuation continuation;
if (!endpoint.isSynchronous() && (continuation = getContinuation(cxfExchange)) != null) {
LOG.trace("Calling the Camel async processors.");
return asyncInvoke(cxfExchange, serviceObject, method, paramArray, continuation, response);
} else {
LOG.trace("Calling the Camel sync processors.");
return syncInvoke(cxfExchange, serviceObject, method, paramArray, response);
}
}
示例2: handleMessage
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public void handleMessage(Message message) throws Fault
{
if (binding != null) {
Exchange ex = message.getExchange();
if (ex.get(HandlerChainInvoker.class) == null) {
List<Handler> hc = binding.getHandlerChain();
if (hc.size() > 1) { //no need to sort etc if the chain is empty or has one handler only
Collections.sort(hc, comparator);
//install a new HandlerChainInvoker using the sorted handler chain;
//the AbstractJAXWSHandlerInterceptor will be using this invoker
//instead of creating a new one
ex.put(HandlerChainInvoker.class, new HandlerChainInvoker(hc, isOutbound(message, ex)));
}
}
}
}
示例3: handleMessage
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault
{
final Exchange ex = message.getExchange();
HandlerChainInvoker invoker = ex.get(HandlerChainInvoker.class);
if (null == invoker)
{
final org.apache.cxf.endpoint.Endpoint endpoint = ex.getEndpoint();
if (endpoint instanceof JaxWsEndpointImpl) { // JAXWS handlers are not assigned to different endpoint types
final JaxWsEndpointImpl ep = (JaxWsEndpointImpl)endpoint;
@SuppressWarnings("rawtypes")
final List<Handler> handlerChain = ep.getJaxwsBinding().getHandlerChain();
if (handlerChain != null && !handlerChain.isEmpty()) { //save
invoker = new JBossWSHandlerChainInvoker(handlerChain, isOutbound(message, ex));
ex.put(HandlerChainInvoker.class, invoker);
}
}
}
}
示例4: performInvocation
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
protected Object performInvocation(final Exchange exchange, final Object serviceObject,
final Method m, final Object[] paramArray) throws Exception {
InvocationContext invContext = exchange.get(InvocationContext.class);
invContext.setParameters(paramArray);
Object res = invContext.proceed();
EjbMessageContext ctx = (EjbMessageContext) invContext.getContextData();
Map<String, Object> handlerProperties = (Map<String, Object>) exchange
.get(HANDLER_PROPERTIES);
addHandlerProperties(ctx, handlerProperties);
updateWebServiceContext(exchange, ctx);
return res;
}
示例5: closeConduit
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
public static void closeConduit(Exchange exchange) throws IOException {
ConduitSelector conduitSelector = null;
synchronized (exchange) {
conduitSelector = exchange.get(ConduitSelector.class);
if (conduitSelector != null) {
exchange.remove(ConduitSelector.class.getName());
}
}
Conduit selectedConduit = null;
Message message = exchange.getInMessage() == null ? exchange
.getOutMessage() : exchange.getInMessage();
if (conduitSelector != null && message != null) {
selectedConduit = conduitSelector.selectConduit(message);
selectedConduit.close(message);
}
//TODO the line below was removed, check the impact on the protobuffer importer/exporter
//selectedConduit.close(message);
}
示例6: getServiceMethod
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
/**
* Extracts the Method that will be invoked by the service from the Message object
*
* @param message Message to extract the method from
* @return Method that will be invoked by the service from the Message object
*/
private Method getServiceMethod(Message message) {
Exchange exchange = message.getExchange();
BindingOperationInfo bindingOperationInfo = exchange.get(BindingOperationInfo.class);
MethodDispatcher methodDispatcher = (MethodDispatcher)
exchange.get(Service.class).get(MethodDispatcher.class.getName());
return methodDispatcher.getMethod(bindingOperationInfo);
}
示例7: getOutMessage
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private Message getOutMessage(Message inMessage) {
Exchange exchange = inMessage.getExchange();
Message outMessage = exchange.getOutMessage();
if (outMessage == null) {
Endpoint endpoint = exchange.get(Endpoint.class);
outMessage = endpoint.getBinding().createMessage();
exchange.setOutMessage(outMessage);
}
outMessage.putAll(inMessage);
return outMessage;
}
示例8: getConduit
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private Conduit getConduit(Message inMessage) throws IOException {
Exchange exchange = inMessage.getExchange();
EndpointReferenceType target = exchange.get(EndpointReferenceType.class);
Conduit conduit =
exchange.getDestination().getBackChannel(inMessage, null, target);
exchange.setConduit(conduit);
return conduit;
}
示例9: handleMessage
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
public void handleMessage(Message message) throws Fault {
Exchange ex = message.getExchange();
// This test verifies that the "to" endpoint is not the from endpoint.
Endpoint endpoint = ex.get(Endpoint.class);
if ("http://localhost:9003/CamelContext/RouterPort".equals(endpoint.getEndpointInfo().getAddress())) {
throw new Fault(new Exception("bad endpoint " + endpoint.getEndpointInfo().getAddress()));
}
}
示例10: handleMessage
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
public void handleMessage(XMLMessage message) throws Fault {
Exchange exchange = message.getExchange();
// TODO break out into a strategy (not JAXRS-specific)
OperationResourceInfo operationResourceInfo = exchange.get(OperationResourceInfo.class);
if (operationResourceInfo == null) {
message.getInterceptorChain().doIntercept(message);
return;
}
// TODO annotate with a better name?
String methodName = operationResourceInfo.getMethodToInvoke().getName();
// TODO annotate with a better name?
Object key = operationResourceInfo.getClassResourceInfo().getResourceProvider()
.getInstance();
if (!(key instanceof Timeable)) {
message.getInterceptorChain().doIntercept(message);
return;
}
EventMetricCollector collector = timer.getCollector();
collector.startTiming((Timeable) key, methodName);
try {
message.getInterceptorChain().doIntercept(message);
} finally {
collector.stopTiming();
}
}
示例11: performInvocation
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
/**
* This overrides org.apache.cxf.jaxws.AbstractInvoker in order for using the JBossWS integration logic
* to invoke the JBoss AS target bean.
*/
@Override
protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, Object[] paramArray)
throws Exception
{
Endpoint ep = exchange.get(Endpoint.class);
final InvocationHandler invHandler = ep.getInvocationHandler();
final Invocation inv = createInvocation(invHandler, serviceObject, ep, m, paramArray);
if (factory != null) {
inv.getInvocationContext().setProperty("forceTargetBean", true);
}
Bus threadBus = BusFactory.getThreadDefaultBus(false);
BusFactory.setThreadDefaultBus(disableDepUserDefThreadBus ? null : ep.getAttachment(Bus.class));
setNamespaceContextSelector(exchange);
ClassLoader cl = SecurityActions.getContextClassLoader();
SecurityActions.setContextClassLoader(serviceObject.getClass().getClassLoader());
try {
invHandler.invoke(ep, inv);
return inv.getReturnValue();
} finally {
SecurityActions.setContextClassLoader(cl);
//make sure the right bus is restored after coming back from the endpoint method
BusFactory.setThreadDefaultBus(threadBus);
clearNamespaceContextSelector(exchange);
}
}
示例12: getOutMessage
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
/**
* @param inMessage
* @return Message
*/
private Message getOutMessage(Message inMessage)
{
Exchange exchange = inMessage.getExchange();
Message outMessage = exchange.getOutMessage();
if (outMessage == null)
{
Endpoint endpoint = exchange.get(Endpoint.class);
outMessage = endpoint.getBinding().createMessage();
exchange.setOutMessage(outMessage);
}
outMessage.putAll(inMessage);
return outMessage;
}
示例13: invoke
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
protected Object invoke(final Exchange exchange, final Object serviceObject,
final Method m, final List<Object> params) {
final InvocationContext invContext = exchange.get(InvocationContext.class);
if (invContext == null) {
return preEjbInvoke(exchange, m, params);
}
return super.invoke(exchange, serviceObject, m, params);
}
示例14: invoke
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
public Object invoke(final Exchange exchange, final Object o) { // mainly a select the right invoker impl
final ClassResourceInfo cri = (ClassResourceInfo) exchange.get("root.resource.class");
if (cri != null) {
final String clazz = cri.getServiceClass().getName();
final EJBRestServiceInfo restServiceInfo = ejbs.get(clazz);
if (restServiceInfo != null && !BeanType.MANAGED.equals(restServiceInfo.context.getComponentType())) {
return ejbInvoker.invoke(exchange, o);
}
}
return jaxrsInvoker.invoke(exchange, o);
}
示例15: performFailover
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private boolean performFailover(Exchange exchange, InvocationContext invocation) {
Exception prevExchangeFault = (Exception) exchange.remove(Exception.class.getName());
Message outMessage = exchange.getOutMessage();
Exception prevMessageFault = outMessage.getContent(Exception.class);
outMessage.setContent(Exception.class, null);
overrideAddressProperty(invocation.getContext());
Retryable retry = exchange.get(Retryable.class);
exchange.clear();
boolean failover = false;
if (retry != null) {
try {
failover = true;
long delay = getDelayBetweenRetries();
if (delay > 0) {
Thread.sleep(delay);
}
Map<String, Object> context = invocation.getContext();
retry.invoke(invocation.getBindingOperationInfo(), invocation.getParams(), context,
exchange);
} catch (Exception e) {
if (exchange.get(Exception.class) != null) {
exchange.put(Exception.class, prevExchangeFault);
}
if (outMessage.getContent(Exception.class) != null) {
outMessage.setContent(Exception.class, prevMessageFault);
}
}
}
return failover;
}