本文整理汇总了Java中org.jboss.resteasy.util.IsHttpMethod类的典型用法代码示例。如果您正苦于以下问题:Java IsHttpMethod类的具体用法?Java IsHttpMethod怎么用?Java IsHttpMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IsHttpMethod类属于org.jboss.resteasy.util包,在下文中一共展示了IsHttpMethod类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createClientInvoker
import org.jboss.resteasy.util.IsHttpMethod; //导入依赖的package包/类
private static <T> ClientInvoker createClientInvoker(Class<T> clazz, Method method, ResteasyWebTarget base, ProxyConfig config) {
Set<String> httpMethods = IsHttpMethod.getHttpMethods(method);
if (httpMethods == null || httpMethods.size() != 1) {
throw new RuntimeException(Messages.MESSAGES.mustUseExactlyOneHttpMethod(method.toString()));
}
ClientInvoker invoker = new ClientInvoker(base, clazz, method, config);
invoker.setHttpMethod(httpMethods.iterator().next());
return invoker;
}
示例2: call
import org.jboss.resteasy.util.IsHttpMethod; //导入依赖的package包/类
public void call(@Observes Before event)
{
Set<String> httpMethods = IsHttpMethod.getHttpMethods(event.getTestMethod());
if (httpMethods != null && httpMethods.size() == 1)
{
Response response = doRestCall(event.getTestMethod(), httpMethods);
responseProducer.set(response);
}
}
示例3: proxy
import org.jboss.resteasy.util.IsHttpMethod; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> T proxy(final Class<T> iface, WebTarget base, final ProxyConfig config) {
if (iface.isAnnotationPresent(Path.class)) {
Path path = iface.getAnnotation(Path.class);
if (!path.value().equals("") && !path.value().equals("/")) {
base = base.path(path.value());
}
}
HashMap<Method, MethodInvoker> methodMap = new HashMap<Method, MethodInvoker>();
for (Method method : iface.getMethods()) {
// ignore the as method to allow declaration in client interfaces
if ("as".equals(method.getName()) && Arrays.equals(method.getParameterTypes(), cClassArgArray)) {
continue;
}
// Added by Ken Finnigan
// Ignore default methods
if (method.isDefault()) {
continue;
}
MethodInvoker invoker;
Set<String> httpMethods = IsHttpMethod.getHttpMethods(method);
if ((httpMethods == null || httpMethods.size() == 0) && method.isAnnotationPresent(Path.class) && method.getReturnType().isInterface()) {
invoker = new SubResourceInvoker((ResteasyWebTarget) base, method, config);
} else {
invoker = createClientInvoker(iface, method, (ResteasyWebTarget) base, config);
}
methodMap.put(method, invoker);
}
Class<?>[] intfs =
{
iface, ResteasyClientProxy.class
};
ClientProxy clientProxy = new ClientProxy(methodMap, base, config);
// this is done so that equals and hashCode work ok. Adding the proxy to a
// Collection will cause equals and hashCode to be invoked. The Spring
// infrastructure had some problems without this.
clientProxy.setClazz(iface);
return (T) Proxy.newProxyInstance(config.getLoader(), intfs, clientProxy);
}