Package javax.servlet.sip

Examples of javax.servlet.sip.ServletParseException


    int index = skipSpaces(0);
   
    int index2 = _rack.indexOf(' ', index);
   
      if (index2 < 0)
        throw new ServletParseException("Invalid RAck header: " + _rack);
     
      String s = _rack.substring(index, index2);
      try
      {
        _rseq = Long.parseLong(s);
      }
      catch (NumberFormatException _)
      {
        throw new ServletParseException("Invalid RSeq number: " + s);
      }
     
      index = skipSpaces(index2);
     
      index2 = _rack.indexOf(' ', index);
      if (index2 < 0)
        throw new ServletParseException("Invalid RAck header: " + _rack);
     
      s = _rack.substring(index, index2);
      try
      {
        _number = Long.parseLong(s);
      }
      catch (NumberFormatException _)
      {
        throw new ServletParseException("Invalid CSeq number: " + s);
      }
     
      index = skipSpaces(index2);
     
      _method = _rack.substring(index).trim();
     
      if (!SipGrammar.isToken(_method))
        throw new ServletParseException("Invalid RAck method: " + _method);
  }
View Full Code Here


 
  private void parse() throws ServletParseException
 
    int index = _cseq.indexOf(' ');
      if (index < 0)
        throw new ServletParseException("Invalid CSeq header: " + _cseq);
     
      String sNumber = _cseq.substring(0, index).trim();
      try
      {
        _number = Long.parseLong(sNumber);
      }
      catch (NumberFormatException _)
      {
        throw new ServletParseException("Invalid CSeq number: " + sNumber);
      }
     
      _method = _cseq.substring(index + 1).trim();
     
      if (!SipGrammar.isToken(_method))
        throw new ServletParseException("Invalid CSeq method: " + _method);
  }
