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; michael@0: michael@0: /** michael@0: * One element of an HTTP {@link Header header} value consisting of michael@0: * a name / value pair and a number of optional name / value parameters. michael@0: *

michael@0: * Some HTTP headers (such as the set-cookie header) have values that michael@0: * can be decomposed into multiple elements. Such headers must be in the michael@0: * following form: michael@0: *

michael@0: *
michael@0:  * header  = [ element ] *( "," [ element ] )
michael@0:  * element = name [ "=" [ value ] ] *( ";" [ param ] )
michael@0:  * param   = name [ "=" [ value ] ]
michael@0:  *
michael@0:  * name    = token
michael@0:  * value   = ( token | quoted-string )
michael@0:  *
michael@0:  * token         = 1*<any char except "=", ",", ";", <"> and
michael@0:  *                       white space>
michael@0:  * quoted-string = <"> *( text | quoted-char ) <">
michael@0:  * text          = any char except <">
michael@0:  * quoted-char   = "\" char
michael@0:  * 
michael@0: *

michael@0: * Any amount of white space is allowed between any part of the michael@0: * header, element or param and is ignored. A missing value in any michael@0: * element or param will be stored as the empty {@link String}; michael@0: * if the "=" is also missing null will be stored instead. michael@0: * michael@0: * @since 4.0 michael@0: */ michael@0: public interface HeaderElement { michael@0: michael@0: /** michael@0: * Returns header element name. michael@0: * michael@0: * @return header element name michael@0: */ michael@0: String getName(); michael@0: michael@0: /** michael@0: * Returns header element value. michael@0: * michael@0: * @return header element value michael@0: */ michael@0: String getValue(); michael@0: michael@0: /** michael@0: * Returns an array of name / value pairs. michael@0: * michael@0: * @return array of name / value pairs michael@0: */ michael@0: NameValuePair[] getParameters(); michael@0: michael@0: /** michael@0: * Returns the first parameter with the given name. michael@0: * michael@0: * @param name parameter name michael@0: * michael@0: * @return name / value pair michael@0: */ michael@0: NameValuePair getParameterByName(String name); michael@0: michael@0: /** michael@0: * Returns the total count of parameters. michael@0: * michael@0: * @return parameter count michael@0: */ michael@0: int getParameterCount(); michael@0: michael@0: /** michael@0: * Returns parameter with the given index. michael@0: * michael@0: * @param index michael@0: * @return name / value pair michael@0: */ michael@0: NameValuePair getParameter(int index); michael@0: michael@0: } michael@0: