Package javax.servlet.sip

Examples of javax.servlet.sip.ServletParseException


      {
        name  = param.substring(0, index).trim();
        value = param.substring(index + 1).trim();
      }
      if (!SipGrammar.__param.containsAll(name))
        throw new ServletParseException("Invalid parameter name ["
            + name + "] in [" + _uri + "]");
     
      if (!SipGrammar.__param.containsAll(value))
        throw new ServletParseException("Invalid parameter value ["
            + value + "] in [" + _uri + "]");
     
      _params.put(SipGrammar.unescape(name.toLowerCase()), SipGrammar.unescape(value));
    }
  }
View Full Code Here


      String name;
      String value;
      int index = header.indexOf('=');
     
      if (index < 0)
        throw new ServletParseException("Missing value in header ["
            + header + "] in uri [" + _uri + "]");
     
      name  = header.substring(0, index).trim();
      value = header.substring(index + 1).trim();
     
      if (!SipGrammar.__header.containsAll(name))
        throw new ServletParseException("Invalid header name ["
            + name + "] in [" + _uri + "]");
     
      if (!SipGrammar.__header.containsAll(value))
        throw new ServletParseException("Invalid header value ["
            + value + "] in [" + _uri + "]");
   
      _headers.put(SipGrammar.unescape(name), SipGrammar.unescape(value));
    }
  }
View Full Code Here

        int indexPort = -1;
        if (_via.charAt(indexSp) == '[')
        {
          int i = _via.indexOf(']', indexSp);
          if (i < 0)
            throw new ServletParseException("Invalid IPv6 in " + _via);
          indexPort = _via.indexOf(':', i);
        }
        else
        {
           indexPort = _via.indexOf(':', indexSp);
        }
       
        int indexParams = _via.indexOf(';', indexSp);
        if (indexPort > -1 && (indexPort < indexParams || indexParams < 0))
        {
            _host = _via.substring(indexSp, indexPort);
            String sPort;
            if (indexParams < 0)
                sPort = _via.substring(indexPort + 1);
            else
                sPort = _via.substring(indexPort + 1, indexParams).trim();
            try
            {
              _port = Integer.parseInt(sPort);
            }
            catch (NumberFormatException _)
            {
              throw new ServletParseException("Invalid port [" + sPort + "] in [" + _via + "]");
            }
        }
        else
        {
            _port = -1;
View Full Code Here

        name  = param.substring(0, index).trim();
        value = param.substring(index + 1).trim();
      }
      if (!SipGrammar.__param.containsAll(name))
      {
        throw new ServletParseException("Invalid parameter name ["
            + name + "] in [" + _via + "]");
      }
      if (!SipGrammar.__param.containsAll(value) && !SipGrammar.isToken(value))
      {
        throw new ServletParseException("Invalid parameter value ["
            + value + "] in [" + _via + "]");
      }     
      _params.put(name.toLowerCase(), value);
    }
  }
View Full Code Here

  {
    Buffer buffer = SipHeaders.CACHE.lookup(name);
    HeaderInfo hi = SipHeaders.getType(buffer);
   
    if (hi.getType() != HeaderInfo.ADDRESS && hi.getOrdinal() != -1)
      throw new ServletParseException("Header: " + name + " is not of address type");
   
    Address address;
    try
    {
      address = _fields.getAddress(buffer);
    }
    catch (LazyParsingException e)
    {
      throw new ServletParseException(e);
    }
   
    if (buffer == SipHeaders.CONTACT_BUFFER && isSystemHeader(hi) && !isCommitted() && address != null)
      return new ContactAddress(address);
    else if ((isSystemHeader(hi) || isCommitted()) && address != null)
View Full Code Here

  {
    Buffer buffer = SipHeaders.CACHE.lookup(name);
    HeaderInfo hi = SipHeaders.getType(buffer);
   
    if (hi.getType() != HeaderInfo.ADDRESS && hi.getOrdinal() != -1)
      throw new ServletParseException("Header: " + name + " is not of address type");
   
    ListIterator<Address> it = _fields.getAddressValues(buffer);
    try
    {
      while (it.hasNext())
        it.next();
      while (it.hasPrevious())
        it.previous();
    }
    catch (LazyParsingException e)
    {
      throw new ServletParseException(e);
    }
    if (isSystemHeader(hi) || isCommitted())
    {
      return new ListIteratorProxy<Address>(it)
      {
View Full Code Here

  {
    Buffer buffer = SipHeaders.CACHE.lookup(name);
    HeaderInfo hi = SipHeaders.getType(buffer);
   
    if (hi.getType() != HeaderInfo.PARAMETERABLE && hi.getType() != HeaderInfo.ADDRESS && hi.getOrdinal() != -1)
      throw new ServletParseException("Header: " + name + " is not of parameterable type");
   
    Parameterable p = getFields().getParameterable(buffer);
   
    if ((isSystemHeader(hi) || isCommitted()) && p != null)
      return new ReadOnlyParameterable(p);
View Full Code Here

  {
    Buffer buffer = SipHeaders.CACHE.lookup(name);
    HeaderInfo hi = SipHeaders.getType(buffer);
   
    if (hi.getType() != HeaderInfo.PARAMETERABLE && hi.getType() != HeaderInfo.ADDRESS && hi.getOrdinal() != -1)
      throw new ServletParseException("Header: " + name + " is not of parametrable type");
   
    ListIterator<Parameterable> it = getFields().getParameterableValues(buffer);
   
    if (isSystemHeader(hi) || isCommitted())
    {
View Full Code Here

        parseParameters(str, pr);

        try {
            validateAndSetParsetResult(pr);
        } catch (IllegalArgumentException iae) {
            ServletParseException spe = new ServletParseException(iae.getMessage());
            throw ServletParseException.class.cast(spe.initCause(iae));
        }
    }
View Full Code Here

            protocol = uri.substring(position, cnt);

            Matcher m = p.matcher(protocol);

            if (!m.find()) {
                throw new ServletParseException("URI does not conform to BNF :" + protocol);
            }

            if (protocol.equals(SIP_URI_PROTOCOL)) {
                return new SipURIImpl(SIP_URI_PROTOCOL, uri, cnt + 1);
            }

            if (protocol.equals(TEL_URI_PROTOCOL)) {
                return new TelURLImpl(uri, cnt + 1);
            }

            if (protocol.equals(SIPS_URI_PROTOCOL)) {
                return new SipURIImpl(SIPS_URI_PROTOCOL, uri, cnt + 1);
            }

            //JSR 289 SipFactory.createURI says, implementation should be able
            //to handle any scheme. So, create a GeneralURIImpl.
            return new GeneralURIImpl(protocol, uri, cnt + 1);
        } catch (Throwable t) {
            throw new ServletParseException(t);
        }
    }
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.