Package org.mortbay.util

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


        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

        if(authorization==null)
        {
            sendChallenge(realm, request, response);
            return false;
        }
        QuotedStringTokenizer tokenizer = new QuotedStringTokenizer(authorization, "=, ", true,
                false);
        String last = null, name = null, username = null, password = null, rlm = null;
        String nonce = null, nc = null, cnonce = null, qop = null, uri = null, rsp = null;
        while (tokenizer.hasMoreTokens())
        {
            String tok = tokenizer.nextToken();
            char c=(tok.length()==1)?tok.charAt(0):'\0';

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

            {
                if (tok != null && tok.hasMoreElements()) return true;
                while (e.hasMoreElements())
                {
                    String value = (String) e.nextElement();
                    tok = new QuotedStringTokenizer(value, separators, false, false);
                    if (tok.hasMoreElements()) return true;
                }
                tok = null;
                return false;
            }
View Full Code Here

        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

                    int ordinal = HttpHeaderValues.CACHE.getOrdinal(value);
                    switch (ordinal)
                    {
                        case -1:
                        {
                            QuotedStringTokenizer tok = new QuotedStringTokenizer(value.toString(), ",");
                            while(tok.hasMoreTokens())
                            {
                                CachedBuffer cb = HttpHeaderValues.CACHE.get(tok.nextToken().trim());
                                if (cb != null)
                                {
                                    switch (cb.getOrdinal())
                                    {
                                        case HttpHeaderValues.CLOSE_ORDINAL:
View Full Code Here

            {
                if (tok != null && tok.hasMoreElements()) return true;
                while (e.hasMoreElements())
                {
                    String value = (String) e.nextElement();
                    tok = new QuotedStringTokenizer(value, separators, false, false);
                    if (tok.hasMoreElements()) return true;
                }
                tok = null;
                return false;
            }
View Full Code Here

        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

                        switch (connection_value)
                        {
                            case -1:
                            {

                                QuotedStringTokenizer tok = new QuotedStringTokenizer(field.getValue(), ",");
                                while(tok.hasMoreTokens())
                                {
                                  String token=tok.nextToken().trim();
                                    CachedBuffer cb = HttpHeaderValues.CACHE.get(token);
                                    if (cb!=null)
                                    {
                                        switch(cb.getOrdinal())
                                        {
View Full Code Here

        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

TOP

Related Classes of org.mortbay.util.QuotedStringTokenizer

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.