Package javax.servlet.sip

Examples of javax.servlet.sip.ServletParseException


    private void trim(byte[] array, int offset, int length)
        throws ServletParseException {
        length += offset;

        if (length > array.length) {
            throw new ServletParseException("Illegal length");
        }

        byte whitespace = ' ';
        byte quote = '"';
        int slowPos = offset;
View Full Code Here


        }

        try {
            parse(uri, offset, uri.length());
        } catch (RuntimeException e) {
            throw new ServletParseException(
                "Unexpected exception while parsing URI: " + e);
        }
    }
View Full Code Here

        int endParamIndex = length;

        for (int i = offset; i < length; i++) {
            // Control character should not appear in the url.
            if (Character.isISOControl(str.charAt(i))) {
                throw new ServletParseException(
                    "The URI contains a control character.");
            }

            if (str.charAt(i) == ':' && semiIndex == -1 ) {
                if (atIndex > 0) {
                    portIndex = i;
                } else {
                    passwdIndex = i;
                }
            } else if ((atIndex == -1) && (str.charAt(i) == '@')) {
                atIndex = i;
            } else if ((semiIndex == -1) && (str.charAt(i) == ';')) {
                semiIndex = i;
                endHostIndex = i;
            } else if ((semiIndex != -1) && (str.charAt(i) == ';') && semiIndex < atIndex ) {
                semiIndex = i;
                endHostIndex = i;
            } else if (str.charAt(i) == '?') {
                qIndex = i;

                if (semiIndex > 0) {
                    endParamIndex = i;
                } else {
                    endHostIndex = i;
                }

                break;
            }
        }

        if ((passwdIndex > 0) && (atIndex < 0)) {
            portIndex = passwdIndex;
        }

        /*
         * INFO: The user part and parameter parts of the url, could contains
         * escaped characters, so we need to unecape them.
         */

        // Check user
        try {
            if (atIndex > 0) {
                if (passwdIndex > 0) {
                    _user = new Ascii7String(str.substring(offset,
                            passwdIndex));
                    _password = new Ascii7String(str.substring(passwdIndex + 1,
                            atIndex));
                } else {
                    _user = new Ascii7String(str.substring(offset, atIndex));
                }

                offset = atIndex + 1;
            }
 
            // Ex: "sip:+302106699011;tgrp=0;trunk-context=0@164.48.135.94:5060"
            if ( endHostIndex < offset ) {
                endHostIndex = str.length();
                String host = str.substring(offset, endHostIndex);
                int innerCheck =host.indexOf(":");
                if ( innerCheck != -1 )
                    portIndex = offset + innerCheck;
            }
            // Now the hostpart that is mandatory
            if (portIndex > 0) { // Host n port
                _host = new Ascii7String(str.substring(offset, portIndex));
                _port = Integer.parseInt(str.substring(portIndex + 1,
                        endHostIndex));
            } else { // no port only host
                _host = new Ascii7String(str.substring(offset,
                        endHostIndex));
            }
        } catch (IllegalStateException e) {
            throw new ServletParseException("CharacterCodingException");
        }

        offset = endHostIndex + 1;

        // Time for the parameters
View Full Code Here

        throws ServletParseException {
        if (name == null)
            throw new NullPointerException("Argument name is null");
        String pretty = Header.format(name);
        if (!ParameterableImpl.isParameterableHeader(pretty,null))
            throw new ServletParseException(" Header can not be parsed as Parameterable");
        Header parameterable = headerMap.get(pretty);

        if (parameterable == null) {
            return null;
        }
View Full Code Here

        String name) throws ServletParseException {
        if (name == null)
            throw new NullPointerException("Argument name is null");
        String pretty = Header.format(name);
        if (!ParameterableImpl.isParameterableHeader(pretty,null))
            throw new ServletParseException(" Header can not be parsed as Parameterable");
        boolean systemHeader = Header.isSystemHeader(pretty, this);

        if (headerMap.containsKey(pretty)) {
            return new SipListIterator<Parameterable>(headerMap.get(pretty)
                                                               .getParameterableValues(),
View Full Code Here

            }
        }

        if (((laquotIndex == -1) && (raquotIndex > 0)) ||
                ((laquotIndex > 0) && (raquotIndex == -1))) {
            throw new ServletParseException("invalid nr of > or <");
        }

        // TODO - Maybe a way to remove the trim()
        try {
            // Taking care of Display name
View Full Code Here

TOP

Related Classes of javax.servlet.sip.ServletParseException

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.