本文整理了Java中org.glassfish.jersey.server.model.AnnotatedMethod.<init>()
方法的一些代码示例,展示了AnnotatedMethod.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AnnotatedMethod.<init>()
方法的具体详情如下:
包路径:org.glassfish.jersey.server.model.AnnotatedMethod
类名称:AnnotatedMethod
方法名:<init>
[英]Create annotated method instance from the Method.
[中]从方法创建带注释的方法实例。
代码示例来源:origin: jersey/jersey
/**
* Create new method list from the given collection of methods.
*
* The {@link Method#isBridge() bridge methods} and methods declared directly
* on the {@link Object} class are filtered out.
*
* @param methods methods to be included in the method list.
*/
public MethodList(Collection<Method> methods) {
List<AnnotatedMethod> l = new ArrayList<>(methods.size());
for (Method m : methods) {
if (!m.isBridge() && m.getDeclaringClass() != Object.class) {
l.add(new AnnotatedMethod(m));
}
}
this.methods = new AnnotatedMethod[l.size()];
this.methods = l.toArray(this.methods);
}
代码示例来源:origin: jersey/jersey
/**
* Create new method list from the given collection of methods.
*
* The {@link Method#isBridge() bridge methods} and methods declared directly
* on the {@link Object} class are filtered out.
*
* @param methods methods to be included in the method list.
*/
public MethodList(Collection<Method> methods) {
List<AnnotatedMethod> l = new ArrayList<>(methods.size());
for (Method m : methods) {
if (!m.isBridge() && m.getDeclaringClass() != Object.class) {
l.add(new AnnotatedMethod(m));
}
}
this.methods = new AnnotatedMethod[l.size()];
this.methods = l.toArray(this.methods);
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(final ResourceInfo resourceInfo, final FeatureContext configuration) {
final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod());
// check to see if it has cache control annotation
final CacheControl cc = am.getAnnotation(CacheControl.class);
if (cc != null) {
configuration.register(new CacheControlledResponseFilter(cc));
}
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod());
final Annotation[][] parameterAnnotations = am.getParameterAnnotations();
final Class<?>[] parameterTypes = am.getParameterTypes();
代码示例来源:origin: apache/drill
@Override
public void configure(final ResourceInfo resourceInfo,
final FeatureContext configuration) {
AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod());
// RolesAllowed on the method takes precedence over PermitAll
RolesAllowed ra = am.getAnnotation(RolesAllowed.class);
if (ra != null) {
configuration.register(AuthCheckFilter.INSTANCE);
return;
}
// PermitAll takes precedence over RolesAllowed on the class
if (am.isAnnotationPresent(PermitAll.class)) {
// Do nothing.
return;
}
// RolesAllowed on the class takes precedence over PermitAll
ra = resourceInfo.getResourceClass().getAnnotation(RolesAllowed.class);
if (ra != null) {
configuration.register(AuthCheckFilter.INSTANCE);
}
}
代码示例来源:origin: jersey/jersey
new AnnotatedMethod(resource.getInvocable().getDefinitionMethod()));
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod());
final Annotation[][] parameterAnnotations = am.getParameterAnnotations();
final Class<?>[] parameterTypes = am.getParameterTypes();
// First, check for any @Auth annotations on the method.
for (int i = 0; i < parameterAnnotations.length; i++) {
for (final Annotation annotation : parameterAnnotations[i]) {
if (annotation instanceof Auth) {
// Optional auth requires that a concrete AuthFilter be provided.
if (parameterTypes[i].equals(Optional.class) && authFilter != null) {
context.register(new WebApplicationExceptionCatchingFilter(authFilter));
return;
} else {
registerAuthFilter(context);
return;
}
}
}
}
// Second, check for any authorization annotations on the class or method.
// Note that @DenyAll shouldn't be attached to classes.
final boolean annotationOnClass = (resourceInfo.getResourceClass().getAnnotation(RolesAllowed.class) != null) ||
(resourceInfo.getResourceClass().getAnnotation(PermitAll.class) != null);
final boolean annotationOnMethod = am.isAnnotationPresent(RolesAllowed.class) || am.isAnnotationPresent(DenyAll.class) ||
am.isAnnotationPresent(PermitAll.class);
if (annotationOnClass || annotationOnMethod) {
registerAuthFilter(context);
}
}
代码示例来源:origin: jersey/jersey
@Override
public void configure(final ResourceInfo resourceInfo, final FeatureContext configuration) {
final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod());
// DenyAll on the method take precedence over RolesAllowed and PermitAll
if (am.isAnnotationPresent(DenyAll.class)) {
configuration.register(new RolesAllowedRequestFilter());
return;
}
// RolesAllowed on the method takes precedence over PermitAll
RolesAllowed ra = am.getAnnotation(RolesAllowed.class);
if (ra != null) {
configuration.register(new RolesAllowedRequestFilter(ra.value()));
return;
}
// PermitAll takes precedence over RolesAllowed on the class
if (am.isAnnotationPresent(PermitAll.class)) {
// Do nothing.
return;
}
// DenyAll can't be attached to classes
// RolesAllowed on the class takes precedence over PermitAll
ra = resourceInfo.getResourceClass().getAnnotation(RolesAllowed.class);
if (ra != null) {
configuration.register(new RolesAllowedRequestFilter(ra.value()));
}
}
代码示例来源:origin: jersey/jersey
@Override
public void configure(final ResourceInfo resourceInfo, final FeatureContext configuration) {
final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod());
// DenyAll on the method take precedence over RolesAllowed and PermitAll
if (am.isAnnotationPresent(DenyAll.class)) {
configuration.register(new RolesAllowedRequestFilter());
return;
}
// RolesAllowed on the method takes precedence over PermitAll
RolesAllowed ra = am.getAnnotation(RolesAllowed.class);
if (ra != null) {
configuration.register(new RolesAllowedRequestFilter(ra.value()));
return;
}
// PermitAll takes precedence over RolesAllowed on the class
if (am.isAnnotationPresent(PermitAll.class)) {
// Do nothing.
return;
}
// DenyAll can't be attached to classes
// RolesAllowed on the class takes precedence over PermitAll
ra = resourceInfo.getResourceClass().getAnnotation(RolesAllowed.class);
if (ra != null) {
configuration.register(new RolesAllowedRequestFilter(ra.value()));
}
}
代码示例来源:origin: jersey/jersey
/**
* Create a list of parameter models for a given Java method handling a resource
* method, sub-resource method or a sub-resource locator.
*
* @param concreteClass concrete resource method handler implementation class.
* @param declaringClass the class declaring the handling Java method.
* @param javaMethod Java method handling a resource method, sub-resource
* method or a sub-resource locator.
* @param keepEncoded set to {@code true} to disable automatic decoding
* of all the method parameters. (See {@link Encoded}.
* @return a list of handling method parameter models.
*/
public static List<Parameter> create(
Class concreteClass,
Class declaringClass,
Method javaMethod,
boolean keepEncoded) {
AnnotatedMethod method = new AnnotatedMethod(javaMethod);
return create(
concreteClass, declaringClass,
((null != method.getAnnotation(Encoded.class)) || keepEncoded),
method.getParameterTypes(),
method.getGenericParameterTypes(),
method.getParameterAnnotations());
}
代码示例来源:origin: jersey/jersey
/**
* Create a list of parameter models for a given Java method handling a resource
* method, sub-resource method or a sub-resource locator.
*
* @param concreteClass concrete resource method handler implementation class.
* @param declaringClass the class declaring the handling Java method.
* @param javaMethod Java method handling a resource method, sub-resource
* method or a sub-resource locator.
* @param keepEncoded set to {@code true} to disable automatic decoding
* of all the method parameters. (See {@link Encoded}.
* @return a list of handling method parameter models.
*/
public static List<Parameter> create(
Class concreteClass,
Class declaringClass,
Method javaMethod,
boolean keepEncoded) {
AnnotatedMethod method = new AnnotatedMethod(javaMethod);
return create(
concreteClass, declaringClass,
((null != method.getAnnotation(Encoded.class)) || keepEncoded),
method.getParameterTypes(),
method.getGenericParameterTypes(),
method.getParameterAnnotations());
}
代码示例来源:origin: org.glassfish.jersey.core/jersey-server
/**
* Create new method list from the given collection of methods.
*
* The {@link Method#isBridge() bridge methods} and methods declared directly
* on the {@link Object} class are filtered out.
*
* @param methods methods to be included in the method list.
*/
public MethodList(Collection<Method> methods) {
List<AnnotatedMethod> l = new ArrayList<>(methods.size());
for (Method m : methods) {
if (!m.isBridge() && m.getDeclaringClass() != Object.class) {
l.add(new AnnotatedMethod(m));
}
}
this.methods = new AnnotatedMethod[l.size()];
this.methods = l.toArray(this.methods);
}
代码示例来源:origin: org.glassfish.jersey.core/jersey-server
@Override
public void configure(final ResourceInfo resourceInfo, final FeatureContext configuration) {
final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod());
// DenyAll on the method take precedence over RolesAllowed and PermitAll
if (am.isAnnotationPresent(DenyAll.class)) {
configuration.register(new RolesAllowedRequestFilter());
return;
}
// RolesAllowed on the method takes precedence over PermitAll
RolesAllowed ra = am.getAnnotation(RolesAllowed.class);
if (ra != null) {
configuration.register(new RolesAllowedRequestFilter(ra.value()));
return;
}
// PermitAll takes precedence over RolesAllowed on the class
if (am.isAnnotationPresent(PermitAll.class)) {
// Do nothing.
return;
}
// DenyAll can't be attached to classes
// RolesAllowed on the class takes precedence over PermitAll
ra = resourceInfo.getResourceClass().getAnnotation(RolesAllowed.class);
if (ra != null) {
configuration.register(new RolesAllowedRequestFilter(ra.value()));
}
}
代码示例来源:origin: org.glassfish.jersey.core/jersey-server
/**
* Create a list of parameter models for a given Java method handling a resource
* method, sub-resource method or a sub-resource locator.
*
* @param concreteClass concrete resource method handler implementation class.
* @param declaringClass the class declaring the handling Java method.
* @param javaMethod Java method handling a resource method, sub-resource
* method or a sub-resource locator.
* @param keepEncoded set to {@code true} to disable automatic decoding
* of all the method parameters. (See {@link Encoded}.
* @return a list of handling method parameter models.
*/
public static List<Parameter> create(
Class concreteClass,
Class declaringClass,
Method javaMethod,
boolean keepEncoded) {
AnnotatedMethod method = new AnnotatedMethod(javaMethod);
return create(
concreteClass, declaringClass,
((null != method.getAnnotation(Encoded.class)) || keepEncoded),
method.getParameterTypes(),
method.getGenericParameterTypes(),
method.getParameterAnnotations());
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Create new method list from the given collection of methods.
*
* The {@link Method#isBridge() bridge methods} and methods declared directly
* on the {@link Object} class are filtered out.
*
* @param methods methods to be included in the method list.
*/
public MethodList(Collection<Method> methods) {
List<AnnotatedMethod> l = new ArrayList<>(methods.size());
for (Method m : methods) {
if (!m.isBridge() && m.getDeclaringClass() != Object.class) {
l.add(new AnnotatedMethod(m));
}
}
this.methods = new AnnotatedMethod[l.size()];
this.methods = l.toArray(this.methods);
}
代码示例来源:origin: org.glassfish.jersey.bundles/jaxrs-ri
/**
* Create new method list from the given collection of methods.
*
* The {@link Method#isBridge() bridge methods} and methods declared directly
* on the {@link Object} class are filtered out.
*
* @param methods methods to be included in the method list.
*/
public MethodList(Collection<Method> methods) {
List<AnnotatedMethod> l = new ArrayList<>(methods.size());
for (Method m : methods) {
if (!m.isBridge() && m.getDeclaringClass() != Object.class) {
l.add(new AnnotatedMethod(m));
}
}
this.methods = new AnnotatedMethod[l.size()];
this.methods = l.toArray(this.methods);
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Create new method list from the given collection of methods.
*
* The {@link Method#isBridge() bridge methods} and methods declared directly
* on the {@link Object} class are filtered out.
*
* @param methods methods to be included in the method list.
*/
public MethodList(Collection<Method> methods) {
List<AnnotatedMethod> l = new ArrayList<>(methods.size());
for (Method m : methods) {
if (!m.isBridge() && m.getDeclaringClass() != Object.class) {
l.add(new AnnotatedMethod(m));
}
}
this.methods = new AnnotatedMethod[l.size()];
this.methods = l.toArray(this.methods);
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Create new method list from the given collection of methods.
*
* The {@link Method#isBridge() bridge methods} and methods declared directly
* on the {@link Object} class are filtered out.
*
* @param methods methods to be included in the method list.
*/
public MethodList(Collection<Method> methods) {
List<AnnotatedMethod> l = new ArrayList<>(methods.size());
for (Method m : methods) {
if (!m.isBridge() && m.getDeclaringClass() != Object.class) {
l.add(new AnnotatedMethod(m));
}
}
this.methods = new AnnotatedMethod[l.size()];
this.methods = l.toArray(this.methods);
}
代码示例来源:origin: mokies/ratelimitj
@Override
public void configure(final ResourceInfo resourceInfo,
final FeatureContext context) {
final AnnotatedMethod method = new AnnotatedMethod(resourceInfo.getResourceMethod());
final RateLimited rateLimited = method.getAnnotation(RateLimited.class);
if (null != rateLimited) {
context.register(RateLimit429EnforcerFilter.class);
}
}
}
代码示例来源:origin: io.dropwizard/dropwizard-jersey
@Override
public void configure(final ResourceInfo resourceInfo, final FeatureContext configuration) {
final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod());
// check to see if it has cache control annotation
final CacheControl cc = am.getAnnotation(CacheControl.class);
if (cc != null) {
configuration.register(new CacheControlledResponseFilter(cc));
}
}
内容来源于网络,如有侵权,请联系作者删除!