Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package net.openesb.sdk.http;
 
Responsible for creating Apache HttpClient 4 request objects.

Author(s):
David BRASSELY (brasseld at gmail.com)
OpenESB Community
public class HttpRequestFactory {
    HttpRequestBase createHttpRequest(Request<?> requestClientConfiguration clientConfigurationHttpEntity previousEntity) {
        String uri = request.getResourcePath();
        
        HttpRequestBase httpRequest;
        if (request.getHttpMethod() == .) {
            HttpPost postMethod = new HttpPost(uri);
            
            httpRequest = postMethod;
        } else if (request.getHttpMethod() == .) {
            httpRequest = new HttpGet(uri);
        } else if (request.getHttpMethod() == .) {
            httpRequest = new HttpDelete(uri);
        } else if (request.getHttpMethod() == .) {
            httpRequest = new HttpHead(uri);
        } else {
            throw new OpenESBClientException("Unknown HTTP method name: " + request.getHttpMethod());
        }
        
        return httpRequest;
    }
New to GrepCode? Check out our FAQ X