Add the ability to set HTTP code status and rest entity when restbc received a fault message exchange
parent
79c198c516
commit
05c505e131
|
@ -50,6 +50,7 @@ import com.sun.jbi.restbc.jbiadapter.util.PathUtil;
|
||||||
import com.sun.jbi.restbc.jbiadapter.util.PropertiesUtil;
|
import com.sun.jbi.restbc.jbiadapter.util.PropertiesUtil;
|
||||||
import com.sun.jbi.restbc.jbiadapter.wsdl.RestOperation;
|
import com.sun.jbi.restbc.jbiadapter.wsdl.RestOperation;
|
||||||
import com.sun.jersey.api.uri.UriTemplate;
|
import com.sun.jersey.api.uri.UriTemplate;
|
||||||
|
import javax.jbi.messaging.Fault;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* InboundDelegator.java
|
* InboundDelegator.java
|
||||||
|
@ -285,12 +286,27 @@ public class InboundDelegator {
|
||||||
} else if (msgEx instanceof InOut) {
|
} else if (msgEx instanceof InOut) {
|
||||||
InOut inout = (InOut) msgEx;
|
InOut inout = (InOut) msgEx;
|
||||||
if (inout.getStatus() == ExchangeStatus.ACTIVE) {
|
if (inout.getStatus() == ExchangeStatus.ACTIVE) {
|
||||||
ResponseBuilder responseBuilder = Response.ok();
|
ResponseBuilder responseBuilder;
|
||||||
|
NormalizedMessage replyMsg;
|
||||||
|
|
||||||
|
// https://openesb.atlassian.net/browse/ESBCOMP-24
|
||||||
|
// When we have a fault, set the response using the status code
|
||||||
|
// and use the fault message to set the payload of the response
|
||||||
|
if (inout.getOutMessage() != null) {
|
||||||
|
responseBuilder = Response.ok();
|
||||||
|
replyMsg = inout.getOutMessage();
|
||||||
|
} else {
|
||||||
|
// TODO: Be able to map fault with HTTP error code
|
||||||
|
|
||||||
|
// By default, set HTTP error code to 500
|
||||||
|
// Can be modified using status NM property
|
||||||
|
responseBuilder = Response.serverError();
|
||||||
|
replyMsg = inout.getFault();
|
||||||
|
}
|
||||||
|
|
||||||
NormalizedMessage replyMsg = inout.getOutMessage();
|
|
||||||
Object responsePayload = JbiMessageUtil.getPayloadFromWrappedMsg(replyMsg);
|
Object responsePayload = JbiMessageUtil.getPayloadFromWrappedMsg(replyMsg);
|
||||||
|
|
||||||
boolean isContentTypeSet = false;
|
boolean isContentTypeSet = false;
|
||||||
|
|
||||||
if (responsePayload != null) { // NOI18N
|
if (responsePayload != null) { // NOI18N
|
||||||
if (responsePayload instanceof Source) {
|
if (responsePayload instanceof Source) {
|
||||||
Source xmlPayload = (Source) responsePayload;
|
Source xmlPayload = (Source) responsePayload;
|
||||||
|
|
Loading…
Reference in New Issue