private String consumeURL() {
        String rval = null;

        int pos = position + "http://".length(); //$NON-NLS-1$
        while (pos < buffer.length() && isValidURLChar(pos)) {
            pos++;
        }

        if (pos < buffer.length() || atEnd) {
            try {
                rval = buffer.getString(position, pos, "UTF-8"); //$NON-NLS-1$
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
            position = pos;
        }
        return rval;
    }
@return the URL consumed from the buffer
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/rewrite/URLRewritingStream.java