com.crashlytics.tools.android_2.1.0

ultipartForm form;
    switch (m)
    {
    case BROWSER_COMPATIBLE: 
      form = new HttpBrowserCompatibleMultipart(st, cs, b, bps);
      break;
    case RFC6532: 
      form = new HttpRFC6532Multipart(st, cs, b, bps);
      break;
    default: 
      form = new HttpStrictMultipart(st, cs, b, bps);
    }
    return new MultipartFormEntity(form, generateContentType(b, cs), form.getTotalLength());
  }
  
  public HttpEntity build()
  {
    return buildEntity();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.mime.MultipartEntityBuilder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity.mime;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.message.BasicHeader;

class MultipartFormEntity
  implements HttpEntity
{
  private final AbstractMultipartForm multipart;
  private final Header contentType;
  private final long contentLength;
  
  MultipartFormEntity(AbstractMultipartForm multipart, String contentType, long contentLength)
  {
    this.multipart = multipart;
    this.contentType = new BasicHeader("Content-Type", contentType);
    this.contentLength = contentLength;
  }
  
  AbstractMultipartForm getMultipart()
  {
    return multipart;
  }
  
  public boolean isRepeatable()
  {
    return contentLength != -1L;
  }
  
  public boolean isChunked()
  {
    return !isRepeatable();
  }
  
  public boolean isStreaming()
  {
    return !isRepeatable();
  }
  
  public long getContentLength()
  {
    return contentLength;
  }
  
  public Header getContentType()
  {
    return contentType;
  }
  
  public Header getContentEncoding()
  {
    return null;
  }
  
  public void consumeContent()
    throws IOException, UnsupportedOperationException
  {
    if (isStreaming()) {
      throw new UnsupportedOperationException("Streaming entity does not implement #consumeContent()");
    }
  }
  
  public InputStream getContent()
    throws IOException
  {
    throw new UnsupportedOperationException("Multipart form entity does not implement #getContent()");
  }
  
  public void writeTo(OutputStream outstream)
    throws IOException
  {
    multipart.writeTo(outstream);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.mime.MultipartFormEntity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity.mime.content;

import java.nio.charset.Charset;
import org.apache.http.entity.ContentType;
import org.apache.http.util.Args;

public abstract class AbstractContentBody
  implements ContentBody
{
  private final ContentType contentType;
  
  public AbstractContentBody(ContentType contentType)
  {
    Args.notNull(contentType, "Content type");
    this.contentType = contentType;
  }
  
  @Deprecated
  public AbstractContentBody(String mimeType)
  {
    this(ContentType.parse(mimeType));
  }
  
  public ContentType getContentType()
  {
    return contentType;
  }
  
  public String getMimeType()
  {
    return contentType.getMimeType();
  }
  
  public String getMediaType()
  {
    String mimeType = contentType.getMimeType();
    int i = mimeType.indexOf('/');
    if (i != -1) {
      return mimeType.substring(0, i);
    }
    return mimeType;
  }
  
  public String getSubType()
  {
    String mimeType = contentType.getMimeType();
    int i = mimeType.indexOf('/');
    if (i != -1) {
      return mimeType.substring(i + 1);
    }
    return null;
  }
  
  public String getCharset()
  {
    Charset charset = contentType.getCharset();
    return charset != null ? charset.name() : null;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.mime.content.AbstractContentBody
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity.mime.content;

import java.io.IOException;
import java.io.OutputStream;
import org.apache.http.entity.ContentType;
import org.apache.http.util.Args;

public class ByteArrayBody
  extends AbstractContentBody
{
  private final byte[] data;
  private final String filename;
  
  @Deprecated
  public ByteArrayBody(byte[] data, String mimeType, String filename)
  {
    this(data, ContentType.create(mimeType), filename);
  }
  
  public ByteArrayBody(byte[] data, ContentType contentType, String filename)
  {
    super(contentType);
    Args.notNull(data, "byte[]");
    this.data = data;
    this.filename = filename;
  }
  
  public ByteArrayBody(byte[] data, String filename)
  {
    this(data, "application/octet-stream", filename);
  }
  
  public String getFilename()
  {
    return filename;
  }
  
  public void writeTo(OutputStream out)
    throws IOException
  {
    out.write(data);
  }
  
  public String getCharset()
  {
    return null;
  }
  
  public String getTransferEncoding()
  {
    return "binary";
  }
  
  public long getContentLength()
  {
    return data.length;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.mime.content.ByteArrayBody
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity.mime.content;

import java.io.IOException;
import java.io.OutputStream;

public abstract interface ContentBody
  extends ContentDescriptor
{
  public abstract String getFilename();
  
  public abstract void writeTo(OutputStream paramOutputStream)
    throws IOException;
}

/* Location:
 * Qualified Name:     org.apache.http.entity.mime.content.ContentBody
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity.mime.content;

public abstract interface ContentDescriptor
{
  public abstract String getMimeType();
  
  public abstract String getMediaType();
  
  public abstract String getSubType();
  
  public abstract String getCharset();
  
  public abstract String getTransferEncoding();
  
  public abstract long getContentLength();
}

/* Location:
 * Qualified Name:     org.apache.http.entity.mime.content.ContentDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity.mime.content;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.entity.ContentType;
import org.apache.http.util.Args;

public class FileBody
  extends AbstractContentBody
{
  private final File file;
  private final String filename;
  
  @Deprecated
  public FileBody(File file, String filename, String mimeType, String charset)
  {
    this(file, ContentType.create(mimeType, charset), filename);
  }
  
  @Deprecated
  public FileBody(File file, String mimeType, String charset)
  {
    this(file, null, mimeType, charset);
  }
  
  @Deprecated
  public FileBody(File file, String mimeType)
  {
    this(file, ContentType.create(mimeType), null);
  }
  
  public FileBody(File file)
  {
    this(file, ContentType.DEFAULT_BINARY, file != null ? file.getName() : null);
  }
  
  public FileBody(File file, ContentType contentType, String filename)
  {
    super(contentType);
    Args.notNull(file, "File");
    this.file = file;
    this.filename = filename;
  }
  
  public FileBody(File file, ContentType contentType)
  {
    this(file, contentType, null);
  }
  
  public InputStream getInputStream()
    throws IOException
  {
    return new FileInputStream(file);
  }
  
  public void writeTo(OutputStream out)
    throws IOException
  {
    Args.notNull(out, "Output stream");
    InputStream in = new FileInputStream(file);
    try
    {
      byte[] tmp = new byte['?'];
      int l;
      while ((l = in.read(tmp)) != -1) {
        out.write(tmp, 0, l);
      }
      out.flush();
    }
    finally
    {
      in.close();
    }
  }
  
  public String getTransferEncoding()
  {
    return "binary";
  }
  
  public long getContentLength()
  {
    return file.length();
  }
  
  public String getFilename()
  {
    return filename;
  }
  
  public File getFile()
  {
    return file;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.mime.content.FileBody
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity.mime.content;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.entity.ContentType;
import org.apache.http.util.Args;

public class InputStreamBody
  extends AbstractContentBody
{
  private final InputStream in;
  private final String filename;
  
  @Deprecated
  public InputStreamBody(InputStream in, String mimeType, String filename)
  {
    this(in, ContentType.create(mimeType), filename);
  }
  
  public InputStreamBody(InputStream in, String filename)
  {
    this(in, ContentType.DEFAULT_BINARY, filename);
  }
  
  public InputStreamBody(InputStream in, ContentType contentType, String filename)
  {
    super(contentType);
    Args.notNull(in, "Input stream");
    this.in = in;
    this.filename = filename;
  }
  
  public InputStreamBody(InputStream in, ContentType contentType)
  {
    this(in, contentType, null);
  }
  
  public InputStream getInputStream()
  {
    return in;
  }
  
  public void writeTo(OutputStream out)
    throws IOException
  {
    Args.notNull(out, "Output stream");
    try
    {
      byte[] tmp = new byte['?'];
      int l;
      while ((l = in.read(tmp)) != -1) {
        out.write(tmp, 0, l);
      }
      out.flush();
    }
    finally
    {
      in.close();
    }
  }
  
  public String getTransferEncoding()
  {
    return "binary";
  }
  
  public long getContentLength()
  {
    return -1L;
  }
  
  public String getFilename()
  {
    return filename;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.mime.content.InputStreamBody
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity.mime.content;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import org.apache.http.Consts;
import org.apache.http.entity.ContentType;
import org.apache.http.util.Args;

public class StringBody
  extends AbstractContentBody
{
  private final byte[] content;
  
  @Deprecated
  public static StringBody create(String text, String mimeType, Charset charset)
    throws IllegalArgumentException
  {
    try
    {
      return new StringBody(text, mimeType, charset);
    }
    catch (UnsupportedEncodingException ex)
    {
      throw new IllegalArgumentException("Charset " + charset + " is not supported", ex);
    }
  }
  
  @Deprecated
  public static StringBody create(String text, Charset charset)
    throws IllegalArgumentException
  {
    return create(text, null, charset);
  }
  
  @Deprecated
  public static StringBody create(String text)
    throws IllegalArgumentException
  {
    return create(text, null, null);
  }
  
  @Deprecated
  public StringBody(String text, String mimeType, Charset charset)
    throws UnsupportedEncodingException
  {
    this(text, ContentType.create(mimeType, charset));
  }
  
  @Deprecated
  public StringBody(String text, Charset charset)
    throws UnsupportedEncodingException
  {
    this(text, "text/plain", charset);
  }
  
  @Deprecated
  public StringBody(String text)
    throws UnsupportedEncodingException
  {
    this(text, "text/plain", Consts.ASCII);
  }
  
  public StringBody(String text, ContentType contentType)
  {
    super(contentType);
    Charset charset = contentType.getCharset();
    String csname = charset != null ? charset.name() : Consts.ASCII.name();
    try
    {
      content = text.getBytes(csname);
    }
    catch (UnsupportedEncodingException ex)
    {
      throw new UnsupportedCharsetException(csname);
    }
  }
  
  public Reader getReader()
  {
    Charset charset = getContentType().getCharset();
    return new InputStreamReader(new ByteArrayInputStream(content), charset != null ? charset : Consts.ASCII);
  }
  
  public void writeTo(OutputStream out)
    throws IOException
  {
    Args.notNull(out, "Output stream");
    InputStream in = new ByteArrayInputStream(content);
    byte[] tmp = new byte['?'];
    int l;
    while ((l = in.read(tmp)) != -1) {
      out.write(tmp, 0, l);
    }
    out.flush();
  }
  
  public String getTransferEncoding()
  {
    return "8bit";
  }
  
  public long getContentLength()
  {
    return content.length;
  }
  
  public String getFilename()
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.mime.content.StringBody
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.client.fluent;

import org.apache.http.client.ResponseHandler;
import org.apache.http.concurrent.BasicFuture;

class Async$ExecRunnable<T>
  implements Runnable
{
  private final BasicFuture<T> future;
  private final Request request;
  private final Executor executor;
  private final ResponseHandler<T> handler;
  
  Async$ExecRunnable(BasicFuture<T> future, Request request, Executor executor, ResponseHandler<T> handler)
  {
    this.future = future;
    this.request = request;
    this.executor = executor;
    this.handler = handler;
  }
  
  public void run()
  {
    try
    {
      Response response = executor.execute(request);
      T result = response.handleResponse(handler);
      future.completed(result);
    }
    catch (Exception ex)
    {
      future.failed(ex);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.http.client.fluent.Async.ExecRunnable
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.client.fluent;

import java.util.concurrent.Future;
import org.apache.http.client.ResponseHandler;
import org.apache.http.concurrent.BasicFuture;
import org.apache.http.concurrent.FutureCallback;

public class Async
{
  private Executor executor;
  private java.util.concurrent.Executor concurrentExec;
  
  public static Async newInstance()
  {
    return new Async();
  }
  
  public Async use(Executor executor)
  {
    this.executor = executor;
    return this;
  }
  
  public Async use(java.util.concurrent.Executor concurrentExec)
  {
    this.concurrentExec = concurrentExec;
    return this;
  }
  
  static class ExecRunnable<T>
    implements Runnable
  {
    private final BasicFuture<T> future;
    private final Request request;
    private final Executor executor;
    private final ResponseHandler<T> handler;
    
    ExecRunnable(BasicFuture<T> future, Request request, Executor executor, ResponseHandler<T> handler)
    {
      this.future = future;
      this.request = request;
      this.executor = executor;
      this.handler = handler;
    }
    
    public void run()
    {
      try
      {
        Response response = executor.execute(request);
        T result = response.handleResponse(handler);
        future.completed(result);
      }
      catch (Exception ex)
      {
        future.failed(ex);
      }
    }
  }
  
  public <T> Future<T> execute(Request request, ResponseHandler<T> handler, FutureCallback<T> callback)
  {
    BasicFuture<T> future = new BasicFuture(callback);
    ExecRunnable<T> runnable = new ExecRunnable(future, request, executor != null ? executor : Executor.newInstance(), handler);
    if (concurrentExec != null)
    {
      concurrentExec.execute(runnable);
    }
    else
    {
      Thread t = new Thread(runnable);
      t.setDaemon(true);
      t.start();
    }
    return future;
  }
  
  public <T> Future<T> execute(Request request, ResponseHandler<T> handler)
  {
    return execute(request, handler, null);
  }
  
  public Future<Content> execute(Request request, FutureCallback<Content> callback)
  {
    return execute(request, new ContentResponseHandler(), callback);
  }
  
  public Future<Content> execute(Request request)
  {
    return execute(request, new ContentResponseHandler(), null);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.client.fluent.Async
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.client.fluent;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import org.apache.http.entity.ContentType;
import org.apache.http.protocol.HTTP;

public class Content
{
  public static final Content NO_CONTENT = new Content(new byte[0], ContentType.DEFAULT_BINARY);
  private final byte[] raw;
  private final ContentType type;
  
  Content(byte[] raw, ContentType type)
  {
    this.raw = raw;
    this.type = type;
  }
  
  public ContentType getType()
  {
    return type;
  }
  
  public byte[] asBytes()
  {
    return (byte[])raw.clone();
  }
  
  public String asString()
  {
    Charset charset = type.getCharset();
    if (charset == null) {
      charset = HTTP.DEF_CONTENT_CHARSET;
    }
    try
    {
      return new String(raw, charset.name());
    }
    catch (UnsupportedEncodingException ex) {}
    return new String(raw);
  }
  
  public InputStream asStream()
  {
    return new ByteArrayInputStream(raw);
  }
  
  public String toString()
  {
    return asString();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.client.fluent.Content
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.client.fluent;

import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.entity.ContentType;
import org.apache.http.util.EntityUtils;

class ContentResponseHandler
  implements ResponseHandler<Content>
{
  public Content handleResponse(HttpResponse response)
    throws ClientProtocolException, IOException
  {
    StatusLine statusLine = response.getStatusLine();
    HttpEntity entity = response.getEntity();
    if (statusLine.getStatusCode() >= 300) {
      throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase());
    }
    if (entity != null) {
      return new Content(EntityUtils.toByteArray(entity), ContentType.getOrDefault(entity));
    }
    return Content.NO_CONTENT;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.client.fluent.ContentResponseHandler
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.client.fluent;

import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.SSLContext;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.MalformedChallengeException;
import org.apache.http.auth.NTCredentials;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.AuthCache;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.CookieStore;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLInitializationException;
import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.impl.client.BasicAuthCache;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicHeader;
import org.apache.http.protocol.BasicHttpContext;

public class Executor
{
  static final PoolingHttpClientConnectionManager CONNMGR;
  
  static
  {
    LayeredConnectionSocketFactory ssl = null;
    try
    {
      ssl = SSLConnectionSocketFactory.getSystemSocketFactory();
    }
    catch (SSLInitializationException ex)
    {
      try
      {
        SSLContext sslcontext = SSLContext.getInstance("TLS");
        sslcontext.init(null, null, null);
        ssl = new SSLConnectionSocketFactory(sslcontext);
      }
      catch (SecurityException ignore) {}catch (KeyManagementException ignore) {}catch (NoSuchAlgorithmException ignore) {}
    }
    Registry<ConnectionSocketFactory> sfr = RegistryBuilder.create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", ssl != null ? ssl : SSLConnectionSocketFactory.getSocketFactory()).build();
    
    CONNMGR = new PoolingHttpClientConnectionManager(sfr);
    CONNMGR.setDefaultMaxPerRoute(100);
    CONNMGR.setMaxTotal(200);
  }
  
  static final HttpClient CLIENT = HttpClientBuilder.create().setConnectionManager(CONNMGR).build();
  private final HttpClient httpclient;
  private final BasicHttpContext localContext;
  private final AuthCache authCache;
  private CredentialsProvider credentialsProvider;
  private CookieStore cookieStore;
  
  public static Executor newInstance()
  {
    return new Executor(CLIENT);
  }
  
  public static Executor newInstance(HttpClient httpclient)
  {
    return new Executor(httpclient != null ? httpclient : CLIENT);
  }
  
  Executor(HttpClient httpclient)
  {
    this.httpclient = httpclient;
    localContext = new BasicHttpContext();
    authCache = new BasicAuthCache();
  }
  
  public Executor auth(AuthScope authScope, Credentials creds)
  {
    if (credentialsProvider == null) {
      credentialsProvider = new BasicCredentialsProvider();
    }
    credentialsProvider.setCredentials(authScope, creds);
    return this;
  }
  
  public Executor auth(HttpHost host, Credentials creds)
  {
    AuthScope authScope = host != null ? new AuthScope(host) : AuthScope.ANY;
    return auth(authScope, creds);
  }
  
  public Executor authPreemptive(HttpHost host)
  {
    BasicScheme basicScheme = new BasicScheme();
    try
    {
      basicScheme.processChallenge(new BasicHeader("WWW-Authenticate", "BASIC "));
    }
    catch (MalformedChallengeException ignore) {}
    authCache.put(host, basicScheme);
    return this;
  }
  
  public Executor authPreemptiveProxy(HttpHost host)
  {
    BasicScheme basicScheme = new BasicScheme();
    try
    {
      basicScheme.processChallenge(new BasicHeader("Proxy-Authenticate", "BASIC "));
    }
    catch (MalformedChallengeException ignore) {}
    authCache.put(host, basicScheme);
    return this;
  }
  
  public Executor auth(Credentials cred)
  {
    return auth(AuthScope.ANY, cred);
  }
  
  public Executor auth(String username, String password)
  {
    return auth(new UsernamePasswordCredentials(username, password));
  }
  
  public Executor auth(String username, String password, String workstation, String domain)
  {
    return auth(new NTCredentials(username, password, workstation, domain));
  }
  
  public Executor auth(HttpHost host, String username, String password)
  {
    return auth(host, new UsernamePasswordCredentials(username, password));
  }
  
  public Executor auth(HttpHost host, String username, String password, String workstation, String domain)
  {
    return auth(host, new NTCredentials(username, password, workstation, domain));
  }
  
  public Executor clearAuth()
  {
    if (credentialsProvider != null) {
      credentialsProvider.clear();
    }
    return this;
  }
  
  public Executor cookieStore(CookieStore cookieStore)
  {
    this.cookieStore = cookieStore;
    return this;
  }
  
  public Executor clearCookies()
  {
    if (cookieStore != null) {
      cookieStore.clear();
    }
    return this;
  }
  
  public Response execute(Request request)
    throws ClientProtocolException, IOException
  {
    localContext.setAttribute("http.auth.credentials-provider", credentialsProvider);
    localContext.setAttribute("http.auth.auth-cache", authCache);
    localContext.setAttribute("http.cookie-store", cookieStore);
    HttpRequestBase httprequest = request.getHttpRequest();
    httprequest.reset();
    return new Response(httpclient.execute(httprequest, localContext));
  }
  
  @Deprecated
  public static void registerScheme(Scheme scheme) {}
  
  @Deprecated
  public static void unregisterScheme(String name) {}
}

/* Location:
 * Qualified Name:     org.apache.http.client.fluent.Executor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.client.fluent;

import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Form
{
  private final List<NameValuePair> params;
  
  public static Form form()
  {
    return new Form();
  }
  
  Form()
  {
    params = new ArrayList();
  }
  
  public Form add(String name, String value)
  {
    params.add(new BasicNameValuePair(name, value));
    return this;
  }
  
  public List<NameValuePair> build()
  {
    return new ArrayList(params);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.client.fluent.Form
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.client.fluent;

class HttpHeader
{
  public static final String CONTENT_LENGTH = "Content-Length";
  public static final String DATE = "Date";
  public static final String CACHE_CONTROL = "Cache-Control";
  public static final String CONTENT_TYPE = "Content-Type";
  public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
  public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since";
}

/* Location:
 * Qualified Name:     org.apache.http.client.fluent.HttpHeader
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.client.fluent;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpHost;
import org.apache.http.HttpVersion;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.config.RequestConfig.Builder;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.client.methods.HttpOptions;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.methods.HttpTrace;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.FileEntity;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.protocol.HTTP;

public class Request
{
  public static final String DATE_FORMAT = "EEE, dd MMM yyyy HH:mm:ss zzz";
  public static final Locale DATE_LOCALE = Locale.US;
  public static final TimeZone TIME_ZONE = TimeZone.getTimeZone("GMT");
  private final HttpRequestBase request;
  private final RequestConfig.Builder configBuilder;
  private SimpleDateFormat dateFormatter;
  
  public static Request Get(URI uri)
  {
    return new Request(new HttpGet(uri));
  }
  
  public static Request Get(String uri)
  {
    return new Request(new HttpGet(uri));
  }
  
  public static Request Head(URI uri)
  {
    return new Request(new HttpHead(uri));
  }
  
  public static Request Head(String uri)
  {
    return new Request(new HttpHead(uri));
  }
  
  public static Request Post(URI uri)
  {
    return new Request(new HttpPost(uri));
  }
  
  public static Request Post(String uri)
  {
    return new Request(new HttpPost(uri));
  }
  
  public static Request Put(URI uri)
  {
    return new Request(new HttpPut(uri));
  }
  
  public static Request Put(String uri)
  {
    return new Request(new HttpPut(uri));
  }
  
  public static Request Trace(URI uri)
  {
    return new Request(new HttpTrace(uri));
  }
  
  public static Request Trace(String uri)
  {
    return new Request(new HttpTrace(uri));
  }
  
  public static Request Delete(URI uri)
  {
    return new Request(new HttpDelete(uri));
  }
  
  public static Request Delete(String uri)
  {
    return new Request(new HttpDelete(uri));
  }
  
  public static Request Options(URI uri)
  {
    return new Request(new HttpOptions(uri));
  }
  
  public static Request Options(String uri)
  {
    return new Request(new HttpOptions(uri));
  }
  
  Request(HttpRequestBase request)
  {
    this.request = request;
    configBuilder = RequestConfig.custom();
  }
  
  HttpRequestBase getHttpRequest()
  {
    return request;
  }
  
  public Response execute()
    throws ClientProtocolException, IOException
  {
    request.setConfig(configBuilder.build());
    return new Response(Executor.CLIENT.execute(request));
  }
  
  public void abort()
    throws UnsupportedOperationException
  {
    request.abort();
  }
  
  public Request addHeader(Header header)
  {
    request.addHeader(header);
    return this;
  }
  
  public Request setHeader(Header header)
  {
    request.setHeader(header);
    return this;
  }
  
  public Request addHeader(String name, String value)
  {
    request.addHeader(name, value);
    return this;
  }
  
  public Request setHeader(String name, String value)
  {
    request.setHeader(name, value);
    return this;
  }
  
  public Request removeHeader(Header header)
  {
    request.removeHeader(header);
    return this;
  }
  
  public Request removeHeaders(String name)
  {
    request.removeHeaders(name);
    return this;
  }
  
  public Request setHeaders(Header... headers)
  {
    request.setHeaders(headers);
    return this;
  }
  
  public Request setCacheControl(String cacheControl)
  {
    request.setHeader("Cache-Control", cacheControl);
    return this;
  }
  
  private SimpleDateFormat getDateFormat()
  {
    if (dateFormatter == null)
    {
      dateFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", DATE_LOCALE);
      dateFormatter.setTimeZone(TIME_ZONE);
    }
    return dateFormatter;
  }
  
  public Request setDate(Date date)
  {
    request.setHeader("Date", getDateFormat().format(date));
    return this;
  }
  
  public Request setIfModifiedSince(Date date)
  {
    request.setHeader("If-Modified-Since", getDateFormat().format(date));
    return this;
  }
  
  public Request setIfUnmodifiedSince(Date date)
  {
    request.setHeader("If-Unmodified-Since", getDateFormat().format(date));
    return this;
  }
  
  @Deprecated
  public Request config(String param, Object object)
  {
    return this;
  }
  
  @Deprecated
  public Request removeConfig(String param)
  {
    return this;
  }
  
  public Request version(HttpVersion version)
  {
    request.setProtocolVersion(version);
    return this;
  }
  
  @Deprecated
  public Request elementCharset(String charset)
  {
    return this;
  }
  
  public Request useExpectContinue()
  {
    configBuilder.setExpectContinueEnabled(true);
    return this;
  }
  
  public Request userAgent(String agent)
  {
    request.setHeader("User-Agent", agent);
    return this;
  }
  
  public Request socketTimeout(int timeout)
  {
    configBuilder.setSocketTimeout(timeout);
    return this;
  }
  
  public Request connectTimeout(int timeout)
  {
    configBuilder.setConnectTimeout(timeout);
    return this;
  }
  
  public Request staleConnectionCheck(boolean b)
  {
    configBuilder.setStaleConnectionCheckEnabled(b);
    return this;
  }
  
  public Request viaProxy(HttpHost proxy)
  {
    configBuilder.setProxy(proxy);
    return this;
  }
  
  public Request body(HttpEntity entity)
  {
    if ((request instanceof HttpEntityEnclosingRequest)) {
      ((HttpEntityEnclosingRequest)request).setEntity(entity);
    } else {
      throw new IllegalStateException(request.getMethod() + " request cannot enclose an entity");
    }
    return this;
  }
  
  public Request bodyForm(Iterable<? extends NameValuePair> formParams, Charset charset)
  {
    return body(new UrlEncodedFormEntity(formParams, charset));
  }
  
  public Request bodyForm(Iterable<? extends NameValuePair> formParams)
  {
    return bodyForm(formParams, HTTP.DEF_CONTENT_CHARSET);
  }
  
  public Request bodyForm(NameValuePair... formParams)
  {
    return bodyForm(Arrays.asList(formParams), HTTP.DEF_CONTENT_CHARSET);
  }
  
  public Request bodyString(String s, ContentType contentType)
  {
    return body(new StringEntity(s, contentType));
  }
  
  public Request bodyFile(File file, ContentType contentType)
  {
    return body(new FileEntity(file, contentType));
  }
  
  public Request bodyByteArray(byte[] b)
  {
    return body(new ByteArrayEntity(b));
  }
  
  public Request bodyByteArray(byte[] b, int off, int len)
  {
    return body(new ByteArrayEntity(b, off, len));
  }
  
  public Request bodyStream(InputStream instream)
  {
    return body(new InputStreamEntity(instream, -1L));
  }
  
  public Request bodyStream(InputStream instream, ContentType contentType)
  {
    return body(new InputStreamEntity(instream, -1L, contentType));
  }
  
  public String toString()
  {
    return request.getRequestLine().toString();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.client.fluent.Request
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.client.fluent;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.util.EntityUtils;

public class Response
{
  private final HttpResponse response;
  private boolean consumed;
  
  Response(HttpResponse response)
  {
    this.response = response;
  }
  
  private void assertNotConsumed()
  {
    if (consumed) {
      throw new IllegalStateException("Response content has been already consumed");
    }
  }
  
  private void dispose()
  {
    if (consumed) {
      return;
    }
    try
    {
      EntityUtils.consume(response.getEntity());
    }
    catch (Exception ignore) {}finally
    {
      consumed = true;
    }
  }
  
  public void discardContent()
  {
    dispose();
  }
  
  public <T> T handleResponse(ResponseHandler<T> handler)
    throws ClientProtocolException, IOException
  {
    assertNotConsumed();
    try
    {
      return (T)handler.handleResponse(response);
    }
    finally
    {
      dispose();
    }
  }
  
  public Content returnContent()
    throws ClientProtocolException, IOException
  {
    return (Content)handleResponse(new ContentResponseHandler());
  }
  
  public HttpResponse returnResponse()
    throws IOException
  {
    assertNotConsumed();
    try
    {
      HttpEntity entity = response.getEntity();
      if (entity != null) {
        response.setEntity(new ByteArrayEntity(EntityUtils.toByteArray(entity), ContentType.getOrDefault(entity)));
      }
      return response;
    }
    finally
    {
      consumed = true;
    }
  }
  
  public void saveContent(File file)
    throws IOException
  {
    assertNotConsumed();
    StatusLine statusLine = response.getStatusLine();
    if (statusLine.getStatusCode() >= 300) {
      throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase());
    }
    FileOutputStream out = new FileOutputStream(file);
    try
    {
      HttpEntity entity = response.getEntity();
      if (entity != null) {
        entity.writeTo(out);
      }
    }
    finally
    {
      consumed = true;
      out.close();
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.http.client.fluent.Response
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import org.apache.log4j.spi.ErrorHandler;
import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggingEvent;

public abstract interface Appender
{
  public abstract void addFilter(Filter paramFilter);
  
  public abstract Filter getFilter();
  
  public abstract void clearFilters();
  
  public abstract void close();
  
  public abstract void doAppend(LoggingEvent paramLoggingEvent);
  
  public abstract String getName();
  
  public abstract void setErrorHandler(ErrorHandler paramErrorHandler);
  
  public abstract ErrorHandler getErrorHandler();
  
  public abstract void setLayout(Layout paramLayout);
  
  public abstract Layout getLayout();
  
  public abstract void setName(String paramString);
  
  public abstract boolean requiresLayout();
}

/* Location:
 * Qualified Name:     org.apache.log4j.Appender
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j;

import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.helpers.OnlyOnceErrorHandler;
import org.apache.log4j.spi.ErrorHandler;
import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggingEvent;
import org.apache.log4j.spi.OptionHandler;

public abstract class AppenderSkeleton
  implements Appender, OptionHandler
{
  protected Layout layout;
  protected String name;
  protected Priority threshold;
  protected ErrorHandler errorHandler = new OnlyOnceErrorHandler();
  protected Filter headFilter;
  protected Filter tailFilter;
  protected boolean closed = false;
  
  public AppenderSkeleton() {}
  
  protected AppenderSkeleton(boolean isActive) {}
  
  public void activateOptions() {}
  
  public void addFilter(Filter newFilter)
  {
    if (headFilter == null)
    {
      headFilter = (tailFilter = newFilter);
    }
    else
    {
      tailFilter.setNext(newFilter);
      tailFilter = newFilter;
    }
  }
  
  protected abstract void append(LoggingEvent paramLoggingEvent);
  
  public void clearFilters()
  {
    headFilter = (tailFilter = null);
  }
  
  public void finalize()
  {
    if (closed) {
      return;
    }
    LogLog.debug("Finalizing appender named [" + name + "].");
    close();
  }
  
  public ErrorHandler getErrorHandler()
  {
    return errorHandler;
  }
  
  public Filter getFilter()
  {
    return headFilter;
  }
  
  public final Filter getFirstFilter()
  {
    return headFilter;
  }
  
  public Layout getLayout()
  {
    return layout;
  }
  
  public final String getName()
  {
    return name;
  }
  
  public Priority getThreshold()
  {
    return threshold;
  }
  
  public boolean isAsSevereAsThreshold(Priority priority)
  {
    return (threshold == null) || (priority.isGreaterOrEqual(threshold));
  }
  
  public synchronized void doAppend(LoggingEvent event)
  {
    if (closed)
    {
      LogLog.error("Attempted to append to closed appender named [" + name + "].");
      return;
    }
    if (!isAsSevereAsThreshold(event.getLevel())) {
      return;
    }
    Filter f = headFilter;
    while (f != null) {
      switch (f.decide(event))
      {
      case -1: 
        return;
      case 1: 
        break;
      case 0: 
        f = f.getNext();
      }
    }
    append(event);
  }
  
  public synchronized void setErrorHandler(ErrorHandler eh)
  {
    if (eh == null)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

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-2019. Infinite Loop Ltd