org.jboss.resteasy.core.ResourceMethodRegistry Java Examples
The following examples show how to use
org.jboss.resteasy.core.ResourceMethodRegistry.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RefreshRegistryCommand.java From HotswapAgent with GNU General Public License v2.0 | 6 votes |
private void removeRegistration(ResourceMethodRegistry rm, String path, Method method) { try { if (rm.isWiderMatching()) { RootNode rootNode = get(rm, "rootNode"); rootNode.removeBinding(path, method); } else { String methodpath = method.getAnnotation(Path.class).value(); String classExpression = path.replace(methodpath, ""); if (classExpression.endsWith("/")) { classExpression.substring(0, classExpression.length() - 1); } RootClassNode root = get(rm, "root"); root.removeBinding(classExpression, path, method); } } catch (Exception e) { LOGGER.error("Could not remove method registration from path {}, {}", e, path, method); } }
Example #2
Source File: NotFoundExceptionMapper.java From quarkus with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public Response toResponse(NotFoundException exception) { if (registry == null) { return respond(); } Map<String, List<ResourceInvoker>> bounded = null; if (registry instanceof ResourceMethodRegistry) { bounded = ((ResourceMethodRegistry) registry).getBounded(); } else if (Proxy.isProxyClass(registry.getClass()) && registry.toString().startsWith(ResourceMethodRegistry.class.getName())) { try { bounded = (Map<String, List<ResourceInvoker>>) Proxy.getInvocationHandler(registry).invoke(registry, ResourceMethodRegistry.class.getMethod("getBounded"), new Object[0]); } catch (Throwable e) { //ignore it } } if (bounded == null) { return respond(); } List<ResourceDescription> descriptions = ResourceDescription .fromBoundResourceInvokers(bounded .entrySet()); return respond(descriptions); }
Example #3
Source File: RefreshRegistryCommand.java From HotswapAgent with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private <T> T get(ResourceMethodRegistry rm, String field) { Class<?> c; try { c = classLoader.loadClass(ResourceMethodRegistry.class.getName()); Field f = c.getField(field); return (T) f.get(rm); } catch (ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { LOGGER.error("Could not get field {}", e, field); } return null; }
Example #4
Source File: ResourceLinksProvider.java From quarkus with Apache License 2.0 | 4 votes |
private ObjectLinksProvider getObjectLinksProvider() { UriInfo uriInfo = ResteasyContext.getContextData(UriInfo.class); ResourceMethodRegistry registry = (ResourceMethodRegistry) ResteasyContext.getContextData(Registry.class); return new ObjectLinksProvider(uriInfo, registry); }
Example #5
Source File: ResourceLinksProvider.java From quarkus with Apache License 2.0 | 4 votes |
private ClassLinksProvider getClassLinksProvider() { UriInfo uriInfo = ResteasyContext.getContextData(UriInfo.class); ResourceMethodRegistry registry = (ResourceMethodRegistry) ResteasyContext.getContextData(Registry.class); return new ClassLinksProvider(uriInfo, registry); }