/** * Copies the subject from a message to another message * * @param from the message with the subject * @param to the message to which the subject is added * @throws MessagingException if an attachment could not be added */ public static void copySecuritySubject(NormalizedMessage from, NormalizedMessage to) throws MessagingException { to.setSecuritySubject(from.getSecuritySubject()); }
private static void copySubject(NormalizedMessage from, NormalizedMessage to) { to.setSecuritySubject(from.getSecuritySubject()); }
public static void transfer(NormalizedMessage source, NormalizedMessage dest) throws MessagingException { dest.setContent(source.getContent()); for (Iterator it = source.getPropertyNames().iterator(); it.hasNext();) { String name = (String) it.next(); dest.setProperty(name, source.getProperty(name)); } for (Iterator it = source.getAttachmentNames().iterator(); it.hasNext();) { String name = (String) it.next(); dest.addAttachment(name, source.getAttachment(name)); } dest.setSecuritySubject(source.getSecuritySubject()); }
public static void transfer(NormalizedMessage source, NormalizedMessage dest) throws MessagingException { dest.setContent(source.getContent()); for (Iterator it = source.getPropertyNames().iterator(); it.hasNext();) { String name = (String) it.next(); dest.setProperty(name, source.getProperty(name)); } for (Iterator it = source.getAttachmentNames().iterator(); it.hasNext();) { String name = (String) it.next(); dest.addAttachment(name, source.getAttachment(name)); } dest.setSecuritySubject(source.getSecuritySubject()); }
public MessageExchange createExchange(HttpServletRequest request) throws Exception { MessageExchange me = marshaler.createExchange(request, getContext()); if (me.getEndpoint() == null) { configureExchangeTarget(me); } // If the user has been authenticated, put these informations on // the in NormalizedMessage. if (request.getUserPrincipal() instanceof JaasJettyPrincipal) { Subject subject = ((JaasJettyPrincipal) request.getUserPrincipal()).getSubject(); me.getMessage("in").setSecuritySubject(subject); } return me; }
public void copyFromCamelToJbi(Message message, NormalizedMessage normalizedMessage) throws MessagingException { if (message != null && message.getBody() != null) { Source body = message.getBody(Source.class); if (body == null) { logger.warn("Unable to convert message body of type {} into an XML Source", message.getBody().getClass()); } else { normalizedMessage.setContent(body); } } Subject securitySubject = getSecuritySubject(message); if (securitySubject != null) { normalizedMessage.setSecuritySubject(securitySubject); } Exchange exchange = message.getExchange(); for (Map.Entry<String, Object> entry : message.getHeaders().entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); if (value != null && !strategies.applyFilterToCamelHeaders(key, value, exchange)) { normalizedMessage.setProperty(key, value); } } for (String id : message.getAttachmentNames()) { normalizedMessage.addAttachment(id, message.getAttachment(id)); } }
private void propagateSubject(MessageExchange exchange) { NormalizedMessage msg; if (exchange instanceof InOnly) { msg = ((InOnly) exchange).getInMessage(); } else if (exchange instanceof InOut) { msg = ((InOut) exchange).getInMessage(); } else { throw new RuntimeException("Unable to determine message type to propagate subject: " + exchange.getClass().getName()); } if (msg.getSecuritySubject() == null && JBIContext.getMessageExchange() != null && JBIContext.getMessageExchange().getMessage("in") != null) { msg.setSecuritySubject(JBIContext.getMessageExchange().getMessage("in").getSecuritySubject()); } } }
/** * If enabled the properties and attachments are copied to the destination message */ protected void copyPropertiesAndAttachments(NormalizedMessage source, NormalizedMessage dest) throws Exception { if (isCopyProperties()) { for (Iterator it = source.getPropertyNames().iterator(); it.hasNext();) { String name = (String) it.next(); dest.setProperty(name, source.getProperty(name)); } } if (isCopyAttachments()) { for (Iterator it = source.getAttachmentNames().iterator(); it.hasNext();) { String name = (String) it.next(); dest.addAttachment(name, source.getAttachment(name)); } } if (isCopySubject()) { dest.setSecuritySubject(source.getSecuritySubject()); } }
nm.setSecuritySubject(message.get(Subject.class));
nm.setSecuritySubject(message.get(Subject.class));
fake.setSecuritySubject(concrete.getSecuritySubject());
concrete.setSecuritySubject(fake.getSecuritySubject());
NormalizedMessage oldMsg = (oldMe != null) ? oldMe.getMessage("in") : null; if (oldMsg != null) { msg.setSecuritySubject(oldMsg.getSecuritySubject());