本文整理了Java中org.fabric3.spi.container.invocation.Message.setBodyWithFault()
方法的一些代码示例,展示了Message.setBodyWithFault()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setBodyWithFault()
方法的具体详情如下:
包路径:org.fabric3.spi.container.invocation.Message
类名称:Message
方法名:setBodyWithFault
[英]Set the message body with a fault object. After this method is called, isFault() returns true.
[中]将消息正文设置为故障对象。调用此方法后,isFault()返回true。
代码示例来源:origin: com.carecon.fabric3/fabric3-pojo
/**
* Performs the invocation on the target component instance. If a target classloader is configured for the interceptor, it will be set as the TCCL.
*
* @param msg the messaging containing the invocation data
* @param instance the target component instance
* @return the response message
*/
private Message invoke(Message msg, Object instance) {
try {
Object body = msg.getBody();
if (targetTCCLClassLoader == null) {
msg.setBody(invoker.invoke(instance, body));
} else {
ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(targetTCCLClassLoader);
msg.setBody(invoker.invoke(instance, body));
} finally {
Thread.currentThread().setContextClassLoader(old);
}
}
} catch (InvocationTargetException e) {
msg.setBodyWithFault(e.getCause());
} catch (IllegalAccessException e) {
throw new InvocationRuntimeException(e);
}
return msg;
}
代码示例来源:origin: com.carecon.fabric3/fabric3-spring
msg.setBodyWithFault(cause);
} catch (IllegalAccessException e) {
throw new InvocationRuntimeException(e);
代码示例来源:origin: org.fabric3/fabric3-spring
msg.setBodyWithFault(cause);
} catch (IllegalAccessException e) {
throw new InvocationRuntimeException(e);
代码示例来源:origin: org.fabric3/fabric3-pojo
/**
* Performs the invocation on the target component instance. If a target classloader is configured for the interceptor, it will be set as the TCCL.
*
* @param msg the messaging containing the invocation data
* @param instance the target component instance
* @return the response message
*/
private Message invoke(Message msg, Object instance) {
try {
Object body = msg.getBody();
if (targetTCCLClassLoader == null) {
msg.setBody(invoker.invoke(instance, body));
} else {
ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(targetTCCLClassLoader);
msg.setBody(invoker.invoke(instance, body));
} finally {
Thread.currentThread().setContextClassLoader(old);
}
}
} catch (InvocationTargetException e) {
msg.setBodyWithFault(e.getCause());
} catch (IllegalAccessException e) {
throw new InvocationRuntimeException(e);
}
return msg;
}
代码示例来源:origin: com.carecon.fabric3/fabric3-binding-jms
if (resultMessage.getBooleanProperty(JmsRuntimeConstants.FAULT_HEADER)) {
Object payload = MessageHelper.getPayload(resultMessage, payloadTypes.getFaultType());
message.setBodyWithFault(payload);
} else {
Object payload = MessageHelper.getPayload(resultMessage, payloadTypes.getOutputType());
代码示例来源:origin: com.carecon.fabric3/fabric3-system
public Message invoke(Message msg) {
Object body = msg.getBody();
Object instance;
try {
instance = component.getInstance();
} catch (Fabric3Exception e) {
throw new InvocationRuntimeException(e);
}
try {
msg.setBody(operation.invoke(instance, (Object[]) body));
} catch (InvocationTargetException e) {
msg.setBodyWithFault(e.getCause());
} catch (IllegalAccessException e) {
throw new InvocationRuntimeException(e);
} finally {
try {
component.releaseInstance(instance);
} catch (Fabric3Exception e) {
throw new InvocationRuntimeException(e);
}
}
return msg;
}
}
代码示例来源:origin: com.carecon.fabric3/fabric3-binding-ws
msg.setBodyWithFault(e.getTargetException());
return msg;
代码示例来源:origin: org.fabric3/fabric3-binding-ws-metro
msg.setBodyWithFault(e.getTargetException());
return msg;
代码示例来源:origin: org.fabric3/fabric3-fabric
private Message transformOutput(Message ret) {
// FIXME For exception transformation, if it is checked convert as application fault
Object body = ret.getBody();
// TODO handle null types
if (body != null) {
try {
Object transformed = outTransformer.transform(body, outLoader);
if (ret.isFault()) {
ret.setBodyWithFault(transformed);
} else {
ret.setBody(transformed);
}
} catch (ClassCastException e) {
// an unexpected type was returned by the target service or an interceptor later in the chain. This is an error in the extension or
// interceptor and not user code since errors should be trapped and returned in the format expected by the transformer
if (body instanceof Throwable) {
throw new ServiceRuntimeException("Unexpected exception returned", (Throwable) body);
} else {
throw new ServiceRuntimeException("Unexpected type returned: " + body.getClass());
}
} catch (Fabric3Exception e) {
throw new ServiceRuntimeException(e);
}
}
return ret;
}
代码示例来源:origin: com.carecon.fabric3/fabric3-fabric
private Message transformOutput(Message ret) {
// FIXME For exception transformation, if it is checked convert as application fault
Object body = ret.getBody();
// TODO handle null types
if (body != null) {
try {
Object transformed = outTransformer.transform(body, outLoader);
if (ret.isFault()) {
ret.setBodyWithFault(transformed);
} else {
ret.setBody(transformed);
}
} catch (ClassCastException e) {
// an unexpected type was returned by the target service or an interceptor later in the chain. This is an error in the extension or
// interceptor and not user code since errors should be trapped and returned in the format expected by the transformer
if (body instanceof Throwable) {
throw new ServiceRuntimeException("Unexpected exception returned", (Throwable) body);
} else {
throw new ServiceRuntimeException("Unexpected type returned: " + body.getClass());
}
} catch (Fabric3Exception e) {
throw new ServiceRuntimeException(e);
}
}
return ret;
}
内容来源于网络,如有侵权,请联系作者删除!