FileDocCategorySizeDatePackage
DefaultHttpRequestFactory.javaAPI DocAndroid 1.5 API4099Wed May 06 22:41:10 BST 2009org.apache.http.impl

DefaultHttpRequestFactory

public class DefaultHttpRequestFactory extends Object implements HttpRequestFactory
Default implementation of a factory for creating request objects.
author
Oleg Kalnichevski
version
$Revision: 618367 $
since
4.0

Fields Summary
private static final String[]
RFC2616_COMMON_METHODS
private static final String[]
RFC2616_ENTITY_ENC_METHODS
private static final String[]
RFC2616_SPECIAL_METHODS
Constructors Summary
public DefaultHttpRequestFactory()

    
    
      
        super();
    
Methods Summary
private static booleanisOneOf(java.lang.String[] methods, java.lang.String method)

        for (int i = 0; i < methods.length; i++) {
            if (methods[i].equalsIgnoreCase(method)) {
                return true;
            }
        }
        return false;
    
public org.apache.http.HttpRequestnewHttpRequest(org.apache.http.RequestLine requestline)

        if (requestline == null) {
            throw new IllegalArgumentException("Request line may not be null");
        }
        String method = requestline.getMethod();
        if (isOneOf(RFC2616_COMMON_METHODS, method)) {
            return new BasicHttpRequest(requestline); 
        } else if (isOneOf(RFC2616_ENTITY_ENC_METHODS, method)) {
            return new BasicHttpEntityEnclosingRequest(requestline); 
        } else if (isOneOf(RFC2616_SPECIAL_METHODS, method)) {
            return new BasicHttpRequest(requestline); 
        } else { 
            throw new MethodNotSupportedException(method +  " method not supported");
        }
    
public org.apache.http.HttpRequestnewHttpRequest(java.lang.String method, java.lang.String uri)

        if (isOneOf(RFC2616_COMMON_METHODS, method)) {
            return new BasicHttpRequest(method, uri); 
        } else if (isOneOf(RFC2616_ENTITY_ENC_METHODS, method)) {
            return new BasicHttpEntityEnclosingRequest(method, uri); 
        } else if (isOneOf(RFC2616_SPECIAL_METHODS, method)) {
            return new BasicHttpRequest(method, uri); 
        } else {
            throw new MethodNotSupportedException(method
                    + " method not supported");
        }