use of jakarta.ws.rs.ConstrainedTo in project resteasy by resteasy.
the class ServerHelper method processProviderContracts.
protected void processProviderContracts(Class provider, Integer priorityOverride, boolean isBuiltin, Map<Class<?>, Integer> contracts, Map<Class<?>, Integer> newContracts) {
ConstrainedTo constrainedTo = (ConstrainedTo) provider.getAnnotation(ConstrainedTo.class);
if (constrainedTo != null && constrainedTo.value() != RuntimeType.SERVER)
return;
super.processProviderContracts(provider, priorityOverride, isBuiltin, contracts, newContracts);
if (Utils.isA(provider, ContainerRequestFilter.class, contracts)) {
int priority = Utils.getPriority(priorityOverride, contracts, ContainerRequestFilter.class, provider);
addContainerRequestFilter(provider, priority);
newContracts.put(ContainerRequestFilter.class, priority);
}
if (Utils.isA(provider, ContainerResponseFilter.class, contracts)) {
int priority = Utils.getPriority(priorityOverride, contracts, ContainerResponseFilter.class, provider);
addContainerResponseFilter(provider, priority);
newContracts.put(ContainerResponseFilter.class, priority);
}
if (Utils.isA(provider, AsyncResponseProvider.class, contracts)) {
try {
addAsyncResponseProvider(provider);
newContracts.put(AsyncResponseProvider.class, Utils.getPriority(priorityOverride, contracts, AsyncResponseProvider.class, provider));
} catch (Exception e) {
throw new RuntimeException(Messages.MESSAGES.unableToInstantiateAsyncResponseProvider(), e);
}
}
if (Utils.isA(provider, AsyncStreamProvider.class, contracts)) {
try {
addAsyncStreamProvider(provider);
newContracts.put(AsyncStreamProvider.class, Utils.getPriority(priorityOverride, contracts, AsyncStreamProvider.class, provider));
} catch (Exception e) {
throw new RuntimeException(Messages.MESSAGES.unableToInstantiateAsyncStreamProvider(), e);
}
}
if (Utils.isA(provider, ExceptionMapper.class, contracts)) {
try {
addExceptionMapper(provider, isBuiltin);
newContracts.put(ExceptionMapper.class, Utils.getPriority(priorityOverride, contracts, ExceptionMapper.class, provider));
} catch (Exception e) {
throw new RuntimeException(Messages.MESSAGES.unableToInstantiateExceptionMapper(), e);
}
}
}
Aggregations