Package com.volantis.mps.message

Examples of com.volantis.mps.message.MultiChannelMessage


     */
    public MessageRecipients send(MultiChannelMessage multiChannelMessage,
                    MessageRecipients messageRecipients,
                    MessageRecipient messageSender)
                        throws RecipientException, MessageException {
        MultiChannelMessage mcmClone = getCached(multiChannelMessage);
        if (mcmClone == null) {
            mcmClone = (MultiChannelMessage) multiChannelMessage.clone();
        }
        if (mcmClone != null) {
            try {
                mcmClone.addAttachments(
                        AttachmentUtilities.getAttachmentsForChannel(
                                getChannelName(),
                                MessageInternals.getAttachments(
                                        multiChannelMessage)));

View Full Code Here


        if (requestEncoding == null) {
            requestEncoding = "ISO-8859-1";
        }
        // Are we sending a URL or an XML message?
        String url = request.getParameter("url");
        MultiChannelMessage message = null;

        // Do we have an explicit charset encoding? Null values are allowed and
        // should result in device default charset being used. N.B. the "null"
        // string is sent by the form element when the user does not want to
        // specify a character encoding
        String characterSet = request.getParameter("charset");
        if (characterSet.equalsIgnoreCase("null")) {
            characterSet = null;
        }


        // do we need to generate and save the message to file
        boolean genMessage = false;
        if (request.getParameter("genMsg") != null &&
            request.getParameter("genMsg").equalsIgnoreCase("on")) {
            genMessage = true;
        }

        // get the subject
        String subject = request.getParameter("subject");
        if (characterSet != null) {
            subject = ContentUtilities.convertEncoding(
                    subject,
                    requestEncoding,
                    characterSet
            );
        }

        if (!(url.equals(""))) {
            message = new MultiChannelMessageImpl(new URL(url), subject, characterSet);
        } else {
            String xml = request.getParameter("xml");
            if (characterSet != null) {
                // convert from request char set to specified charset
                xml = ContentUtilities.convertEncoding(
                        xml,
                        requestEncoding,
                        characterSet
                );
            }
            message = new MultiChannelMessageImpl(xml, subject, characterSet);
        }

        try {
            message.addAttachments(getAttachments(request));
        } catch (Exception ee) {
            // log the fact that this failed and carry on.
            // Probably not the best thing to do...
            logger.error("Failed to attach attachments", ee);
        }
View Full Code Here

                        return !( paramString.startsWith ( "PhoneNumber=%2B44failure" ) );
                    }
                };

        // Create a test message
        MultiChannelMessage multiChannelMessage = new MultiChannelMessageImpl();
        // Unless overriding MultiChannelMessage#generateTargetMessageAsURL
        // then just use a URL based message for these tests otherwise it
        // will try and initialise a servlet and get very upset with life!
        multiChannelMessage.setMessageURL ( new URL ( "http://test.message/file" ) );
        multiChannelMessage.setSubject ( "Test Message" );

        // Create some recipients
        MessageRecipients messageRecipients = createTestRecipients ();

        // Create a sender
View Full Code Here

        NowSMSWAPPushChannelAdapter channel =
                ( NowSMSWAPPushChannelAdapter ) getTestInstance ();

        // Create a test MultiChannelMessage to return a URL without
        // trying to use a servlet or ...
        MultiChannelMessage multiChannelMessage = new MultiChannelMessageImpl () {
            public URL generateTargetMessageAsURL ( String deviceName,
                                                    String mssUrl )
                    throws MessageException {
                URL url = null;
                try {
View Full Code Here

        }

        // Get recipients
        final Map mpsRecipients = getRecipients(sendRequest.getRecipients());

        final MultiChannelMessage mcMessage =
                createMultiChannelMessage(sendRequest.getMessage());
        addRecipients(session, mpsRecipients);
        final MessageRecipient from = getSender(sendRequest.getSender());
        final MessageRecipients failures =
                sendMessage(session, mcMessage, from);
View Full Code Here

     */
    private MultiChannelMessage createMultiChannelMessage(Message message)
        throws MessageServiceException {
        try {

            MultiChannelMessage toBeSent = null;

            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Entered createMultiChannelMessage");
            }

            // A MultiChannelMessage expects content (XDIME to be
            // rendered by MCS) to be specified using either a URL or
            // a string representing the XDIME to be sent.  If the
            // given message has some content set then this will be
            // used in favour of a URL source.

            if (message.getContent() != null) {
                toBeSent = new MultiChannelMessageImpl();
                try {
                    toBeSent.setMessage(message.getContent());
                    toBeSent.setCharacterEncoding(message.getCharacterEncoding());
                    toBeSent.setSubject(message.getSubject());
                } catch (MessageException e) {
                    throw new MessageServiceException(e);
                }
            } else {
               toBeSent = new MultiChannelMessageImpl(
View Full Code Here

TOP

Related Classes of com.volantis.mps.message.MultiChannelMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.