当前位置: 首页>>代码示例>>Java>>正文


Java TraceMethod类代码示例

本文整理汇总了Java中org.apache.commons.httpclient.methods.TraceMethod的典型用法代码示例。如果您正苦于以下问题:Java TraceMethod类的具体用法?Java TraceMethod怎么用?Java TraceMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TraceMethod类属于org.apache.commons.httpclient.methods包,在下文中一共展示了TraceMethod类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCommonsHttpMethod

import org.apache.commons.httpclient.methods.TraceMethod; //导入依赖的package包/类
/**
 * Create a Commons HttpMethodBase object for the given HTTP method
 * and URI specification.
 * @param httpMethod the HTTP method
 * @param uri the URI
 * @return the Commons HttpMethodBase object
 */
protected HttpMethodBase createCommonsHttpMethod(HttpMethod httpMethod, String uri) {
	switch (httpMethod) {
		case GET:
			return new GetMethod(uri);
		case DELETE:
			return new DeleteMethod(uri);
		case HEAD:
			return new HeadMethod(uri);
		case OPTIONS:
			return new OptionsMethod(uri);
		case POST:
			return new PostMethod(uri);
		case PUT:
			return new PutMethod(uri);
		case TRACE:
			return new TraceMethod(uri);
		case PATCH:
			throw new IllegalArgumentException(
					"HTTP method PATCH not available before Apache HttpComponents HttpClient 4.2");
		default:
			throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:31,代码来源:CommonsClientHttpRequestFactory.java

示例2: createResponseHandler

import org.apache.commons.httpclient.methods.TraceMethod; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:35,代码来源:ResponseHandlerFactory.java

示例3: trace

import org.apache.commons.httpclient.methods.TraceMethod; //导入依赖的package包/类
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);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:9,代码来源:PublicApiHttpClient.java

示例4: testTraceDisabled

import org.apache.commons.httpclient.methods.TraceMethod; //导入依赖的package包/类
@Test
public void testTraceDisabled() throws Exception {
    HttpClient httpclient = new HttpClient();
    TraceMethod trace = new TraceMethod("http://localhost:" + portTraceOff + "/myservice");
    httpclient.executeMethod(trace);

    // TRACE shouldn't be allowed by default
    assertTrue(trace.getStatusCode() == 405);
    trace.releaseConnection();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:NettyHttpTraceDisabledTest.java

示例5: testTraceEnabled

import org.apache.commons.httpclient.methods.TraceMethod; //导入依赖的package包/类
@Test
public void testTraceEnabled() throws Exception {
    HttpClient httpclient = new HttpClient();
    TraceMethod trace = new TraceMethod("http://localhost:" + portTraceOn + "/myservice");
    httpclient.executeMethod(trace);

    // TRACE is now allowed
    assertTrue(trace.getStatusCode() == 200);
    trace.releaseConnection();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:NettyHttpTraceDisabledTest.java

示例6: testTraceDisabled

import org.apache.commons.httpclient.methods.TraceMethod; //导入依赖的package包/类
@Test
public void testTraceDisabled() throws Exception {        
    HttpClient httpclient = new HttpClient();
    TraceMethod trace = new TraceMethod("http://localhost:" + portTraceOff + "/myservice");
    httpclient.executeMethod(trace);

    // TRACE shouldn't be allowed by default
    assertTrue(trace.getStatusCode() == 405);
    trace.releaseConnection();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:JettyEndpointSetHttpTraceTest.java

示例7: testTraceEnabled

import org.apache.commons.httpclient.methods.TraceMethod; //导入依赖的package包/类
@Test
public void testTraceEnabled() throws Exception {        
    HttpClient httpclient = new HttpClient();
    TraceMethod trace = new TraceMethod("http://localhost:" + portTraceOn + "/myservice");
    httpclient.executeMethod(trace);

    // TRACE is now allowed
    assertTrue(trace.getStatusCode() == 200);
    trace.releaseConnection();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:JettyEndpointSetHttpTraceTest.java

示例8: createCommonsHttpMethod

import org.apache.commons.httpclient.methods.TraceMethod; //导入依赖的package包/类
/**
 * Create a Commons HttpMethodBase object for the given HTTP method and URI specification.
 * @param httpMethod the HTTP method
 * @param uri the URI
 * @return the Commons HttpMethodBase object
 */
protected HttpMethodBase createCommonsHttpMethod(HttpMethod httpMethod, String uri) {
	switch (httpMethod) {
		case GET:
			return new GetMethod(uri);
		case DELETE:
			return new DeleteMethod(uri);
		case HEAD:
			return new HeadMethod(uri);
		case OPTIONS:
			return new OptionsMethod(uri);
		case POST:
			return new PostMethod(uri);
		case PUT:
			return new PutMethod(uri);
		case TRACE:
			return new TraceMethod(uri);
		default:
			throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
	}
}
 
开发者ID:bestarandyan,项目名称:ShoppingMall,代码行数:27,代码来源:CommonsClientHttpRequestFactory.java

示例9: TraceResponseHandler

import org.apache.commons.httpclient.methods.TraceMethod; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:10,代码来源:TraceResponseHandler.java


注:本文中的org.apache.commons.httpclient.methods.TraceMethod类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。