當前位置: 首頁>>代碼示例>>Java>>正文


Java CharArrayBuffer.substringTrimmed方法代碼示例

本文整理匯總了Java中org.apache.http.util.CharArrayBuffer.substringTrimmed方法的典型用法代碼示例。如果您正苦於以下問題:Java CharArrayBuffer.substringTrimmed方法的具體用法?Java CharArrayBuffer.substringTrimmed怎麽用?Java CharArrayBuffer.substringTrimmed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.http.util.CharArrayBuffer的用法示例。


在下文中一共展示了CharArrayBuffer.substringTrimmed方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseChallenge

import org.apache.http.util.CharArrayBuffer; //導入方法依賴的package包/類
@Override
protected void parseChallenge(
                               final CharArrayBuffer buffer,
                               int beginIndex,
                               int endIndex ) throws MalformedChallengeException {

    String challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (log.isDebugEnabled()) {
        log.debug("Received challenge '" + challenge + "' from the auth server");
    }
    if (state == State.UNINITIATED) {
        token = base64codec.decode(challenge.getBytes());
        state = State.CHALLENGE_RECEIVED;
    } else {
        log.debug("Authentication already attempted");
        state = State.FAILED;
    }
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:19,代碼來源:GGSSchemeBase.java

示例2: parseChallenge

import org.apache.http.util.CharArrayBuffer; //導入方法依賴的package包/類
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        int beginIndex, int endIndex) throws MalformedChallengeException {
    String challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (challenge.length() == 0) {
        if (this.state == State.UNINITIATED) {
            this.state = State.CHALLENGE_RECEIVED;
        } else {
            this.state = State.FAILED;
        }
        this.challenge = null;
    } else {
        this.state = State.MSG_TYPE2_RECEVIED;
        this.challenge = challenge;
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:18,代碼來源:NTLMScheme.java

示例3: parseChallenge

import org.apache.http.util.CharArrayBuffer; //導入方法依賴的package包/類
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        int beginIndex, int endIndex) throws MalformedChallengeException {
    String challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (log.isDebugEnabled()) {
        log.debug("Received challenge '" + challenge + "' from the auth server");
    }
    if (state == State.UNINITIATED) {
        token = base64codec.decode(challenge.getBytes());
        state = State.CHALLENGE_RECEIVED;
    } else {
        log.debug("Authentication already attempted");
        state = State.FAILED;
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:GGSSchemeBase.java

示例4: BufferedHeader

import org.apache.http.util.CharArrayBuffer; //導入方法依賴的package包/類
/**
 * Creates a new header from a buffer.
 * The name of the header will be parsed immediately,
 * the value only if it is accessed.
 *
 * @param buffer    the buffer containing the header to represent
 *
 * @throws ParseException   in case of a parse error
 */
public BufferedHeader(final CharArrayBuffer buffer)
    throws ParseException {

    super();
    if (buffer == null) {
        throw new IllegalArgumentException
            ("Char array buffer may not be null");
    }
    int colon = buffer.indexOf(':');
    if (colon == -1) {
        throw new ParseException
            ("Invalid header: " + buffer.toString());
    }
    String s = buffer.substringTrimmed(0, colon);
    if (s.length() == 0) {
        throw new ParseException
            ("Invalid header: " + buffer.toString());
    }
    this.buffer = buffer;
    this.name = s;
    this.valuePos = colon + 1;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:32,代碼來源:BufferedHeader.java

示例5: parseChallenge

import org.apache.http.util.CharArrayBuffer; //導入方法依賴的package包/類
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        final int beginIndex, final int endIndex) throws MalformedChallengeException {
    this.challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (this.challenge.length() == 0) {
        if (this.state == State.UNINITIATED) {
            this.state = State.CHALLENGE_RECEIVED;
        } else {
            this.state = State.FAILED;
        }
    } else {
        if (this.state.compareTo(State.MSG_TYPE1_GENERATED) < 0) {
            this.state = State.FAILED;
            throw new MalformedChallengeException("Out of sequence NTLM response message");
        } else if (this.state == State.MSG_TYPE1_GENERATED) {
            this.state = State.MSG_TYPE2_RECEVIED;
        }
    }
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:21,代碼來源:NTLMSchemeHC4.java

示例6: parseChallenge

import org.apache.http.util.CharArrayBuffer; //導入方法依賴的package包/類
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        final int beginIndex, final int endIndex) throws MalformedChallengeException {
    this.challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (this.challenge.isEmpty()) {
        if (this.state == State.UNINITIATED) {
            this.state = State.CHALLENGE_RECEIVED;
        } else {
            this.state = State.FAILED;
        }
    } else {
        if (this.state.compareTo(State.MSG_TYPE1_GENERATED) < 0) {
            this.state = State.FAILED;
            throw new MalformedChallengeException("Out of sequence NTLM response message");
        } else if (this.state == State.MSG_TYPE1_GENERATED) {
            this.state = State.MSG_TYPE2_RECEVIED;
        }
    }
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:21,代碼來源:NTLMScheme.java

示例7: parseChallenge

import org.apache.http.util.CharArrayBuffer; //導入方法依賴的package包/類
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        final int beginIndex, final int endIndex) throws MalformedChallengeException {
    final String challenge = buffer.substringTrimmed(beginIndex, endIndex);
    if (log.isDebugEnabled()) {
        log.debug("Received challenge '" + challenge + "' from the auth server");
    }
    if (state == State.UNINITIATED) {
        token = Base64.decodeBase64(challenge.getBytes());
        state = State.CHALLENGE_RECEIVED;
    } else {
        log.debug("Authentication already attempted");
        state = State.FAILED;
    }
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:17,代碼來源:GGSSchemeBase.java

示例8: parseChallenge

import org.apache.http.util.CharArrayBuffer; //導入方法依賴的package包/類
@Override
protected void parseChallenge(
        final CharArrayBuffer buffer,
        final int beginIndex,
        final int endIndex) throws MalformedChallengeException {
    this.challenge = buffer.substringTrimmed(beginIndex, endIndex);

    if (this.challenge.isEmpty()) {
        if (clientCred != null) {
            dispose(); // run cleanup first before throwing an exception otherwise can leak OS resources
            if (continueNeeded) {
                throw new RuntimeException("Unexpected token");
            }
        }
    }
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:17,代碼來源:WindowsNegotiateScheme.java

示例9: parseRequestLine

import org.apache.http.util.CharArrayBuffer; //導入方法依賴的package包/類
/**
 * Parses a request line.
 *
 * @param buffer    a buffer holding the line to parse
 *
 * @return  the parsed request line
 *
 * @throws ParseException        in case of a parse error
 */
public RequestLine parseRequestLine(final CharArrayBuffer buffer,
                                    final ParserCursor cursor)
    throws ParseException {

    if (buffer == null) {
        throw new IllegalArgumentException("Char array buffer may not be null");
    }
    if (cursor == null) {
        throw new IllegalArgumentException("Parser cursor may not be null");
    }

    int indexFrom = cursor.getPos();
    int indexTo = cursor.getUpperBound();

    try {
        skipWhitespace(buffer, cursor);
        int i = cursor.getPos();

        int blank = buffer.indexOf(' ', i, indexTo);
        if (blank < 0) {
            throw new ParseException("Invalid request line: " +
                    buffer.substring(indexFrom, indexTo));
        }
        String method = buffer.substringTrimmed(i, blank);
        cursor.updatePos(blank);

        skipWhitespace(buffer, cursor);
        i = cursor.getPos();

        blank = buffer.indexOf(' ', i, indexTo);
        if (blank < 0) {
            throw new ParseException("Invalid request line: " +
                    buffer.substring(indexFrom, indexTo));
        }
        String uri = buffer.substringTrimmed(i, blank);
        cursor.updatePos(blank);

        ProtocolVersion ver = parseProtocolVersion(buffer, cursor);

        skipWhitespace(buffer, cursor);
        if (!cursor.atEnd()) {
            throw new ParseException("Invalid request line: " +
                    buffer.substring(indexFrom, indexTo));
        }

        return createRequestLine(method, uri, ver);
    } catch (IndexOutOfBoundsException e) {
        throw new ParseException("Invalid request line: " +
                                 buffer.substring(indexFrom, indexTo));
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:61,代碼來源:BasicLineParser.java

示例10: parseRequestLine

import org.apache.http.util.CharArrayBuffer; //導入方法依賴的package包/類
/**
 * Parses a request line.
 *
 * @param buffer    a buffer holding the line to parse
 *
 * @return  the parsed request line
 *
 * @throws ParseException        in case of a parse error
 */
public RequestLine parseRequestLine(final CharArrayBuffer buffer,
                                    final ParserCursor cursor) throws ParseException {

    Args.notNull(buffer, "Char array buffer");
    Args.notNull(cursor, "Parser cursor");
    final int indexFrom = cursor.getPos();
    final int indexTo = cursor.getUpperBound();

    try {
        skipWhitespace(buffer, cursor);
        int i = cursor.getPos();

        int blank = buffer.indexOf(' ', i, indexTo);
        if (blank < 0) {
            throw new ParseException("Invalid request line: " +
                    buffer.substring(indexFrom, indexTo));
        }
        final String method = buffer.substringTrimmed(i, blank);
        cursor.updatePos(blank);

        skipWhitespace(buffer, cursor);
        i = cursor.getPos();

        blank = buffer.indexOf(' ', i, indexTo);
        if (blank < 0) {
            throw new ParseException("Invalid request line: " +
                    buffer.substring(indexFrom, indexTo));
        }
        final String uri = buffer.substringTrimmed(i, blank);
        cursor.updatePos(blank);

        final ProtocolVersion ver = parseProtocolVersion(buffer, cursor);

        skipWhitespace(buffer, cursor);
        if (!cursor.atEnd()) {
            throw new ParseException("Invalid request line: " +
                    buffer.substring(indexFrom, indexTo));
        }

        return createRequestLine(method, uri, ver);
    } catch (final IndexOutOfBoundsException e) {
        throw new ParseException("Invalid request line: " +
                                 buffer.substring(indexFrom, indexTo));
    }
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:55,代碼來源:BasicLineParserHC4.java


注:本文中的org.apache.http.util.CharArrayBuffer.substringTrimmed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。