本文整理汇总了Java中org.apache.cxf.message.MessageUtils.getContextualBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java MessageUtils.getContextualBoolean方法的具体用法?Java MessageUtils.getContextualBoolean怎么用?Java MessageUtils.getContextualBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.message.MessageUtils
的用法示例。
在下文中一共展示了MessageUtils.getContextualBoolean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setProperty
import org.apache.cxf.message.MessageUtils; //导入方法依赖的package包/类
public void setProperty(String prop, Object value) {
if (prop.equals(JAXBDataBinding.UNWRAP_JAXB_ELEMENT)) {
unwrapJAXBElement = Boolean.TRUE.equals(value);
} else if (prop.equals(org.apache.cxf.message.Message.class.getName())) {
org.apache.cxf.message.Message m = (org.apache.cxf.message.Message)value;
veventHandler = (ValidationEventHandler)m.getContextualProperty("jaxb-validation-event-handler");
if (veventHandler == null) {
veventHandler = databinding.getValidationEventHandler();
}
setEventHandler = MessageUtils.getContextualBoolean(m, "set-jaxb-validation-event-handler", true);
Object unwrapProperty = m.get(JAXBDataBinding.UNWRAP_JAXB_ELEMENT);
if (unwrapProperty == null) {
unwrapProperty = m.getExchange().get(JAXBDataBinding.UNWRAP_JAXB_ELEMENT);
}
if (unwrapProperty != null) {
unwrapJAXBElement = Boolean.TRUE.equals(unwrapProperty);
}
}
}
示例2: handleMessage
import org.apache.cxf.message.MessageUtils; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage msg) throws Fault {
// noinspection ThrowableResultOfMethodCallIgnored
Fault fault = ((Fault) msg.getContent(Exception.class));
Throwable faultCause;
if (((faultCause = fault.getCause()) == null) || !MessageUtils.getContextualBoolean(msg, WsPropertyNames.ERROR_STACK_TRACE, false)) {
return;
}
Element faultDetailElem = fault.getOrCreateDetail();
Document faultDetailDoc = faultDetailElem.getOwnerDocument();
// noinspection ThrowableResultOfMethodCallIgnored
ValidationException faultValidationCause = SdcctExceptionUtils.findCause(faultCause, ValidationException.class);
if (faultValidationCause != null) {
try {
this.xmlCodec.encode(faultValidationCause.getResult(), new DOMResult(faultDetailElem), null);
} catch (Exception e) {
LOGGER.error("Unable to build SOAP Fault Detail validation result child element.", e);
}
}
Element faultDetailStacktraceElem =
faultDetailDoc.createElementNS(SdcctUris.SDCCT_WS_URN_VALUE, SdcctQnameUtils.buildQualifiedName(WsXmlQnames.STACK_TRACE));
faultDetailStacktraceElem
.appendChild(faultDetailDoc.createCDATASection((StringUtils.LF + SdcctExceptionUtils.buildRootCauseStackTrace(faultCause) + StringUtils.LF)));
faultDetailElem.appendChild(faultDetailStacktraceElem);
}
示例3: doProcessResponse
import org.apache.cxf.message.MessageUtils; //导入方法依赖的package包/类
private boolean doProcessResponse(Message message) {
// 1. Not oneWay
if (!isOneway(message.getExchange())) {
return true;
}
// 2. Context property
return MessageUtils.getContextualBoolean(message, Message.PROCESS_ONEWAY_RESPONSE, false);
}
示例4: toResponse
import org.apache.cxf.message.MessageUtils; //导入方法依赖的package包/类
@Override
public Response toResponse(Throwable exception) {
SdcctHttpStatus respStatus = SdcctHttpStatus.INTERNAL_SERVER_ERROR;
OperationOutcome opOutcome = null;
if (exception instanceof FhirWsException) {
FhirWsException wsException = ((FhirWsException) exception);
respStatus = wsException.getResponseStatus();
if (wsException.hasOperationOutcome()) {
opOutcome = wsException.getOperationOutcome();
}
}
if (opOutcome == null) {
opOutcome = new OperationOutcomeBuilder().build();
}
// noinspection ThrowableResultOfMethodCallIgnored
ValidationException validationCause = SdcctExceptionUtils.findCause(exception, ValidationException.class);
if (validationCause != null) {
for (ValidationIssue validationIssue : validationCause.getResult().getIssues().getIssues()) {
opOutcome.addIssues(buildValidationIssueSource(buildValidationIssueDetails(new OperationOutcomeIssueBuilder()
.setType(buildValidationIssueType(validationIssue.getType())).setSeverity(IssueSeverity.valueOf(validationIssue.getSeverity().name()))
.setLocation(buildValidationLocation(validationIssue.getLocation()))
.setDetails(OperationOutcomeType.MSG_ERROR_PARSING, validationIssue.getMessage()), validationIssue), validationIssue).build());
}
}
if (!opOutcome.hasIssues()) {
opOutcome.addIssues(new OperationOutcomeIssueBuilder().build());
}
if (MessageUtils.getContextualBoolean(JAXRSUtils.getCurrentMessage(), WsPropertyNames.ERROR_STACK_TRACE, false)) {
try {
opOutcome.setText(new NarrativeImpl()
.setDiv(new DivImpl().addContent(new String(
this.xmlCodec.encode(new PreImpl().addContent(SdcctExceptionUtils.buildRootCauseStackTrace(exception)), null), StandardCharsets.UTF_8)))
.setStatus(new NarrativeStatusComponentImpl().setValue(NarrativeStatus.ADDITIONAL)));
} catch (Exception e) {
LOGGER.error("Unable to encode FHIR operation outcome narrative.", e);
}
}
return Response.status(respStatus).entity(opOutcome).build();
}