Examples of QuotedStringTokenizer


Examples of org.mortbay.util.QuotedStringTokenizer

        int i = value.indexOf(';');
        if (i < 0) return value;
        if (parameters == null) return value.substring(0, i).trim();

        StringTokenizer tok1 = new QuotedStringTokenizer(value.substring(i), ";", false, true);
        while (tok1.hasMoreTokens())
        {
            String token = tok1.nextToken();
            StringTokenizer tok2 = new QuotedStringTokenizer(token, "= ");
            if (tok2.hasMoreTokens())
            {
                String paramName = tok2.nextToken();
                String paramVal = null;
                if (tok2.hasMoreTokens()) paramVal = tok2.nextToken();
                parameters.put(paramName, paramVal);
            }
        }

        return value.substring(0, i).trim();
View Full Code Here

Examples of org.mortbay.util.QuotedStringTokenizer

        String credentials = request.getHeader(HttpHeaders.AUTHORIZATION);
       
        if (credentials!=null )
        {
            if(Log.isDebugEnabled())Log.debug("Credentials: "+credentials);
            QuotedStringTokenizer tokenizer = new QuotedStringTokenizer(credentials,
                                                                        "=, ",
                                                                        true,
                                                                        false);
            Digest digest=new Digest(request.getMethod());
            String last=null;
            String name=null;

          loop:
            while (tokenizer.hasMoreTokens())
            {
                String tok = tokenizer.nextToken();
                char c=(tok.length()==1)?tok.charAt(0):'\0';

                switch (c)
                {
                  case '=':
View Full Code Here

Examples of org.mortbay.util.QuotedStringTokenizer

            if (HttpHeaders.CACHE.getOrdinal(name)==HttpHeaders.SET_COOKIE_ORDINAL)
            {
                String cname=null;
                String cvalue=null;

                QuotedStringTokenizer tok=new QuotedStringTokenizer(value.toString(),"=;",false,false);
                tok.setSingle(false);

                if (tok.hasMoreElements())
                    cname=tok.nextToken();
                if (tok.hasMoreElements())
                    cvalue=tok.nextToken();

                Cookie cookie=new Cookie(cname,cvalue);

                while (tok.hasMoreTokens())
                {
                    String token=tok.nextToken();
                    if ("Version".equalsIgnoreCase(token))
                        cookie.setVersion(Integer.parseInt(tok.nextToken()));
                    else if ("Comment".equalsIgnoreCase(token))
                        cookie.setComment(tok.nextToken());
                    else if ("Path".equalsIgnoreCase(token))
                        cookie.setPath(tok.nextToken());
                    else if ("Domain".equalsIgnoreCase(token))
                        cookie.setDomain(tok.nextToken());
                    else if ("Expires".equalsIgnoreCase(token))
                    {
                        tok.nextToken();
                        // TODO
                    }
                    else if ("Max-Age".equalsIgnoreCase(token))
                    {
                        tok.nextToken();
                        // TODO
                    }
                    else if ("Secure".equalsIgnoreCase(token))
                        cookie.setSecure(true);
                }
View Full Code Here

Examples of org.openqa.jetty.util.QuotedStringTokenizer

        String credentials = request.getField(HttpFields.__Authorization);
       
        if (credentials!=null )
        {
            if(log.isDebugEnabled())log.debug("Credentials: "+credentials);
            QuotedStringTokenizer tokenizer = new QuotedStringTokenizer(credentials,
                                                                        "=, ",
                                                                        true,
                                                                        false);
            Digest digest=new Digest(request.getMethod());
            String last=null;
            String name=null;

          loop:
            while (tokenizer.hasMoreTokens())
            {
                String tok = tokenizer.nextToken();
                char c=(tok.length()==1)?tok.charAt(0):'\0';

                switch (c)
                {
                  case '=':
View Full Code Here

Examples of org.xnap.commons.util.QuotedStringTokenizer

    super(columns);
  }

  @Override
  public File getFile() {
    QuotedStringTokenizer t = new QuotedStringTokenizer(getTextField().getText());
    return (t.hasMoreTokens()) ? new File(t.nextToken()) : new File("");
  }
View Full Code Here

Examples of org.xnap.commons.util.QuotedStringTokenizer

  private final static Log logger = LogFactory.getLog(JobHelper.class);
 
  public static void view(String viewerPath, File[] files) {
    for (int i = 0; i < files.length; i++) {
      List<String> args = new ArrayList<String>();
      QuotedStringTokenizer t = new QuotedStringTokenizer(viewerPath);
      boolean filenameAdded = false;
      while (t.hasMoreTokens()) {
        String token = t.nextToken();
        if ("%s".equals(token) || "%f".equals(token) || "$f".equals(token)) {
          args.add(files[i].getAbsolutePath());
          filenameAdded = true;
        }
        else {
View Full Code Here

Examples of xnap.util.QuotedStringTokenizer

    {
  super(type);

  this.data = data;

  QuotedStringTokenizer t = new QuotedStringTokenizer(data);

  if (t.countTokens() < argc) {
      throw new InvalidMessageException("Wrong number of arguments.");
  }

  try {
      parse(t);
View Full Code Here

Examples of xnap.util.QuotedStringTokenizer

  if (j < 0) {
      throw new IOException("Invalid request");
  }
  String response = new String(data, 0, j);
     
  QuotedStringTokenizer t = new QuotedStringTokenizer(response);

  if (t.countTokens() < 3) {
      throw new IOException("Invalid request: " + response);
  }

  nick = t.nextToken();
  requestFilename = t.nextToken();

  try {
      offset = Long.parseLong(t.nextToken());
  }
  catch (NumberFormatException e) {
      throw new IOException("Invalid request");
  }   
    }
View Full Code Here

Examples of xnap.util.QuotedStringTokenizer

  byte data[] = new byte[2048];
  int i = in.read(data);
  if (i > 0) {
      String response = new String(data, 0, i);
       
      QuotedStringTokenizer t = new QuotedStringTokenizer(response);
       
      if (t.countTokens() < 3) {
    throw new IOException("invalid request: " + response);
      }

      nick = t.nextToken();
      filename = t.nextToken();
      try {
    filesize = Long.parseLong(t.nextToken());
      }
      catch (NumberFormatException e) {
    throw new IOException("invalid request: " + response);
      }
View Full Code Here

Examples of xnap.util.QuotedStringTokenizer

    public Server readServer() throws IOException {
  String line;

  while ((line = getIn().readLine()) != null) {
      try {
    QuotedStringTokenizer t
        = new QuotedStringTokenizer(line, " :");
   
    if (t.countTokens() < 2) {
        continue;
    }
       
    String ip = t.nextToken();
    int port = Integer.parseInt(t.nextToken());
    if (port < PortRange.MIN_PORT || port > PortRange.MAX_PORT) {
        throw new NumberFormatException();
    }

        String network = (t.countTokens() > 0) ? t.nextToken() : "";

        Server s = new Server(ip, port, network);

        if (t.countTokens() >= 3) {
          String token = t.nextToken();
          s.setUsername((token.length() > 0) ? token : null);
          token = t.nextToken();
          s.setPassword((token.length() > 0) ? token : null);
          token = t.nextToken();
          s.setEmail((token.length() > 0) ? token : null);
        }
         
        if (t.countTokens() >= 1) {
          s.setRedirector(t.nextToken().equals("true"));
        }
         
        if (t.countTokens() >= 1) {
          t.nextToken(); //s.setAutoJoinChannels();
        }

    return s;
      }
      catch (NumberFormatException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.