org.apache.commons.httpclient.methods.TraceMethod Java Examples

The following examples show how to use org.apache.commons.httpclient.methods.TraceMethod. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PublicApiHttpClient.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
public HttpResponse trace(final RequestContext rq, Binding cmisBinding, String version, String cmisOperation) throws IOException
{
    RestApiEndpoint endpoint = new RestApiEndpoint(rq.getNetworkId(), cmisBinding, version, cmisOperation, null);
    String url = endpoint.getUrl();

    TraceMethod req = new TraceMethod(url.toString());
    return submitRequest(req, rq);
}
 
Example #2
Source File: ResponseHandlerFactory.java    From development with Apache License 2.0 5 votes vote down vote up
/**
 * Checks the method being received and created a 
 * suitable ResponseHandler for this method.
 * 
 * @param method Method to handle
 * @return The handler for this response
 * @throws MethodNotAllowedException If no method could be choose this exception is thrown
 */
public static ResponseHandler createResponseHandler(HttpMethod method) throws MethodNotAllowedException {
    if (!AllowedMethodHandler.methodAllowed(method)) {
        throw new MethodNotAllowedException("The method " + method.getName() + " is not in the AllowedHeaderHandler's list of allowed methods.", AllowedMethodHandler.getAllowHeader());
    }
    
    ResponseHandler handler = null;
    if (method.getName().equals("OPTIONS")) {
        handler = new OptionsResponseHandler((OptionsMethod) method);
    } else if (method.getName().equals("GET")) {
        handler = new GetResponseHandler((GetMethod) method);
    } else if (method.getName().equals("HEAD")) {
        handler = new HeadResponseHandler((HeadMethod) method);
    } else if (method.getName().equals("POST")) {
        handler = new PostResponseHandler((PostMethod) method);
    } else if (method.getName().equals("PUT")) {
        handler = new PutResponseHandler((PutMethod) method);
    } else if (method.getName().equals("DELETE")) {
        handler = new DeleteResponseHandler((DeleteMethod) method);
    } else if (method.getName().equals("TRACE")) {
        handler = new TraceResponseHandler((TraceMethod) method);
    } else {
        throw new MethodNotAllowedException("The method " + method.getName() + " was allowed by the AllowedMethodHandler, not by the factory.", handledMethods);
    }

    return handler;
}
 
Example #3
Source File: TraceResponseHandler.java    From development with Apache License 2.0 2 votes vote down vote up
/**
 * Basic constructor setting the method, and also checks if
 * the request is targeted to the proxy or the underlying server.
 * @param method The http method
 */
public TraceResponseHandler(TraceMethod method) {
    super(method);
    proxyTargeted = !method.hasBeenUsed();
}