本文整理汇总了Java中org.apache.commons.httpclient.HttpMethod.getName方法的典型用法代码示例。如果您正苦于以下问题:Java HttpMethod.getName方法的具体用法?Java HttpMethod.getName怎么用?Java HttpMethod.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.httpclient.HttpMethod
的用法示例。
在下文中一共展示了HttpMethod.getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createResponseHandler
import org.apache.commons.httpclient.HttpMethod; //导入方法依赖的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;
}
示例2: doStart
import org.apache.commons.httpclient.HttpMethod; //导入方法依赖的package包/类
/**
* for http client
*
* @param args
* @return
*/
@SuppressWarnings({ "unused", "unchecked" })
public void doStart(Object[] args) {
HostConfiguration hostconfig = (HostConfiguration) args[0];
HttpMethod method = (HttpMethod) args[1];
HttpState state = (HttpState) args[2];
String httpAction = "";
method.setRequestHeader("UAV-Client-Src", MonitorServerUtil.getUAVClientSrc(this.applicationId));
try {
httpAction = method.getName();
targetURL = method.getURI().toString();
}
catch (URIException e) {
// ignore
}
Map<String, Object> params = new HashMap<String, Object>();
params.put(CaptureConstants.INFO_CLIENT_REQUEST_URL, targetURL);
params.put(CaptureConstants.INFO_CLIENT_REQUEST_ACTION, httpAction);
params.put(CaptureConstants.INFO_CLIENT_APPID, this.applicationId);
params.put(CaptureConstants.INFO_CLIENT_TYPE, "apache.http.Client");
if (logger.isDebugable()) {
logger.debug("Invoke START:" + targetURL + "," + httpAction + "," + this.applicationId, null);
}
UAVServer.instance().runMonitorCaptureOnServerCapPoint(CaptureConstants.CAPPOINT_APP_CLIENT,
Monitor.CapturePhase.PRECAP, params);
// register adapter
UAVServer.instance().runSupporter("com.creditease.uav.apm.supporters.InvokeChainSupporter", "registerAdapter",
ApacheHttpClient3Adapter.class);
ivcContextParams = (Map<String, Object>) UAVServer.instance().runSupporter(
"com.creditease.uav.apm.supporters.InvokeChainSupporter", "runCap",
InvokeChainConstants.CHAIN_APP_CLIENT, InvokeChainConstants.CapturePhase.PRECAP, params,
ApacheHttpClient3Adapter.class, args);
}