rootNode.addInvoker(fullpath, invoker); } else { root.addInvoker(classExpression, fullpath, invoker); rootNode.addInvoker(fullpath, locator); } else { root.addInvoker(classExpression, fullpath, locator);
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); } }
public void addInvoker(String classExpression, String fullpath, ResourceInvoker invoker) { if (classExpression.startsWith("/")) classExpression = classExpression.substring(1); if (classExpression.endsWith("/")) classExpression = classExpression.substring(0, classExpression.length() - 1); ClassExpression newce = new ClassExpression(classExpression); String regex = newce.getRegex(); ClassExpression existing = bounded.get(regex); if (existing == null) { newce.getRoot().addInvoker(fullpath, invoker); addExpression(classExpression, newce); bounded.put(regex, newce); } else { existing.getRoot().addInvoker(fullpath, invoker); } } protected void addExpression(String path, ClassExpression ce)
public Map<String, List<ResourceInvoker>> getBounded() { if (widerMatching) return rootNode.getBounded(); else return root.getBounded(); }
/** * Number of endpoints registered. * * @return number of endpoints registered */ public int getSize() { if (widerMatching) return rootNode.getSize(); else return root.getSize(); }
/** * Find a resource to invoke on. * * @return resource invoker */ public ResourceInvoker getResourceInvoker(HttpRequest request) { RESTEasyTracingLogger tracingLogger = RESTEasyTracingLogger.getInstance(request); final long timestamp = tracingLogger.timestamp("MATCH_SUMMARY"); try { if (widerMatching) { return rootNode.match(request, 0); } else { return root.match(request, 0); } } catch (RuntimeException e) { throw e; } finally { tracingLogger.logDuration("MATCH_SUMMARY", timestamp); } } }
for (Map.Entry<String, List<ResourceInvoker>> entry : this.root.getBounded().entrySet())
/** * Number of endpoints registered * * @return */ public int getSize() { if (widerMatching) return rootNode.getSize(); else return root.getSize(); }
/** * Find a resource to invoke on * * @return */ public ResourceInvoker getResourceInvoker(HttpRequest request) { try { if (widerMatching) return rootNode.match(request, 0); else return root.match(request, 0); } catch (RuntimeException e) { throw e; } } }
rootNode.addInvoker(fullpath, invoker); } else { root.addInvoker(classExpression, fullpath, invoker); rootNode.addInvoker(fullpath, locator); } else { root.addInvoker(classExpression, fullpath, locator);
private void removeRegistration(String base, Class<?> clazz) { for (Method method : clazz.getMethods()) { Path path = method.getAnnotation(Path.class); Set<String> httpMethods = IsHttpMethod.getHttpMethods(method); if (path == null && httpMethods == null) continue; ResteasyUriBuilder builder = new ResteasyUriBuilderImpl(); if (base != null) builder.path(base); if (clazz.isAnnotationPresent(Path.class)) builder.path(clazz); String classExpression = builder.getPath(); if (path != null) builder.path(method); String fullpath = builder.getPath(); if (fullpath == null) fullpath = ""; if (widerMatching) rootNode.removeBinding(fullpath, method); else root.removeBinding(classExpression, fullpath, method); } }
public Map<String, List<ResourceInvoker>> getBounded() { if (widerMatching) return rootNode.getBounded(); else return root.getBounded(); }
/** * Number of endpoints registered. * * @return number of endpoints registered */ public int getSize() { if (widerMatching) return rootNode.getSize(); else return root.getSize(); }
public void addInvoker(String classExpression, String fullpath, ResourceInvoker invoker) { if (classExpression.startsWith("/")) classExpression = classExpression.substring(1); if (classExpression.endsWith("/")) classExpression = classExpression.substring(0, classExpression.length() - 1); ClassExpression newce = new ClassExpression(classExpression); String regex = newce.getRegex(); ClassExpression existing = bounded.get(regex); if (existing == null) { newce.getRoot().addInvoker(fullpath, invoker); addExpression(classExpression, newce); bounded.put(regex, newce); } else { existing.getRoot().addInvoker(fullpath, invoker); } } protected void addExpression(String path, ClassExpression ce)
/** * Find a resource to invoke on. * * @return resource invoker */ public ResourceInvoker getResourceInvoker(HttpRequest request) { RESTEasyTracingLogger tracingLogger = RESTEasyTracingLogger.getInstance(request); final long timestamp = tracingLogger.timestamp("MATCH_SUMMARY"); try { if (widerMatching) { return rootNode.match(request, 0); } else { return root.match(request, 0); } } catch (RuntimeException e) { throw e; } finally { tracingLogger.logDuration("MATCH_SUMMARY", timestamp); } } }
if (widerMatching) rootNode.addInvoker(fullpath, invoker); else root.addInvoker(classExpression, fullpath, invoker); if (widerMatching) rootNode.addInvoker(fullpath, locator); else root.addInvoker(classExpression, fullpath, locator);
@Override public void removeRegistrations(ResourceClass resourceClass) { for (ResourceMethod method : resourceClass.getResourceMethods()) { if (widerMatching) rootNode.removeBinding(method.getFullpath(), method.getMethod()); else root.removeBinding(resourceClass.getPath(), method.getFullpath(), method.getMethod()); } for (ResourceLocator method : resourceClass.getResourceLocators()) { if (widerMatching) rootNode.removeBinding(method.getFullpath(), method.getMethod()); else root.removeBinding(resourceClass.getPath(), method.getFullpath(), method.getMethod()); } }
public Map<String, List<ResourceInvoker>> getBounded() { if (widerMatching) return rootNode.getBounded(); else return root.getBounded(); }
public void addInvoker(String classExpression, String fullpath, ResourceInvoker invoker) { if (classExpression.startsWith("/")) classExpression = classExpression.substring(1); if (classExpression.endsWith("/")) classExpression = classExpression.substring(0, classExpression.length() - 1); ClassExpression newce = new ClassExpression(classExpression); String regex = newce.getRegex(); ClassExpression existing = bounded.get(regex); if (existing == null) { newce.getRoot().addInvoker(fullpath, invoker); addExpression(classExpression, newce); bounded.put(regex, newce); } else { existing.getRoot().addInvoker(fullpath, invoker); } } protected void addExpression(String path, ClassExpression ce)
if (widerMatching) rootNode.addInvoker(fullpath, invoker); else root.addInvoker(classExpression, fullpath, invoker); if (widerMatching) rootNode.addInvoker(fullpath, locator); else root.addInvoker(classExpression, fullpath, locator);