drools-eclipse/org.guvnor.eclipse.webdav/src/kernel/org/eclipse/webdav/internal/kernel/Condition.java
public static Condition create(String ifHeader) throws WebDAVException {
        StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(ifHeader));
        // URI characters
        tokenizer.wordChars('!', '/');
        tokenizer.wordChars(':', '@');
        tokenizer.ordinaryChar('(');
        tokenizer.ordinaryChar(')');
        tokenizer.ordinaryChar('<');
        tokenizer.ordinaryChar('>');
        tokenizer.ordinaryChar('[');
        tokenizer.ordinaryChar(']');
        tokenizer.quoteChar('"');
        Condition condition = null;
        try {
            int token = tokenizer.nextToken();
            condition = Condition.create(tokenizer);
            token = tokenizer.ttype;
            if (token != StreamTokenizer.TT_EOF) {
                throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), "EOF")); //$NON-NLS-1$ //$NON-NLS-2$
            }
        } catch (IOException exc) {
            // ignore or log?
        }
        return condition;
    }
public static Condition create(String ifHeader) throws WebDAVException {
        StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(ifHeader));
        // URI characters
        tokenizer.wordChars('!', '/');
        tokenizer.wordChars(':', '@');
        tokenizer.ordinaryChar('(');
        tokenizer.ordinaryChar(')');
        tokenizer.ordinaryChar('<');
        tokenizer.ordinaryChar('>');
        tokenizer.ordinaryChar('[');
        tokenizer.ordinaryChar(']');
        tokenizer.quoteChar('"');
        Condition condition = null;
        try {
            int token = tokenizer.nextToken();
            condition = Condition.create(tokenizer);
            token = tokenizer.ttype;
            if (token != StreamTokenizer.TT_EOF) {
                throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), "EOF")); //$NON-NLS-1$ //$NON-NLS-2$
            }
        } catch (IOException exc) {
            // ignore or log?
        }
        return condition;
    }
Create a Condition by parsing the given If header as defined by
section 9.4 in the WebDAV spec.

@param ifHeader the contents of a WebDAV If header
@return the parsed condition
@exception WebDAVException thrown if there is a syntax error in the header