public void setContentType(String type) { message.setProperty(HttpConstants.HEADER_CONTENT_TYPE, type, PropertyScope.OUTBOUND); }
public void enrich(String expression, MuleMessage message, Object object) { message.setProperty(expression, object, PropertyScope.INVOCATION); }
protected void preRouteMessage(MuleMessage message) throws MessagingException { message.setProperty(MuleProperties.MULE_REMOTE_CLIENT_ADDRESS, remoteClientAddress, PropertyScope.INBOUND); }
protected void setPropertiesFromFile(MuleMessage message, File file) { message.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, file.getName(), PropertyScope.INBOUND); message.setProperty(FileConnector.PROPERTY_DIRECTORY, file.getParent(), PropertyScope.INBOUND); message.setProperty(FileConnector.PROPERTY_FILE_SIZE, file.length(), PropertyScope.INBOUND); message.setProperty(FileConnector.PROPERTY_FILE_TIMESTAMP, file.lastModified(), PropertyScope.INBOUND); } }
@Override public void set(String key, String value) { event.getMessage().setProperty(key, value, PropertyScope.INBOUND); } }
@Override protected MuleEvent createMuleEvent(MuleMessage message, OutputStream outputStream) throws MuleException { if (isStateful) { // Forces synchronous processing for the generated event message.setProperty(MuleProperties.MULE_FORCE_SYNC_PROPERTY, Boolean.TRUE, PropertyScope.INBOUND); } return super.createMuleEvent(message, outputStream); }
public void enrich(String expression, MuleMessage message, Object object) { String propertyName = expression; PropertyScope scope = ExpressionUtils.getScope(expression); if (scope != null) { // cut-off leading scope and separator propertyName = expression.substring(scope.getScopeName().length() + 1); } else { // default scope = PropertyScope.OUTBOUND; } message.setProperty(propertyName, object, scope); }
private void copySubject(Message xmppMessage, MuleMessage muleMessage) { String subject = xmppMessage.getSubject(); if (StringUtils.isNotEmpty(subject)) { muleMessage.setProperty(XmppConnector.XMPP_SUBJECT, subject, PropertyScope.INBOUND); } }
private HttpConnectorDelegate(MuleEvent event) { //Query parameters are immutable so we copy them and change the query parameters map. this.parameters = new HashMap(((HttpParameters) event.getMessage().getInboundProperty(HTTP_QUERY_PARAMS))); event.getMessage().setProperty(HTTP_QUERY_PARAMS, this.parameters, PropertyScope.INBOUND); }
@Override public MuleEvent process(MuleEvent event) throws MuleException { MuleEvent result = super.process(event); if (result != null && !VoidMuleEvent.getInstance().equals(result)) { result.getMessage().setProperty(CHANNEL.CALL_URI_PROPERTY, result.getMessageSourceURI().toString(), PropertyScope.OUTBOUND); } return result; } }
private void moveAndDelete(final File sourceFile, File destinationFile, String originalSourceFileName, String originalSourceDirectory, MuleMessage message) throws MuleException { // If we are moving the file to a read directory, move it there now and // hand over a reference to the // File in its moved location if (destinationFile != null) { // move sourceFile to new destination try { FileUtils.moveFile(sourceFile, destinationFile); } catch (IOException e) { // move didn't work - bail out (will attempt rollback) throw new DefaultMuleException(FileMessages.failedToMoveFile( sourceFile.getAbsolutePath(), destinationFile.getAbsolutePath())); } // create new Message for destinationFile message = createMuleMessage(destinationFile, endpoint.getEncoding()); message.setProperty(FileConnector.PROPERTY_FILENAME, destinationFile.getName(), PropertyScope.INBOUND); message.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, originalSourceFileName, PropertyScope.INBOUND); message.setProperty(FileConnector.PROPERTY_ORIGINAL_DIRECTORY, originalSourceDirectory, PropertyScope.INBOUND); } // finally deliver the file message this.routeMessage(message); }
protected void renameInScope(String oldKey, String newKey, PropertyScope propertyScope, MuleMessage message) { Object propValue = message.getProperty(oldKey, propertyScope); DataType<?> propertyDataType = message.getPropertyDataType(oldKey, propertyScope); message.removeProperty(oldKey, propertyScope); message.setProperty(newKey, propValue, propertyScope, propertyDataType); }
@Override protected MuleEvent processResponse(MuleEvent response, final MuleEvent request) throws MuleException { // Ensure that the http.status code inbound property (if present) is a String. Object statusCode = response.getMessage().getInboundProperty(HttpConnector.HTTP_STATUS_PROPERTY, null); if (statusCode != null && !(statusCode instanceof String)) { response.getMessage().setProperty(HttpConnector.HTTP_STATUS_PROPERTY, statusCode.toString(), PropertyScope.INBOUND); } return super.processResponse(response, request); } };
@Override public Object put(String key, Object value) { if (PropertyScope.INBOUND.equals(propertyScope)) { throw new UnsupportedOperationException(CoreMessages.inboundMessagePropertiesImmutable(key) .getMessage()); } else { Object previousValue = get(key); message.setProperty(key, value, propertyScope); return previousValue; } }
public MuleEvent process(MuleEvent event) throws MuleException { // If the endpoint has a logical name, use it, otherwise use the URI. String inboundEndpoint = endpoint.getName(); if (StringUtils.isBlank(inboundEndpoint)) { // URI inboundEndpoint = endpoint.getEndpointURI().getUri().toString(); } event.getMessage().setProperty(MuleProperties.MULE_ORIGINATING_ENDPOINT_PROPERTY, inboundEndpoint, PropertyScope.INBOUND); return event; }
@Override protected boolean doPropagate(MuleMessage message, TypedValue typedValue, ASTNode node) { if (node instanceof AssignmentNode) { PropertyScope scope = null; String assignmentVar = ((AssignmentNode) node).getAssignmentVar(); if (message.getPropertyNames(PropertyScope.INVOCATION).contains(assignmentVar)) { scope = PropertyScope.INVOCATION; } else if (message.getPropertyNames(PropertyScope.SESSION).contains(assignmentVar)) { scope = PropertyScope.SESSION; } if (scope != null) { message.setProperty(assignmentVar, typedValue.getValue(), scope, typedValue.getDataType()); return true; } } return false; } }
@Override protected MuleMessage createMessageFromSource(Object message) throws MuleException { MuleMessage muleMessage = super.createMessageFromSource(message); String contextPath = HttpConnector.normalizeUrl(getInboundEndpoint().getEndpointURI().getPath()); muleMessage.setProperty(HttpConnector.HTTP_CONTEXT_PATH_PROPERTY, contextPath, PropertyScope.INBOUND); return muleMessage; }
protected void processHttpRequest(HttpServletRequest request, HttpServletResponse response, MessageReceiver receiver) throws Exception { MuleMessage requestMessage = receiver.createMuleMessage(request); requestMessage.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, request.getMethod(), PropertyScope.INBOUND); setupRequestMessage(request, requestMessage, receiver); MuleEvent event = routeMessage(receiver, requestMessage, request); MuleMessage result = !receiver.getEndpoint().getExchangePattern().hasResponse() || event == null ? null : event.getMessage(); writeResponse(response, result); }
/** * Performs a synchronous action on the BPMS. * * @return an object representing the new state of the process */ @Override public MuleMessage doSend(MuleEvent event) throws Exception { Object process = processAction(event); if (process != null) { MuleMessage msg = new DefaultMuleMessage(process, connector.getMuleContext()); msg.setProperty(Process.PROPERTY_PROCESS_ID, connector.getBpms().getId(process), PropertyScope.SESSION); return msg; } else { throw new DispatchException( MessageFactory.createStaticMessage("Synchronous process invocation must return the new process state."), event, this); } }
if (contentType == null) message.setProperty(MuleProperties.CONTENT_TYPE_PROPERTY, endpointMimeType, PropertyScope.OUTBOUND);