Package flex.messaging

Examples of flex.messaging.MessageException


            throttleResult = dest.getThrottleManager().throttleIncomingMessage(message);
        else
            throttleResult = new ThrottleResult(ThrottleResult.RESULT_OK);

        int throttleResultCode = throttleResult.getResultCode();
        MessageException me = throttleResult.getException();
        if (throttleResultCode == ThrottleResult.RESULT_ERROR)
        {
            throw me;
        }
        else if (throttleResultCode == ThrottleResult.RESULT_IGNORE)
        {
            if (Log.isDebug())
                Log.getLogger(LOG_CATEGORY).debug(me.getMessage(), me);
        }
        else
        {
            // Block any sent messages that have a subtopic header containing
            // wildcards - wildcards are only supported in subscribe/unsubscribe
View Full Code Here


                FlexContext.setMessageRoutedNotifier(routingNotifier);

                // Throttle outgoing at the destination level
                ThrottleResult throttleResult = destination.getThrottleManager().throttleOutgoingMessage(message, null);
                int throttleResultCode = throttleResult.getResultCode();
                MessageException me = throttleResult.getException();
                if (throttleResultCode == ThrottleResult.RESULT_ERROR)
                {
                    throw me;
                }
                else if (throttleResultCode == ThrottleResult.RESULT_IGNORE)
                {
                    if (Log.isDebug())
                        Log.getLogger(LOG_CATEGORY).debug(me.getMessage(), me);
                }
                else
                {
                    SubscriptionManager subscriptionManager = destination.getSubscriptionManager();
View Full Code Here

        {
            // Throttle at client level.
            throttleResult = destination.getThrottleManager().throttleOutgoingMessage(message, client.getClientId());

            int throttleResultCode = throttleResult.getResultCode();
            MessageException me = throttleResult.getException();
            if (throttleResultCode == ThrottleResult.RESULT_ERROR)
            {
                // Log these, but they are not propagated to subscriber, as that would defeat
                // the purpose of throttling outbound messages to that subscriber client
                Log.getLogger(LOG_CATEGORY).error(me.getMessage(), me);
            }
            else if (throttleResultCode == ThrottleResult.RESULT_IGNORE)
            {
                if (Log.isDebug())
                    Log.getLogger(LOG_CATEGORY).debug(me.getMessage(), me);
            }
            else
            {
                // Push the message.
                try
View Full Code Here

        }
        contextIndex = url.indexOf(CONTEXT_PATH_TOKEN);

        if ((contextPath == null) && (contextIndex != -1))
        {
            MessageException me = new MessageException();
            if (FlexContext.getHttpRequest() == null)
                me.setMessage(TOKEN_NOT_SUPPORTED, "0", new Object[] {token});
            else
                me.setMessage(TOKEN_NOT_SUPPORTED, new Object[] {token});
            throw me;
        }
        else if (contextPath != null)
        {
            if (contextIndex == 0)
View Full Code Here

        }

        serverNameIndex = url.indexOf(SERVER_NAME_TOKEN);
        if ((serverName == null) && (serverNameIndex != -1))
        {
            MessageException me = new MessageException();
            me.setMessage(TOKEN_NOT_SUPPORTED, new Object[] {token});
            throw me;
        }
        else if ((serverName != null) && (serverNameIndex != -1))
        {
            url = StringUtils.substitute(url, SERVER_NAME_TOKEN, serverName);
        }

        token = SERVER_PORT_TOKEN;
        int serverPortIndex = url.indexOf(SERVER_PORT_ALT_TOKEN);
        if (serverPortIndex != -1)
        {
            token = SERVER_PORT_ALT_TOKEN;
            url = StringUtils.substitute(url, SERVER_PORT_ALT_TOKEN, SERVER_PORT_TOKEN);
        }

        serverPortIndex = url.indexOf(SERVER_PORT_TOKEN);
        if ((serverPort == null) && (serverPortIndex != -1))
        {
            MessageException me = new MessageException();
            me.setMessage(TOKEN_NOT_SUPPORTED, new Object[] {token});
            throw me;
        }
        else if ((serverPort != null) && (serverPortIndex != -1))
        {
            url = StringUtils.substitute(url, SERVER_PORT_TOKEN, serverPort);
View Full Code Here

            }

            serverPortIndex = url.indexOf(SERVER_PORT_TOKEN);
            if (serverPortIndex != -1)
            {
                MessageException me = new MessageException();
                me.setMessage(TOKEN_NOT_SUPPORTED_ANY, new Object[] {token});
                throw me;
            }

            if (url.indexOf(SERVER_NAME_ALT_TOKEN) != 0)
            {
                StringUtils.substitute(url, SERVER_NAME_ALT_TOKEN, SERVER_NAME_TOKEN);
            }

            if (url.indexOf(SERVER_NAME_TOKEN) != 0)
            {

                try
                {
                    addLocalServerURL(url, "localhost", newURLs);
                    addLocalServerURL(url, "127.0.0.1", newURLs);
                    addLocalServerURL(url, "[::1]", newURLs); // for IPv6
                   
                    InetAddress local  = InetAddress.getLocalHost();
                    addInetAddress(local, url, newURLs);

                    // if we're using JDK 1.4 or higher, we use NetworkInterface to get the list of hostnames
                    // and IP addresses.
                    Enumeration e = NetworkInterface.getNetworkInterfaces();
                    while (e.hasMoreElements())
                    {
                        NetworkInterface address = (NetworkInterface)e.nextElement();
                        Enumeration e2 = (Enumeration)address.getInetAddresses();
                        while (e2.hasMoreElements())
                        {
                            local = (InetAddress) e2.nextElement();
                            addInetAddress(local, url, newURLs);
                        }
                    }
                }
                catch(Exception e)
                {
                    MessageException me = new MessageException();
                    me.setMessage(PARSE_ERROR_DYNAMIC_URL);
                    throw me;
                }
            }
            else {
                addParsedURL(url, newURLs);
View Full Code Here

                return Class.forName(type, true, loader);
        }
        catch (ClassNotFoundException cnf)
        {
            // Cannot invoke type '{type}'
            MessageException ex = new MessageException();
            ex.setMessage(TYPE_NOT_FOUND, new Object[] {type});
            ex.setDetails(TYPE_NOT_FOUND, "0", new Object[] {type});
            ex.setCode(MessageException.CODE_SERVER_RESOURCE_UNAVAILABLE);
            throw ex;
        }
    }
View Full Code Here

            Object instance = cls.newInstance();

            if (expectedInstance != null && !expectedInstance.isInstance(instance))
            {
                // Given type '{name}' is not of expected type '{expectedName}'.
                MessageException ex = new MessageException();
                ex.setMessage(UNEXPECTED_TYPE, new Object[] {instance.getClass().getName(), expectedInstance.getName()});
                ex.setCode(MessageException.CODE_SERVER_RESOURCE_UNAVAILABLE);
                throw ex;
            }

            return instance;
        }
        catch (IllegalAccessException ia)
        {
            boolean details = false;
            StringBuffer message = new StringBuffer("Unable to create a new instance of type ");
            message.append(type);

            //Look for a possible cause...

            // Class might not have a suitable constructor?
            if (!hasValidDefaultConstructor(cls))
            {
                details = true;
            }

            // Unable to create a new instance of type '{type}'.
            MessageException ex = new MessageException();
            ex.setMessage(CANNOT_CREATE_TYPE, new Object[] {type});
            if (details)
            {
                //Types must have a public, no arguments constructor
                ex.setDetails(CANNOT_CREATE_TYPE, "0");
            }
            ex.setCode(MessageException.CODE_SERVER_RESOURCE_UNAVAILABLE);
            throw ex;
        }
        catch (InstantiationException ine)
        {
            String variant = null;

            //Look for a possible cause...
            if (cls != null)
            {
                // Class is really an interface?
                if (cls.isInterface())
                {
                    // Interfaces cannot be instantiated.
                    variant = "1";
                }
                else if (isAbstract(cls))
                {
                    //Abstract types cannot be instantiated.
                    variant = "2";
                }
                // Class might not have a suitable constructor?
                else if (!hasValidDefaultConstructor(cls))
                {
                    // Types cannot be instantiated without a public, no arguments constructor.
                    variant = "3";
                }
            }

            MessageException ex = new MessageException();
            ex.setMessage(CANNOT_CREATE_TYPE, new Object[] {type});
            if (variant != null)
                ex.setDetails(CANNOT_CREATE_TYPE, variant);
            ex.setCode(MessageException.CODE_SERVER_RESOURCE_UNAVAILABLE);
            throw ex;
        }
        catch (SecurityException se)
        {
            MessageException ex = new MessageException();
            ex.setMessage(SECURITY_ERROR, new Object[] {type});
            ex.setCode(MessageException.CODE_SERVER_RESOURCE_UNAVAILABLE);
            ex.setRootCause(se);
            throw ex;
        }
        catch (Exception e)
        {
            MessageException ex = new MessageException();
            ex.setMessage(UNKNOWN_ERROR, new Object[] {type});
            ex.setCode(MessageException.CODE_SERVER_RESOURCE_UNAVAILABLE);
            ex.setRootCause(e);
            throw ex;
        }
    }
View Full Code Here

                                + destinationJndiName +"' is using async message receiver.");
                }
                catch (JMSException jmsEx)
                {
                    // JMS consumer for JMS destination ''{0}'' is configured to use async message receiver but the application server does not allow ''{1}'' call used in async message receiver. Please switch to sync message receiver.
                    MessageException me = new MessageException();
                    me.setMessage(JMSConfigConstants.ASYNC_MESSAGE_DELIVERY_NOT_SUPPORTED, new Object[] {destinationJndiName, restrictedMethod});
                    throw me;
                }
            }
            else if (messageReceiver instanceof SyncMessageReceiver)
            {
View Full Code Here

    }
        catch (Exception e) {
          e.printStackTrace();// TODO
          String msg=e.getMessage();
         
          MessageException me = new MessageException(Caster.toClassName(e) + " : " + msg);
          me.setRootCause(e);
            me.setCode("Server.Processing");
            me.setRootCause(e);
           
            if(e instanceof PageException){
              PageException pe=(PageException) e;
              me.setDetails(pe.getDetail());
              me.setMessage(pe.getMessage());
              me.setCode(pe.getErrorCode());
            }
           
            throw me;
    }
    }
View Full Code Here

TOP

Related Classes of flex.messaging.MessageException

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.