private void copyProperties(Context context, Exchange exchange) { for (Property property : context.getProperties()) { if (property.hasLabel(BehaviorLabel.TRANSIENT.label()) || ContextPropertyUtil.isReservedProperty(property.getName(), property.getScope())) { continue; } if (Scope.EXCHANGE.equals(property.getScope())) { exchange.setProperty(property.getName(), property.getValue()); } else { exchange.getIn().setHeader(property.getName(), property.getValue()); } } }
StringBuffer headers = new StringBuffer(); for (Property property : context.getProperties(Scope.MESSAGE)) { if (property.hasLabel(EndpointLabel.HTTP.label()) && (property.getValue() instanceof String)) { headers.append(property.getName()); headers.append("="); headers.append(property.getValue()); return ((HttpRequestInfo)prop.getValue()).toString(); prop = context.getProperty("Content-type"); String contentType = (prop == null) ? null : (String)prop.getValue(); if (contentType != null) { if (contentType.contains("text/plain")) {
@Override @SuppressWarnings("unchecked") public <T> T getPropertyValue(String name) { Property prop = _properties.get(name); if (prop != null) { return (T) prop.getValue(); } return null; }
@Override public void handleMessage(Exchange exchange) throws TransactionFailureException { // if no TM is available, there's nothing to do if (_transactionManager == null) { return; } Property prop = exchange.getContext().getProperty(BEFORE_INVOKED_PROPERTY, Scope.EXCHANGE); if (prop != null && Boolean.class.cast(prop.getValue())) { // OUT phase in IN_OUT exchange or 2nd invocation in IN_ONLY exchange handleAfter(exchange); } else { exchange.getContext().setProperty(BEFORE_INVOKED_PROPERTY, Boolean.TRUE, Scope.EXCHANGE).addLabels(BehaviorLabel.TRANSIENT.label()); handleBefore(exchange); } }
@Override public void onMessage(String name) { if (!name.equals("onMessagetest")) { throw new RuntimeException("expected content is 'onMessagetest' but was '" + name + "'"); } final String val = _context.getProperty("testProp").getValue().toString(); if (!val.equals("testVal")) { throw new RuntimeException("'testProp' property is '" + val + "' while it should be 'testVal'"); }; Property jmsMessageId = _context.getProperty(JMSContextMapper.HEADER_JMS_MESSAGE_ID); if (jmsMessageId == null) { throw new RuntimeException("Couldn't find javax.jms.JMSMessageID context property"); } if (!jmsMessageId.hasLabel(PropertyLabel.HEADER.label())) { throw new RuntimeException("javax.jmsJMSMessageID context property doesn't have HEADER label"); } if (jmsMessageId.getValue().toString() == null) { throw new RuntimeException("javax.jmsJMSMessageID context property has null value"); }; _storeResult.onMessage(name); }
@Override public Set<Property> getProperties(String label) { Set<Property> properties = new HashSet<Property>(); for (Property property : getProperties()) { if (property.hasLabel(label)) { properties.add(property); } } return properties; }
@Override public void removeProperty(Property property) { for (Entry<Scope, Context> entry : _contexts.entrySet()) { if (entry.getKey() == property.getScope()) { entry.getValue().removeProperty(property); } } }
Map<String, List<String>> httpHeaders = target.getHeaders(); for (Property property : context.getProperties()) { String name = property.getName(); Object value = property.getValue(); if ((value != null) && (matches(name) || property.hasLabel(EndpointLabel.HTTP.label()))) { if (HTTP_RESPONSE_STATUS.equals(name)) { target.setStatusCode((Integer)property.getValue()); } else { if (value instanceof List) {
@Override @SuppressWarnings("unchecked") public <T> T getPropertyValue(String name) { Property prop = _properties.get(name); if (prop != null) { return (T) prop.getValue(); } return null; }
private void copySOAPHeadersToContext(Context context, String name, Object value) { if (matches(name, getIncludeRegexes(), new ArrayList<Pattern>())) { context.setProperty(name, value, Scope.EXCHANGE).addLabels(SOAP_HEADER_LABELS); } }
if (target instanceof HttpResponseBindingData) { Property responseCode = exchange.getContext().getProperty(HttpContextMapper.HTTP_RESPONSE_STATUS); if (!((responseCode != null) && responseCode.hasLabel(EndpointLabel.HTTP.label()))) { int status = HttpServletResponse.SC_ACCEPTED; if (exchange.getState() == ExchangeState.FAULT) { } else { if (exchange.getContext().getProperty(SERVICE_REFERENCE_PROPERTY) != null) { ServiceDomain domain = ((ServiceReference)exchange.getContext().getProperty(SERVICE_REFERENCE_PROPERTY).getValue()).getDomain(); TransformerRegistry registry = domain.getTransformerRegistry(); QName from = JavaTypes.toMessageType(content.getClass());