View Full Code Here

 
  private void parse() throws ServletParseException
  {
    int indexScheme = _uri.indexOf(':');
    if (indexScheme < 0)
      throw new ServletParseException("Missing TelURL scheme in [" + _uri + "]");
   
    _scheme = _uri.substring(0, indexScheme);
    if (!"tel".equals(_scheme) && !"fax".equals(_scheme))
    {
      throw new ServletParseException("Invalid TelURL scheme [" + _scheme + "] in [" + _uri + "]");
    }
    int indexParam = _uri.indexOf(';', indexScheme);
    if (indexParam < 0)
    {
      _number = _uri.substring(indexScheme + 1);
    }
    else
    {
      _number = _uri.substring(indexScheme + 1, indexParam);
      if (!SipGrammar.__phoneDigits.containsAll(getPhoneNumber()))
        throw new ServletParseException("Invalid phone number [" + _number
            + "] in URI [" + _uri + "]");
      String sParams = _uri.substring(indexParam + 1);
      parseParams(sParams);
    }
  }
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 [" + _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

 
  private void parse() throws ServletParseException
  {
    int indexScheme = _uri.indexOf(':');
    if (indexScheme < 0)
      throw new ServletParseException("Missing scheme in uri [" + _uri + "]");
   
    _scheme = _uri.substring(0, indexScheme);
    if (!SipGrammar.isURIScheme(_scheme))
      throw new ServletParseException("Invalid scheme [" + _scheme + "] in uri [" + _uri + "]");
   
    int indexParam = _uri.indexOf(';', indexScheme);
    if (indexParam < 0)
    {
      _file = _uri.substring(indexScheme + 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 [" + _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

   
    if (address.startsWith("\""))
    {
      int rQuote = indexRQuote(address, 1);
      if (rQuote == -1)
        throw new ServletParseException("Missing terminating \" in [" + address + "]");
     
      String s = address.substring(0, rQuote + 1);
      _displayName = SipGrammar.unquote(s);
      int laqIndex = address.indexOf('<', rQuote + 1);
      if (laqIndex == -1)
        throw new ServletParseException("Missing < in address [" + address + "]");
     
      int raqIndex = address.indexOf('>');
      if (raqIndex == -1)
        throw new ServletParseException("Missing > in address [" + address + "]");
     
      sURI = address.substring(laqIndex + 1, raqIndex);
      int indexParams = address.indexOf(';', raqIndex + 1);
      if (indexParams > -1)
        sParams = address.substring(indexParams + 1);
     
    }
    else
    {
      int indexLAQuote = address.indexOf('<');
      if (indexLAQuote > -1)
      {
        if (indexLAQuote > 0)
        {
          String s = address.substring(0, indexLAQuote).trim();
          if (s.length() > 0)
          {
            if (!SipGrammar.isTokens(s))
              throw new ServletParseException("Not token or LWS char in ["
                  + s + "] in address [" + address + "]");
            _displayName = s;
          }
        }
        int indexRAQuote = address.indexOf('>', indexLAQuote);
        if (indexRAQuote == -1)
          throw new ServletParseException("Missing > in address [" + address + "]");
       
        sURI = address.substring(indexLAQuote + 1, indexRAQuote);
        int indexParams = address.indexOf(';', indexRAQuote + 1);
        if (indexParams > -1)
          sParams = address.substring(indexParams + 1);
View Full Code Here

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

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

  private void parse() throws ServletParseException
  {
    int indexScheme = _uri.indexOf(':');
    if (indexScheme < 0)
      throw new ServletParseException("Missing SIP scheme. URI=[" + _uri + "]");
   
    _scheme = _uri.substring(0, indexScheme);
    if (!_scheme.equals("sip") && !_scheme.equals("sips"))
      throw new ServletParseException("Invalid SIP scheme. URI=[" + _uri + "]");
   
    int indexUser = _uri.indexOf('@', indexScheme + 1);
    int indexHost;
   
    if (indexUser >= 0)
    {
      int indexPassword = _uri.indexOf(':', indexScheme + 1);
      String sUser;
      if (indexPassword >= 0 && indexPassword < indexUser)
      {
        sUser = _uri.substring(indexScheme + 1, indexPassword);
        String sPassword = _uri.substring(indexPassword + 1, indexUser);
        if (!SipGrammar.__passwd.containsAll(sPassword))
          throw new ServletParseException("Invalid password [" + sPassword
              + "] in URI [" + _uri + "]");
       
        _password = SipGrammar.unescape(sPassword);
      }
      else
      {
        sUser = _uri.substring(indexScheme + 1, indexUser);
      }
      if (!SipGrammar.__user.containsAll(sUser))
        throw new ServletParseException("Invalid user [" + sUser + "] in URI [" + _uri + "]");
     
      _user = SipGrammar.unescape(sUser);
      indexHost = indexUser + 1;
    }
    else
    {
      indexHost = indexScheme + 1;
    }
    int indexPort = -1;
   
    if (_uri.charAt(indexHost) == '[')
    {
      int i = _uri.indexOf(']', indexHost);
          if (i < 0)
            throw new ServletParseException("Invalid IPv6 in " + _uri);
          indexPort = _uri.indexOf(':', i);
    }
    else
    {
      indexPort = _uri.indexOf(':', indexHost);
    }
    int indexParams = _uri.indexOf(';', indexHost);
    int indexHeaders = _uri.indexOf('?', indexHost);
   
    if ((indexPort > indexParams && indexParams > -1)
        || (indexPort > indexHeaders && indexHeaders > -1))
      indexPort = -1;
   
    int endHost = indexPort;
    if (endHost < 0)
      endHost = indexParams;
   
    if (endHost < 0)
      endHost = indexHeaders;
   
    String host;
    if (endHost < 0)
      host = _uri.substring(indexHost);
    else
      host = _uri.substring(indexHost, endHost);
    host = host.trim();
    if (!SipGrammar.__host.containsAll(host))
      throw new ServletParseException("Invalid host [" + host + "] in URI [" + _uri + "]");
    setHost(host);
 
    if (indexPort < 0)
    {
      _port = -1;
    }
    else
    {
      int endPort = indexParams;
      if (endPort < 0)
        endPort = indexHeaders;
     
      String sPort;
      if (endPort < 0)
        sPort = _uri.substring(indexPort + 1);
      else
        sPort = _uri.substring(indexPort + 1, endPort);
      try
      {
        _port = Integer.parseInt(sPort);
      }
      catch (NumberFormatException _)
      {
        throw new ServletParseException("Invalid port number [" + sPort + "] in [" + _uri + "]");
      }
    }
    if (indexParams >= 0)
    {
      String params;
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.