am bc284a5f
: Merge "Move the public method HttpDateTime.parse() into AndroidHttpClient." into froyo
Merge commit 'bc284a5f9f1e3f19ddd45cfb233f0d1775b612a7' into froyo-plus-aosp * commit 'bc284a5f9f1e3f19ddd45cfb233f0d1775b612a7': Move the public method HttpDateTime.parse() into AndroidHttpClient.
This commit is contained in:
@ -90859,6 +90859,19 @@
|
||||
<parameter name="userAgent" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="parseDate"
|
||||
return="long"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="true"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="dateString" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<field name="DEFAULT_SYNC_MIN_GZIP_BYTES"
|
||||
type="long"
|
||||
transient="false"
|
||||
@ -90870,38 +90883,6 @@
|
||||
>
|
||||
</field>
|
||||
</class>
|
||||
<class name="HttpDateTime"
|
||||
extends="java.lang.Object"
|
||||
abstract="false"
|
||||
static="false"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<constructor name="HttpDateTime"
|
||||
type="android.net.http.HttpDateTime"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</constructor>
|
||||
<method name="parse"
|
||||
return="java.lang.Long"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="true"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="timeString" type="java.lang.String">
|
||||
</parameter>
|
||||
<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
|
||||
</exception>
|
||||
</method>
|
||||
</class>
|
||||
<class name="SslCertificate"
|
||||
extends="java.lang.Object"
|
||||
abstract="false"
|
||||
|
@ -17,7 +17,7 @@
|
||||
package com.android.common;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.http.HttpDateTime;
|
||||
import android.net.http.AndroidHttpClient;
|
||||
import android.text.format.Time;
|
||||
|
||||
import java.util.Map;
|
||||
@ -243,7 +243,7 @@ public class OperationScheduler {
|
||||
return true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
try {
|
||||
setMoratoriumTimeMillis(HttpDateTime.parse(retryAfter));
|
||||
setMoratoriumTimeMillis(AndroidHttpClient.parseDate(retryAfter));
|
||||
return true;
|
||||
} catch (IllegalArgumentException iae) {
|
||||
return false;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package android.net.http;
|
||||
|
||||
import com.android.internal.http.HttpDateTime;
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpEntityEnclosingRequest;
|
||||
@ -444,4 +445,22 @@ public final class AndroidHttpClient implements HttpClient {
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the date of the given HTTP date string. This method can identify
|
||||
* and parse the date formats emitted by common HTTP servers, such as
|
||||
* <a href="http://www.ietf.org/rfc/rfc0822.txt">RFC 822</a>,
|
||||
* <a href="http://www.ietf.org/rfc/rfc0850.txt">RFC 850</a>,
|
||||
* <a href="http://www.ietf.org/rfc/rfc1036.txt">RFC 1036</a>,
|
||||
* <a href="http://www.ietf.org/rfc/rfc1123.txt">RFC 1123</a> and
|
||||
* <a href="http://www.opengroup.org/onlinepubs/007908799/xsh/asctime.html">ANSI
|
||||
* C's asctime()</a>.
|
||||
*
|
||||
* @return the number of milliseconds since Jan. 1, 1970, midnight GMT.
|
||||
* @throws IllegalArgumentException if {@code dateString} is not a date or
|
||||
* of an unsupported format.
|
||||
*/
|
||||
public static long parseDate(String dateString) {
|
||||
return HttpDateTime.parse(dateString);
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
package android.webkit;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.http.AndroidHttpClient;
|
||||
import android.net.http.Headers;
|
||||
import android.net.http.HttpDateTime;
|
||||
import android.os.FileUtils;
|
||||
import android.util.Log;
|
||||
import java.io.File;
|
||||
@ -716,7 +716,7 @@ public final class CacheManager {
|
||||
ret.expiresString = headers.getExpires();
|
||||
if (ret.expiresString != null) {
|
||||
try {
|
||||
ret.expires = HttpDateTime.parse(ret.expiresString);
|
||||
ret.expires = AndroidHttpClient.parseDate(ret.expiresString);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Take care of the special "-1" and "0" cases
|
||||
if ("-1".equals(ret.expiresString)
|
||||
@ -831,7 +831,7 @@ public final class CacheManager {
|
||||
// 24 * 60 * 60 * 1000
|
||||
long lastmod = System.currentTimeMillis() + 86400000;
|
||||
try {
|
||||
lastmod = HttpDateTime.parse(ret.lastModified);
|
||||
lastmod = AndroidHttpClient.parseDate(ret.lastModified);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
Log.e(LOGTAG, "illegal lastModified: " + ret.lastModified);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ package android.webkit;
|
||||
|
||||
import android.net.ParseException;
|
||||
import android.net.WebAddress;
|
||||
import android.net.http.HttpDateTime;
|
||||
import android.net.http.AndroidHttpClient;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
@ -939,7 +939,7 @@ public final class CookieManager {
|
||||
}
|
||||
if (name.equals(EXPIRES)) {
|
||||
try {
|
||||
cookie.expires = HttpDateTime.parse(value);
|
||||
cookie.expires = AndroidHttpClient.parseDate(value);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
Log.e(LOGTAG,
|
||||
"illegal format for expires: " + value);
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.http;
|
||||
package com.android.internal.http;
|
||||
|
||||
import android.text.format.Time;
|
||||
|
||||
@ -82,7 +82,7 @@ public final class HttpDateTime {
|
||||
int second;
|
||||
}
|
||||
|
||||
public static Long parse(String timeString)
|
||||
public static long parse(String timeString)
|
||||
throws IllegalArgumentException {
|
||||
|
||||
int date = 1;
|
@ -313,7 +313,7 @@ android.net.http.AndroidHttpClientConnection
|
||||
android.net.http.EventHandler
|
||||
android.net.http.Headers
|
||||
android.net.http.HttpsConnection
|
||||
android.net.http.HttpDateTime
|
||||
com.android.internal.http.HttpDateTime
|
||||
android.net.http.Request
|
||||
android.net.http.RequestQueue
|
||||
android.net.http.SslCertificate
|
||||
|
Reference in New Issue
Block a user