httpcore-4.1

16:36:41.954 INFO  jd.cli.Main - Decompiling httpcore-4.1.jar
package org.apache.http;

public class ProtocolException
  extends HttpException
{
  private static final long serialVersionUID = -2143571074341228994L;
  
  public ProtocolException() {}
  
  public ProtocolException(String message)
  {
    super(message);
  }
  
  public ProtocolException(String message, Throwable cause)
  {
    super(message, cause);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.ProtocolException
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

import java.util.Locale;

public abstract interface ReasonPhraseCatalog
{
  public abstract String getReason(int paramInt, Locale paramLocale);
}

/* Location:
 * Qualified Name:     org.apache.http.ReasonPhraseCatalog
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

public final class HttpHeaders
{
  public static final String ACCEPT = "Accept";
  public static final String ACCEPT_CHARSET = "Accept-Charset";
  public static final String ACCEPT_ENCODING = "Accept-Encoding";
  public static final String ACCEPT_LANGUAGE = "Accept-Language";
  public static final String ACCEPT_RANGES = "Accept-Ranges";
  public static final String AGE = "Age";
  public static final String ALLOW = "Allow";
  public static final String AUTHORIZATION = "Authorization";
  public static final String CACHE_CONTROL = "Cache-Control";
  public static final String CONNECTION = "Connection";
  public static final String CONTENT_ENCODING = "Content-Encoding";
  public static final String CONTENT_LANGUAGE = "Content-Language";
  public static final String CONTENT_LENGTH = "Content-Length";
  public static final String CONTENT_LOCATION = "Content-Location";
  public static final String CONTENT_MD5 = "Content-MD5";
  public static final String CONTENT_RANGE = "Content-Range";
  public static final String CONTENT_TYPE = "Content-Type";
  public static final String DATE = "Date";
  public static final String DAV = "Dav";
  public static final String DEPTH = "Depth";
  public static final String DESTINATION = "Destination";
  public static final String ETAG = "ETag";
  public static final String EXPECT = "Expect";
  public static final String EXPIRES = "Expires";
  public static final String FROM = "From";
  public static final String HOST = "Host";
  public static final String IF = "If";
  public static final String IF_MATCH = "If-Match";
  public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
  public static final String IF_NONE_MATCH = "If-None-Match";
  public static final String IF_RANGE = "If-Range";
  public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since";
  public static final String LAST_MODIFIED = "Last-Modified";
  public static final String LOCATION = "Location";
  public static final String LOCK_TOKEN = "Lock-Token";
  public static final String MAX_FORWARDS = "Max-Forwards";
  public static final String OVERWRITE = "Overwrite";
  public static final String PRAGMA = "Pragma";
  public static final String PROXY_AUTHENTICATE = "Proxy-Authenticate";
  public static final String PROXY_AUTHORIZATION = "Proxy-Authorization";
  public static final String RANGE = "Range";
  public static final String REFERER = "Referer";
  public static final String RETRY_AFTER = "Retry-After";
  public static final String SERVER = "Server";
  public static final String STATUS_URI = "Status-URI";
  public static final String TE = "TE";
  public static final String TIMEOUT = "Timeout";
  public static final String TRAILER = "Trailer";
  public static final String TRANSFER_ENCODING = "Transfer-Encoding";
  public static final String UPGRADE = "Upgrade";
  public static final String USER_AGENT = "User-Agent";
  public static final String VARY = "Vary";
  public static final String VIA = "Via";
  public static final String WARNING = "Warning";
  public static final String WWW_AUTHENTICATE = "WWW-Authenticate";
}

/* Location:
 * Qualified Name:     org.apache.http.HttpHeaders
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

public abstract interface StatusLine
{
  public abstract ProtocolVersion getProtocolVersion();
  
  public abstract int getStatusCode();
  
  public abstract String getReasonPhrase();
}

/* Location:
 * Qualified Name:     org.apache.http.StatusLine
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

import java.util.Iterator;

public abstract interface HeaderElementIterator
  extends Iterator
{
  public abstract boolean hasNext();
  
  public abstract HeaderElement nextElement();
}

/* Location:
 * Qualified Name:     org.apache.http.HeaderElementIterator
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

import java.io.IOException;

public abstract interface HttpConnection
{
  public abstract void close()
    throws IOException;
  
  public abstract boolean isOpen();
  
  public abstract boolean isStale();
  
  public abstract void setSocketTimeout(int paramInt);
  
  public abstract int getSocketTimeout();
  
  public abstract void shutdown()
    throws IOException;
  
  public abstract HttpConnectionMetrics getMetrics();
}

/* Location:
 * Qualified Name:     org.apache.http.HttpConnection
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

import org.apache.http.util.CharArrayBuffer;

public abstract interface FormattedHeader
  extends Header
{
  public abstract CharArrayBuffer getBuffer();
  
  public abstract int getValuePos();
}

/* Location:
 * Qualified Name:     org.apache.http.FormattedHeader
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

import org.apache.http.protocol.HttpContext;

public abstract interface HttpResponseFactory
{
  public abstract HttpResponse newHttpResponse(ProtocolVersion paramProtocolVersion, int paramInt, HttpContext paramHttpContext);
  
  public abstract HttpResponse newHttpResponse(StatusLine paramStatusLine, HttpContext paramHttpContext);
}

/* Location:
 * Qualified Name:     org.apache.http.HttpResponseFactory
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

public abstract interface HttpStatus
{
  public static final int SC_CONTINUE = 100;
  public static final int SC_SWITCHING_PROTOCOLS = 101;
  public static final int SC_PROCESSING = 102;
  public static final int SC_OK = 200;
  public static final int SC_CREATED = 201;
  public static final int SC_ACCEPTED = 202;
  public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203;
  public static final int SC_NO_CONTENT = 204;
  public static final int SC_RESET_CONTENT = 205;
  public static final int SC_PARTIAL_CONTENT = 206;
  public static final int SC_MULTI_STATUS = 207;
  public static final int SC_MULTIPLE_CHOICES = 300;
  public static final int SC_MOVED_PERMANENTLY = 301;
  public static final int SC_MOVED_TEMPORARILY = 302;
  public static final int SC_SEE_OTHER = 303;
  public static final int SC_NOT_MODIFIED = 304;
  public static final int SC_USE_PROXY = 305;
  public static final int SC_TEMPORARY_REDIRECT = 307;
  public static final int SC_BAD_REQUEST = 400;
  public static final int SC_UNAUTHORIZED = 401;
  public static final int SC_PAYMENT_REQUIRED = 402;
  public static final int SC_FORBIDDEN = 403;
  public static final int SC_NOT_FOUND = 404;
  public static final int SC_METHOD_NOT_ALLOWED = 405;
  public static final int SC_NOT_ACCEPTABLE = 406;
  public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
  public static final int SC_REQUEST_TIMEOUT = 408;
  public static final int SC_CONFLICT = 409;
  public static final int SC_GONE = 410;
  public static final int SC_LENGTH_REQUIRED = 411;
  public static final int SC_PRECONDITION_FAILED = 412;
  public static final int SC_REQUEST_TOO_LONG = 413;
  public static final int SC_REQUEST_URI_TOO_LONG = 414;
  public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
  public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
  public static final int SC_EXPECTATION_FAILED = 417;
  public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419;
  public static final int SC_METHOD_FAILURE = 420;
  public static final int SC_UNPROCESSABLE_ENTITY = 422;
  public static final int SC_LOCKED = 423;
  public static final int SC_FAILED_DEPENDENCY = 424;
  public static final int SC_INTERNAL_SERVER_ERROR = 500;
  public static final int SC_NOT_IMPLEMENTED = 501;
  public static final int SC_BAD_GATEWAY = 502;
  public static final int SC_SERVICE_UNAVAILABLE = 503;
  public static final int SC_GATEWAY_TIMEOUT = 504;
  public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
  public static final int SC_INSUFFICIENT_STORAGE = 507;
}

/* Location:
 * Qualified Name:     org.apache.http.HttpStatus
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

import org.apache.http.util.ExceptionUtils;

public class HttpException
  extends Exception
{
  private static final long serialVersionUID = -5437299376222011036L;
  
  public HttpException() {}
  
  public HttpException(String message)
  {
    super(message);
  }
  
  public HttpException(String message, Throwable cause)
  {
    super(message);
    ExceptionUtils.initCause(this, cause);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.HttpException
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import org.apache.http.HeaderElement;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.util.CharArrayBuffer;

public abstract interface HeaderValueParser
{
  public abstract HeaderElement[] parseElements(CharArrayBuffer paramCharArrayBuffer, ParserCursor paramParserCursor)
    throws ParseException;
  
  public abstract HeaderElement parseHeaderElement(CharArrayBuffer paramCharArrayBuffer, ParserCursor paramParserCursor)
    throws ParseException;
  
  public abstract NameValuePair[] parseParameters(CharArrayBuffer paramCharArrayBuffer, ParserCursor paramParserCursor)
    throws ParseException;
  
  public abstract NameValuePair parseNameValuePair(CharArrayBuffer paramCharArrayBuffer, ParserCursor paramParserCursor)
    throws ParseException;
}

/* Location:
 * Qualified Name:     org.apache.http.message.HeaderValueParser
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import java.io.Serializable;
import org.apache.http.ProtocolVersion;
import org.apache.http.RequestLine;
import org.apache.http.util.CharArrayBuffer;

public class BasicRequestLine
  implements RequestLine, Cloneable, Serializable
{
  private static final long serialVersionUID = 2810581718468737193L;
  private final ProtocolVersion protoversion;
  private final String method;
  private final String uri;
  
  public BasicRequestLine(String method, String uri, ProtocolVersion version)
  {
    if (method == null) {
      throw new IllegalArgumentException("Method must not be null.");
    }
    if (uri == null) {
      throw new IllegalArgumentException("URI must not be null.");
    }
    if (version == null) {
      throw new IllegalArgumentException("Protocol version must not be null.");
    }
    this.method = method;
    this.uri = uri;
    protoversion = version;
  }
  
  public String getMethod()
  {
    return method;
  }
  
  public ProtocolVersion getProtocolVersion()
  {
    return protoversion;
  }
  
  public String getUri()
  {
    return uri;
  }
  
  public String toString()
  {
    return BasicLineFormatter.DEFAULT.formatRequestLine(null, this).toString();
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.message.BasicRequestLine
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import org.apache.http.HeaderElement;
import org.apache.http.NameValuePair;
import org.apache.http.util.CharArrayBuffer;

public class BasicHeaderValueFormatter
  implements HeaderValueFormatter
{
  public static final BasicHeaderValueFormatter DEFAULT = new BasicHeaderValueFormatter();
  public static final String SEPARATORS = " ;,:@()<>\\\"/[]?={}\t";
  public static final String UNSAFE_CHARS = "\"\\";
  
  public static final String formatElements(HeaderElement[] elems, boolean quote, HeaderValueFormatter formatter)
  {
    if (formatter == null) {
      formatter = DEFAULT;
    }
    return formatter.formatElements(null, elems, quote).toString();
  }
  
  public CharArrayBuffer formatElements(CharArrayBuffer buffer, HeaderElement[] elems, boolean quote)
  {
    if (elems == null) {
      throw new IllegalArgumentException("Header element array must not be null.");
    }
    int len = estimateElementsLen(elems);
    if (buffer == null) {
      buffer = new CharArrayBuffer(len);
    } else {
      buffer.ensureCapacity(len);
    }
    for (int i = 0; i < elems.length; i++)
    {
      if (i > 0) {
        buffer.append(", ");
      }
      formatHeaderElement(buffer, elems[i], quote);
    }
    return buffer;
  }
  
  protected int estimateElementsLen(HeaderElement[] elems)
  {
    if ((elems == null) || (elems.length < 1)) {
      return 0;
    }
    int result = (elems.length - 1) * 2;
    for (int i = 0; i < elems.length; i++) {
      result += estimateHeaderElementLen(elems[i]);
    }
    return result;
  }
  
  public static final String formatHeaderElement(HeaderElement elem, boolean quote, HeaderValueFormatter formatter)
  {
    if (formatter == null) {
      formatter = DEFAULT;
    }
    return formatter.formatHeaderElement(null, elem, quote).toString();
  }
  
  public CharArrayBuffer formatHeaderElement(CharArrayBuffer buffer, HeaderElement elem, boolean quote)
  {
    if (elem == null) {
      throw new IllegalArgumentException("Header element must not be null.");
    }
    int len = estimateHeaderElementLen(elem);
    if (buffer == null) {
      buffer = new CharArrayBuffer(len);
    } else {
      buffer.ensureCapacity(len);
    }
    buffer.append(elem.getName());
    String value = elem.getValue();
    if (value != null)
    {
      buffer.append('=');
      doFormatValue(buffer, value, quote);
    }
    int parcnt = elem.getParameterCount();
    if (parcnt > 0) {
      for (int i = 0; i < parcnt; i++)
      {
        buffer.append("; ");
        formatNameValuePair(buffer, elem.getParameter(i), quote);
      }
    }
    return buffer;
  }
  
  protected int estimateHeaderElementLen(HeaderElement elem)
  {
    if (elem == null) {
      return 0;
    }
    int result = elem.getName().length();
    String value = elem.getValue();
    if (value != null) {
      result += 3 + value.length();
    }
    int parcnt = elem.getParameterCount();
    if (parcnt > 0) {
      for (int i = 0; i < parcnt; i++) {
        result += 2 + estimateNameValuePairLen(elem.getParameter(i));
      }
    }
    return result;
  }
  
  public static final String formatParameters(NameValuePair[] nvps, boolean quote, HeaderValueFormatter formatter)
  {
    if (formatter == null) {
      formatter = DEFAULT;
    }
    return formatter.formatParameters(null, nvps, quote).toString();
  }
  
  public CharArrayBuffer formatParameters(CharArrayBuffer buffer, NameValuePair[] nvps, boolean quote)
  {
    if (nvps == null) {
      throw new IllegalArgumentException("Parameters must not be null.");
    }
    int len = estimateParametersLen(nvps);
    if (buffer == null) {
      buffer = new CharArrayBuffer(len);
    } else {
      buffer.ensureCapacity(len);
    }
    for (int i = 0; i < nvps.length; i++)
    {
      if (i > 0) {
        buffer.append("; ");
      }
      formatNameValuePair(buffer, nvps[i], quote);
    }
    return buffer;
  }
  
  protected int estimateParametersLen(NameValuePair[] nvps)
  {
    if ((nvps == null) || (nvps.length < 1)) {
      return 0;
    }
    int result = (nvps.length - 1) * 2;
    for (int i = 0; i < nvps.length; i++) {
      result += estimateNameValuePairLen(nvps[i]);
    }
    return result;
  }
  
  public static final String formatNameValuePair(NameValuePair nvp, boolean quote, HeaderValueFormatter formatter)
  {
    if (formatter == null) {
      formatter = DEFAULT;
    }
    return formatter.formatNameValuePair(null, nvp, quote).toString();
  }
  
  public CharArrayBuffer formatNameValuePair(CharArrayBuffer buffer, NameValuePair nvp, boolean quote)
  {
    if (nvp == null) {
      throw new IllegalArgumentException("NameValuePair must not be null.");
    }
    int len = estimateNameValuePairLen(nvp);
    if (buffer == null) {
      buffer = new CharArrayBuffer(len);
    } else {
      buffer.ensureCapacity(len);
    }
    buffer.append(nvp.getName());
    String value = nvp.getValue();
    if (value != null)
    {
      buffer.append('=');
      doFormatValue(buffer, value, quote);
    }
    return buffer;
  }
  
  protected int estimateNameValuePairLen(NameValuePair nvp)
  {
    if (nvp == null) {
      return 0;
    }
    int result = nvp.getName().length();
    String value = nvp.getValue();
    if (value != null) {
      result += 3 + value.length();
    }
    return result;
  }
  
  protected void doFormatValue(CharArrayBuffer buffer, String value, boolean quote)
  {
    if (!quote) {
      for (int i = 0; (i < value.length()) && (!quote); i++) {
        quote = isSeparator(value.charAt(i));
      }
    }
    if (quote) {
      buffer.append('"');
    }
    for (int i = 0; i < value.length(); i++)
    {
      char ch = value.charAt(i);
      if (isUnsafe(ch)) {
        buffer.append('\\');
      }
      buffer.append(ch);
    }
    if (quote) {
      buffer.append('"');
    }
  }
  
  protected boolean isSeparator(char ch)
  {
    return " ;,:@()<>\\\"/[]?={}\t".indexOf(ch) >= 0;
  }
  
  protected boolean isUnsafe(char ch)
  {
    return "\"\\".indexOf(ch) >= 0;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.message.BasicHeaderValueFormatter
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.apache.http.Header;
import org.apache.http.HeaderIterator;
import org.apache.http.util.CharArrayBuffer;

public class HeaderGroup
  implements Cloneable, Serializable
{
  private static final long serialVersionUID = 2608834160639271617L;
  private final List headers;
  
  public HeaderGroup()
  {
    headers = new ArrayList(16);
  }
  
  public void clear()
  {
    headers.clear();
  }
  
  public void addHeader(Header header)
  {
    if (header == null) {
      return;
    }
    headers.add(header);
  }
  
  public void removeHeader(Header header)
  {
    if (header == null) {
      return;
    }
    headers.remove(header);
  }
  
  public void updateHeader(Header header)
  {
    if (header == null) {
      return;
    }
    for (int i = 0; i < headers.size(); i++)
    {
      Header current = (Header)headers.get(i);
      if (current.getName().equalsIgnoreCase(header.getName()))
      {
        headers.set(i, header);
        return;
      }
    }
    headers.add(header);
  }
  
  public void setHeaders(Header[] headers)
  {
    clear();
    if (headers == null) {
      return;
    }
    for (int i = 0; i < headers.length; i++) {
      this.headers.add(headers[i]);
    }
  }
  
  public Header getCondensedHeader(String name)
  {
    Header[] headers = getHeaders(name);
    if (headers.length == 0) {
      return null;
    }
    if (headers.length == 1) {
      return headers[0];
    }
    CharArrayBuffer valueBuffer = new CharArrayBuffer(128);
    valueBuffer.append(headers[0].getValue());
    for (int i = 1; i < headers.length; i++)
    {
      valueBuffer.append(", ");
      valueBuffer.append(headers[i].getValue());
    }
    return new BasicHeader(name.toLowerCase(Locale.ENGLISH), valueBuffer.toString());
  }
  
  public Header[] getHeaders(String name)
  {
    ArrayList headersFound = new ArrayList();
    for (int i = 0; i < headers.size(); i++)
    {
      Header header = (Header)headers.get(i);
      if (header.getName().equalsIgnoreCase(name)) {
        headersFound.add(header);
      }
    }
    return (Header[])headersFound.toArray(new Header[headersFound.size()]);
  }
  
  public Header getFirstHeader(String name)
  {
    for (int i = 0; i < headers.size(); i++)
    {
      Header header = (Header)headers.get(i);
      if (header.getName().equalsIgnoreCase(name)) {
        return header;
      }
    }
    return null;
  }
  
  public Header getLastHeader(String name)
  {
    for (int i = headers.size() - 1; i >= 0; i--)
    {
      Header header = (Header)headers.get(i);
      if (header.getName().equalsIgnoreCase(name)) {
        return header;
      }
    }
    return null;
  }
  
  public Header[] getAllHeaders()
  {
    return (Header[])headers.toArray(new Header[headers.size()]);
  }
  
  public boolean containsHeader(String name)
  {
    for (int i = 0; i < headers.size(); i++)
    {
      Header header = (Header)headers.get(i);
      if (header.getName().equalsIgnoreCase(name)) {
        return true;
      }
    }
    return false;
  }
  
  public HeaderIterator iterator()
  {
    return new BasicListHeaderIterator(headers, null);
  }
  
  public HeaderIterator iterator(String name)
  {
    return new BasicListHeaderIterator(headers, name);
  }
  
  public HeaderGroup copy()
  {
    HeaderGroup clone = new HeaderGroup();
    headers.addAll(headers);
    return clone;
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    HeaderGroup clone = (HeaderGroup)super.clone();
    headers.clear();
    headers.addAll(headers);
    return clone;
  }
  
  public String toString()
  {
    return headers.toString();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.message.HeaderGroup
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import java.util.Iterator;
import org.apache.http.Header;
import org.apache.http.HeaderIterator;
import org.apache.http.HttpMessage;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;

public abstract class AbstractHttpMessage
  implements HttpMessage
{
  protected HeaderGroup headergroup;
  protected HttpParams params;
  
  protected AbstractHttpMessage(HttpParams params)
  {
    headergroup = new HeaderGroup();
    this.params = params;
  }
  
  protected AbstractHttpMessage()
  {
    this(null);
  }
  
  public boolean containsHeader(String name)
  {
    return headergroup.containsHeader(name);
  }
  
  public Header[] getHeaders(String name)
  {
    return headergroup.getHeaders(name);
  }
  
  public Header getFirstHeader(String name)
  {
    return headergroup.getFirstHeader(name);
  }
  
  public Header getLastHeader(String name)
  {
    return headergroup.getLastHeader(name);
  }
  
  public Header[] getAllHeaders()
  {
    return headergroup.getAllHeaders();
  }
  
  public void addHeader(Header header)
  {
    headergroup.addHeader(header);
  }
  
  public void addHeader(String name, String value)
  {
    if (name == null) {
      throw new IllegalArgumentException("Header name may not be null");
    }
    headergroup.addHeader(new BasicHeader(name, value));
  }
  
  public void setHeader(Header header)
  {
    headergroup.updateHeader(header);
  }
  
  public void setHeader(String name, String value)
  {
    if (name == null) {
      throw new IllegalArgumentException("Header name may not be null");
    }
    headergroup.updateHeader(new BasicHeader(name, value));
  }
  
  public void setHeaders(Header[] headers)
  {
    headergroup.setHeaders(headers);
  }
  
  public void removeHeader(Header header)
  {
    headergroup.removeHeader(header);
  }
  
  public void removeHeaders(String name)
  {
    if (name == null) {
      return;
    }
    for (Iterator i = headergroup.iterator(); i.hasNext();)
    {
      Header header = (Header)i.next();
      if (name.equalsIgnoreCase(header.getName())) {
        i.remove();
      }
    }
  }
  
  public HeaderIterator headerIterator()
  {
    return headergroup.iterator();
  }
  
  public HeaderIterator headerIterator(String name)
  {
    return headergroup.iterator(name);
  }
  
  public HttpParams getParams()
  {
    if (params == null) {
      params = new BasicHttpParams();
    }
    return params;
  }
  
  public void setParams(HttpParams params)
  {
    if (params == null) {
      throw new IllegalArgumentException("HTTP parameters may not be null");
    }
    this.params = params;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.message.AbstractHttpMessage
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import java.util.NoSuchElementException;
import org.apache.http.Header;
import org.apache.http.HeaderIterator;
import org.apache.http.ParseException;
import org.apache.http.TokenIterator;

public class BasicTokenIterator
  implements TokenIterator
{
  public static final String HTTP_SEPARATORS = " ,;=()<>@:\\\"/[]?{}\t";
  protected final HeaderIterator headerIt;
  protected String currentHeader;
  protected String currentToken;
  protected int searchPos;
  
  public BasicTokenIterator(HeaderIterator headerIterator)
  {
    if (headerIterator == null) {
      throw new IllegalArgumentException("Header iterator must not be null.");
    }
    headerIt = headerIterator;
    searchPos = findNext(-1);
  }
  
  public boolean hasNext()
  {
    return currentToken != null;
  }
  
  public String nextToken()
    throws NoSuchElementException, ParseException
  {
    if (currentToken == null) {
      throw new NoSuchElementException("Iteration already finished.");
    }
    String result = currentToken;
    
    searchPos = findNext(searchPos);
    
    return result;
  }
  
  public final Object next()
    throws NoSuchElementException, ParseException
  {
    return nextToken();
  }
  
  public final void remove()
    throws UnsupportedOperationException
  {
    throw new UnsupportedOperationException("Removing tokens is not supported.");
  }
  
  protected int findNext(int from)
    throws ParseException
  {
    if (from < 0)
    {
      if (!headerIt.hasNext()) {
        return -1;
      }
      currentHeader = headerIt.nextHeader().getValue();
      from = 0;
    }
    else
    {
      from = findTokenSeparator(from);
    }
    int start = findTokenStart(from);
    if (start < 0)
    {
      currentToken = null;
      return -1;
    }
    int end = findTokenEnd(start);
    currentToken = createToken(currentHeader, start, end);
    return end;
  }
  
  protected String createToken(String value, int start, int end)
  {
    return value.substring(start, end);
  }
  
  protected int findTokenStart(int from)
  {
    if (from < 0) {
      throw new IllegalArgumentException("Search position must not be negative: " + from);
    }
    boolean found = false;
    while ((!found) && (currentHeader != null))
    {
      int to = currentHeader.length();
      while ((!found) && (from < to))
      {
        char ch = currentHeader.charAt(from);
        if ((isTokenSeparator(ch)) || (isWhitespace(ch))) {
          from++;
        } else if (isTokenChar(currentHeader.charAt(from))) {
          found = true;
        } else {
          throw new ParseException("Invalid character before token (pos " + from + "): " + currentHeader);
        }
      }
      if (!found) {
        if (headerIt.hasNext())
        {
          currentHeader = headerIt.nextHeader().getValue();
          from = 0;
        }
        else
        {
          currentHeader = null;
        }
      }
    }
    return found ? from : -1;
  }
  
  protected int findTokenSeparator(int from)
  {
    if (from < 0) {
      throw new IllegalArgumentException("Search position must not be negative: " + from);
    }
    boolean found = false;
    int to = currentHeader.length();
    while ((!found) && (from < to))
    {
      char ch = currentHeader.charAt(from);
      if (isTokenSeparator(ch))
      {
        found = true;
      }
      else if (isWhitespace(ch))
      {
        from++;
      }
      else
      {
        if (isTokenChar(ch)) {
          throw new ParseException("Tokens without separator (pos " + from + "): " + currentHeader);
        }
        throw new ParseException("Invalid character after token (pos " + from + "): " + currentHeader);
      }
    }
    return from;
  }
  
  protected int findTokenEnd(int from)
  {
    if (from < 0) {
      throw new IllegalArgumentException("Token start position must not be negative: " + from);
    }
    int to = currentHeader.length();
    int end = from + 1;
    while ((end < to) && (isTokenChar(currentHeader.charAt(end)))) {
      end++;
    }
    return end;
  }
  
  protected boolean isTokenSeparator(char ch)
  {
    return ch == ',';
  }
  
  protected boolean isWhitespace(char ch)
  {
    return (ch == '\t') || (Character.isSpaceChar(ch));
  }
  
  protected boolean isTokenChar(char ch)
  {
    if (Character.isLetterOrDigit(ch)) {
      return true;
    }
    if (Character.isISOControl(ch)) {
      return false;
    }
    if (isHttpSeparator(ch)) {
      return false;
    }
    return true;
  }
  
  protected boolean isHttpSeparator(char ch)
  {
    return " ,;=()<>@:\\\"/[]?{}\t".indexOf(ch) >= 0;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.message.BasicTokenIterator
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import org.apache.http.Header;
import org.apache.http.ProtocolVersion;
import org.apache.http.RequestLine;
import org.apache.http.StatusLine;
import org.apache.http.util.CharArrayBuffer;

public abstract interface LineFormatter
{
  public abstract CharArrayBuffer appendProtocolVersion(CharArrayBuffer paramCharArrayBuffer, ProtocolVersion paramProtocolVersion);
  
  public abstract CharArrayBuffer formatRequestLine(CharArrayBuffer paramCharArrayBuffer, RequestLine paramRequestLine);
  
  public abstract CharArrayBuffer formatStatusLine(CharArrayBuffer paramCharArrayBuffer, StatusLine paramStatusLine);
  
  public abstract CharArrayBuffer formatHeader(CharArrayBuffer paramCharArrayBuffer, Header paramHeader);
}

/* Location:
 * Qualified Name:     org.apache.http.message.LineFormatter
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import java.io.Serializable;
import org.apache.http.FormattedHeader;
import org.apache.http.HeaderElement;
import org.apache.http.ParseException;
import org.apache.http.util.CharArrayBuffer;

public class BufferedHeader
  implements FormattedHeader, Cloneable, Serializable
{
  private static final long serialVersionUID = -2768352615787625448L;
  private final String name;
  private final CharArrayBuffer buffer;
  private final int valuePos;
  
  public BufferedHeader(CharArrayBuffer buffer)
    throws ParseException
  {
    if (buffer == null) {
      throw new IllegalArgumentException("Char array buffer may not be null");
    }
    int colon = buffer.indexOf(58);
    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;
    name = s;
    valuePos = (colon + 1);
  }
  
  public String getName()
  {
    return name;
  }
  
  public String getValue()
  {
    return buffer.substringTrimmed(valuePos, buffer.length());
  }
  
  public HeaderElement[] getElements()
    throws ParseException
  {
    ParserCursor cursor = new ParserCursor(0, buffer.length());
    cursor.updatePos(valuePos);
    return BasicHeaderValueParser.DEFAULT.parseElements(buffer, cursor);
  }
  
  public int getValuePos()
  {
    return valuePos;
  }
  
  public CharArrayBuffer getBuffer()
  {
    return buffer;
  }
  
  public String toString()
  {
    return buffer.toString();
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.message.BufferedHeader
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import java.util.Locale;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.ReasonPhraseCatalog;
import org.apache.http.StatusLine;

public class BasicHttpResponse
  extends AbstractHttpMessage
  implements HttpResponse
{
  private StatusLine statusline;
  private HttpEntity entity;
  private ReasonPhraseCatalog reasonCatalog;
  private Locale locale;
  
  public BasicHttpResponse(StatusLine statusline, ReasonPhraseCatalog catalog, Locale locale)
  {
    if (statusline == null) {
      throw new IllegalArgumentException("Status line may not be null.");
    }
    this.statusline = statusline;
    reasonCatalog = catalog;
    this.locale = (locale != null ? locale : Locale.getDefault());
  }
  
  public BasicHttpResponse(StatusLine statusline)
  {
    this(statusline, null, null);
  }
  
  public BasicHttpResponse(ProtocolVersion ver, int code, String reason)
  {
    this(new BasicStatusLine(ver, code, reason), null, null);
  }
  
  public ProtocolVersion getProtocolVersion()
  {
    return statusline.getProtocolVersion();
  }
  
  public StatusLine getStatusLine()
  {
    return statusline;
  }
  
  public HttpEntity getEntity()
  {
    return entity;
  }
  
  public Locale getLocale()
  {
    return locale;
  }
  
  public void setStatusLine(StatusLine statusline)
  {
    if (statusline == null) {
      throw new IllegalArgumentException("Status line may not be null");
    }
    this.statusline = statusline;
  }
  
  public void setStatusLine(ProtocolVersion ver, int code)
  {
    statusline = new BasicStatusLine(ver, code, getReason(code));
  }
  
  public void setStatusLine(ProtocolVersion ver, int code, String reason)
  {
    statusline = new BasicStatusLine(ver, code, reason);
  }
  
  public void setStatusCode(int code)
  {
    ProtocolVersion ver = statusline.getProtocolVersion();
    statusline = new BasicStatusLine(ver, code, getReason(code));
  }
  
  public void setReasonPhrase(String reason)
  {
    if ((reason != null) && ((reason.indexOf('\n') >= 0) || (reason.indexOf('\r') >= 0))) {
      throw new IllegalArgumentException("Line break in reason phrase.");
    }
    statusline = new BasicStatusLine(statusline.getProtocolVersion(), statusline.getStatusCode(), reason);
  }
  
  public void setEntity(HttpEntity entity)
  {
    this.entity = entity;
  }
  
  public void setLocale(Locale loc)
  {
    if (loc == null) {
      throw new IllegalArgumentException("Locale may not be null.");
    }
    locale = loc;
    int code = statusline.getStatusCode();
    statusline = new BasicStatusLine(statusline.getProtocolVersion(), code, getReason(code));
  }
  
  protected String getReason(int code)
  {
    return reasonCatalog == null ? null : reasonCatalog.getReason(code, locale);
  }
  
  public String toString()
  {
    return statusline + " " + headergroup;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.message.BasicHttpResponse
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import org.apache.http.Header;
import org.apache.http.ParseException;
import org.apache.http.ProtocolVersion;
import org.apache.http.RequestLine;
import org.apache.http.StatusLine;
import org.apache.http.util.CharArrayBuffer;

public abstract interface LineParser
{
  public abstract ProtocolVersion parseProtocolVersion(CharArrayBuffer paramCharArrayBuffer, ParserCursor paramParserCursor)
    throws ParseException;
  
  public abstract boolean hasProtocolVersion(CharArrayBuffer paramCharArrayBuffer, ParserCursor paramParserCursor);
  
  public abstract RequestLine parseRequestLine(CharArrayBuffer paramCharArrayBuffer, ParserCursor paramParserCursor)
    throws ParseException;
  
  public abstract StatusLine parseStatusLine(CharArrayBuffer paramCharArrayBuffer, ParserCursor paramParserCursor)
    throws ParseException;
  
  public abstract Header parseHeader(CharArrayBuffer paramCharArrayBuffer)
    throws ParseException;
}

/* Location:
 * Qualified Name:     org.apache.http.message.LineParser
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import org.apache.http.HeaderElement;
import org.apache.http.NameValuePair;
import org.apache.http.util.CharArrayBuffer;

public abstract interface HeaderValueFormatter
{
  public abstract CharArrayBuffer formatElements(CharArrayBuffer paramCharArrayBuffer, HeaderElement[] paramArrayOfHeaderElement, boolean paramBoolean);
  
  public abstract CharArrayBuffer formatHeaderElement(CharArrayBuffer paramCharArrayBuffer, HeaderElement paramHeaderElement, boolean paramBoolean);
  
  public abstract CharArrayBuffer formatParameters(CharArrayBuffer paramCharArrayBuffer, NameValuePair[] paramArrayOfNameValuePair, boolean paramBoolean);
  
  public abstract CharArrayBuffer formatNameValuePair(CharArrayBuffer paramCharArrayBuffer, NameValuePair paramNameValuePair, boolean paramBoolean);
}

/* Location:
 * Qualified Name:     org.apache.http.message.HeaderValueFormatter
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.ProtocolVersion;
import org.apache.http.RequestLine;

public class BasicHttpEntityEnclosingRequest
  extends BasicHttpRequest
  implements HttpEntityEnclosingRequest
{
  private HttpEntity entity;
  
  public BasicHttpEntityEnclosingRequest(String method, String uri)
  {
    super(method, uri);
  }
  
  public BasicHttpEntityEnclosingRequest(String method, String uri, ProtocolVersion ver)
  {
    super(method, uri, ver);
  }
  
  public BasicHttpEntityEnclosingRequest(RequestLine requestline)
  {
    super(requestline);
  }
  
  public HttpEntity getEntity()
  {
    return entity;
  }
  
  public void setEntity(HttpEntity entity)
  {
    this.entity = entity;
  }
  
  public boolean expectContinue()
  {
    Header expect = getFirstHeader("Expect");
    return (expect != null) && ("100-continue".equalsIgnoreCase(expect.getValue()));
  }
}

/* Location:
 * Qualified Name:     org.apache.http.message.BasicHttpEntityEnclosingRequest
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.message;

import java.util.ArrayList;
import java.util.List;
import org.apache.http.HeaderElement;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.CharArrayBuffer;

public class BasicHeaderValueParser
  implements HeaderValueParser
{
  public static final BasicHeaderValueParser DEFAULT = new BasicHeaderValueParser();
  private static final char PARAM_DELIMITER = ';';
  private static final char ELEM_DELIMITER = ',';
  private static final char[] ALL_DELIMITERS = { ';', ',' };
  
  public static final HeaderElement[] parseElements(String value, HeaderValueParser parser)
    throws ParseException
  {
    if (value == null) {
      throw new IllegalArgumentException("Value to parse may not be null");
    }
    if (parser == null) {
      parser = DEFAULT;
    }
    CharArrayBuffer buffer = new CharArrayBuffer(value.length());
    buffer.append(value);
    ParserCursor cursor = new ParserCursor(0, value.length());
    return parser.parseElements(buffer, cursor);
  }
  
  public HeaderElement[] parseElements(CharArrayBuffer buffer, ParserCursor cursor)
  {
    if (buffer =
1 2 3 4 5 6 7 8

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd