michael@0: /*
michael@0: * ====================================================================
michael@0: * Licensed to the Apache Software Foundation (ASF) under one
michael@0: * or more contributor license agreements. See the NOTICE file
michael@0: * distributed with this work for additional information
michael@0: * regarding copyright ownership. The ASF licenses this file
michael@0: * to you under the Apache License, Version 2.0 (the
michael@0: * "License"); you may not use this file except in compliance
michael@0: * with the License. You may obtain a copy of the License at
michael@0: *
michael@0: * http://www.apache.org/licenses/LICENSE-2.0
michael@0: *
michael@0: * Unless required by applicable law or agreed to in writing,
michael@0: * software distributed under the License is distributed on an
michael@0: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
michael@0: * KIND, either express or implied. See the License for the
michael@0: * specific language governing permissions and limitations
michael@0: * under the License.
michael@0: * ====================================================================
michael@0: *
michael@0: * This software consists of voluntary contributions made by many
michael@0: * individuals on behalf of the Apache Software Foundation. For more
michael@0: * information on the Apache Software Foundation, please see
michael@0: * .
michael@0: *
michael@0: */
michael@0:
michael@0: package ch.boye.httpclientandroidlib.protocol;
michael@0:
michael@0: /**
michael@0: * Constants and static helpers related to the HTTP protocol.
michael@0: *
michael@0: * @since 4.0
michael@0: */
michael@0: public final class HTTP {
michael@0:
michael@0: public static final int CR = 13; //
michael@0: public static final int LF = 10; //
michael@0: public static final int SP = 32; //
michael@0: public static final int HT = 9; //
michael@0:
michael@0: /** HTTP header definitions */
michael@0: public static final String TRANSFER_ENCODING = "Transfer-Encoding";
michael@0: public static final String CONTENT_LEN = "Content-Length";
michael@0: public static final String CONTENT_TYPE = "Content-Type";
michael@0: public static final String CONTENT_ENCODING = "Content-Encoding";
michael@0: public static final String EXPECT_DIRECTIVE = "Expect";
michael@0: public static final String CONN_DIRECTIVE = "Connection";
michael@0: public static final String TARGET_HOST = "Host";
michael@0: public static final String USER_AGENT = "User-Agent";
michael@0: public static final String DATE_HEADER = "Date";
michael@0: public static final String SERVER_HEADER = "Server";
michael@0:
michael@0: /** HTTP expectations */
michael@0: public static final String EXPECT_CONTINUE = "100-continue";
michael@0:
michael@0: /** HTTP connection control */
michael@0: public static final String CONN_CLOSE = "Close";
michael@0: public static final String CONN_KEEP_ALIVE = "Keep-Alive";
michael@0:
michael@0: /** Transfer encoding definitions */
michael@0: public static final String CHUNK_CODING = "chunked";
michael@0: public static final String IDENTITY_CODING = "identity";
michael@0:
michael@0: /** Common charset definitions */
michael@0: public static final String UTF_8 = "UTF-8";
michael@0: public static final String UTF_16 = "UTF-16";
michael@0: public static final String US_ASCII = "US-ASCII";
michael@0: public static final String ASCII = "ASCII";
michael@0: public static final String ISO_8859_1 = "ISO-8859-1";
michael@0:
michael@0: /** Default charsets */
michael@0: public static final String DEFAULT_CONTENT_CHARSET = ISO_8859_1;
michael@0: public static final String DEFAULT_PROTOCOL_CHARSET = US_ASCII;
michael@0:
michael@0: /** Content type definitions */
michael@0: public final static String OCTET_STREAM_TYPE = "application/octet-stream";
michael@0: public final static String PLAIN_TEXT_TYPE = "text/plain";
michael@0: public final static String CHARSET_PARAM = "; charset=";
michael@0:
michael@0: /** Default content type */
michael@0: public final static String DEFAULT_CONTENT_TYPE = OCTET_STREAM_TYPE;
michael@0:
michael@0: public static boolean isWhitespace(char ch) {
michael@0: return ch == SP || ch == HT || ch == CR || ch == LF;
michael@0: }
michael@0:
michael@0: private HTTP() {
michael@0: }
michael@0:
michael@0: }