mobile/android/thirdparty/ch/boye/httpclientandroidlib/protocol/HttpExpectationVerifier.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 /*
     2  * ====================================================================
     3  * Licensed to the Apache Software Foundation (ASF) under one
     4  * or more contributor license agreements.  See the NOTICE file
     5  * distributed with this work for additional information
     6  * regarding copyright ownership.  The ASF licenses this file
     7  * to you under the Apache License, Version 2.0 (the
     8  * "License"); you may not use this file except in compliance
     9  * with the License.  You may obtain a copy of the License at
    10  *
    11  *   http://www.apache.org/licenses/LICENSE-2.0
    12  *
    13  * Unless required by applicable law or agreed to in writing,
    14  * software distributed under the License is distributed on an
    15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    16  * KIND, either express or implied.  See the License for the
    17  * specific language governing permissions and limitations
    18  * under the License.
    19  * ====================================================================
    20  *
    21  * This software consists of voluntary contributions made by many
    22  * individuals on behalf of the Apache Software Foundation.  For more
    23  * information on the Apache Software Foundation, please see
    24  * <http://www.apache.org/>.
    25  *
    26  */
    28 package ch.boye.httpclientandroidlib.protocol;
    30 import ch.boye.httpclientandroidlib.HttpException;
    31 import ch.boye.httpclientandroidlib.HttpRequest;
    32 import ch.boye.httpclientandroidlib.HttpResponse;
    34 /**
    35  * Defines an interface to verify whether an incoming HTTP request meets
    36  * the target server's expectations.
    37  *<p>
    38  * The Expect request-header field is used to indicate that particular
    39  * server behaviors are required by the client.
    40  *</p>
    41  *<pre>
    42  *    Expect       =  "Expect" ":" 1#expectation
    43  *
    44  *    expectation  =  "100-continue" | expectation-extension
    45  *    expectation-extension =  token [ "=" ( token | quoted-string )
    46  *                             *expect-params ]
    47  *    expect-params =  ";" token [ "=" ( token | quoted-string ) ]
    48  *</pre>
    49  *<p>
    50  * A server that does not understand or is unable to comply with any of
    51  * the expectation values in the Expect field of a request MUST respond
    52  * with appropriate error status. The server MUST respond with a 417
    53  * (Expectation Failed) status if any of the expectations cannot be met
    54  * or, if there are other problems with the request, some other 4xx
    55  * status.
    56  *</p>
    57  *
    58  * @since 4.0
    59  */
    60 public interface HttpExpectationVerifier {
    62     /**
    63      * Verifies whether the given request meets the server's expectations.
    64      * <p>
    65      * If the request fails to meet particular criteria, this method can
    66      * trigger a terminal response back to the client by setting the status
    67      * code of the response object to a value greater or equal to
    68      * <code>200</code>. In this case the client will not have to transmit
    69      * the request body. If the request meets expectations this method can
    70      * terminate without modifying the response object. Per default the status
    71      * code of the response object will be set to <code>100</code>.
    72      *
    73      * @param request the HTTP request.
    74      * @param response the HTTP response.
    75      * @param context the HTTP context.
    76      * @throws HttpException in case of an HTTP protocol violation.
    77      */
    78     void verify(HttpRequest request, HttpResponse response, HttpContext context)
    79             throws HttpException;
    81 }

mercurial