public List<Object> getMatchedResources() { if (stack != null) { List<Object> resources = new LinkedList<>(); for (MethodInvocationInfo invocation : stack) { resources.add(0, invocation.getRealClass()); } return resources; } LOG.fine("No resource stack information, returning empty list"); return Collections.emptyList(); }
public List<String> getMatchedURIs(boolean decode) { if (stack != null) { List<String> objects = new ArrayList<String>(); List<String> uris = new LinkedList<String>(); StringBuilder sum = new StringBuilder(""); for (MethodInvocationInfo invocation : stack) { OperationResourceInfo ori = invocation.getMethodInfo(); URITemplate[] paths = { ori.getClassResourceInfo().getURITemplate(), ori.getURITemplate() }; for (URITemplate t : paths) { if (t != null) { String v = t.getValue(); sum.append("/" + (decode ? HttpUtils.pathDecode(v) : v)); } } UriBuilder ub = UriBuilder.fromPath(sum.toString()); objects.addAll(invocation.getTemplateValues()); uris.add(0, ub.build(objects.toArray()).normalize().getRawPath()); } return uris; } LOG.fine("No resource stack information, returning empty list"); return Collections.emptyList(); }
stack.lastElement().getMethodInfo().getClassResourceInfo(), instance, application,
private void pushOntoStack(OperationResourceInfo ori, Class<?> realClass, Message msg) { OperationResourceInfoStack stack = msg.get(OperationResourceInfoStack.class); if (stack == null) { stack = new OperationResourceInfoStack(); msg.put(OperationResourceInfoStack.class, stack); } @SuppressWarnings("unchecked") MultivaluedMap<String, String> params = (MultivaluedMap<String, String>)msg.get(URITemplate.TEMPLATE_PARAMETERS); List<String> values = null; if (params == null || params.size() == 1) { values = Collections.emptyList(); } else { values = new ArrayList<String>(params.size() - 1); for (Parameter pm : ori.getParameters()) { if (pm.getType() == ParameterType.PATH) { List<String> paramValues = params.get(pm.getName()); if (paramValues != null) { values.addAll(paramValues); } } } } stack.push(new MethodInvocationInfo(ori, realClass, values)); } }
StringBuilder sumPath = new StringBuilder(""); for (MethodInvocationInfo invocation : stack) { List<String> templateObjects = invocation.getTemplateValues(); OperationResourceInfo ori = invocation.getMethodInfo(); URITemplate[] paths = { ori.getClassResourceInfo().getURITemplate(),
stack.lastElement().getMethodInfo().getClassResourceInfo(), instance, application,
public static void pushOntoStack(OperationResourceInfo ori, MultivaluedMap<String, String> params, Message msg) { OperationResourceInfoStack stack = msg.get(OperationResourceInfoStack.class); if (stack == null) { stack = new OperationResourceInfoStack(); msg.put(OperationResourceInfoStack.class, stack); } List<String> values = null; if (params.size() <= 1) { values = Collections.emptyList(); } else { values = new ArrayList<>(params.size() - 1); addTemplateVarValues(values, params, ori.getClassResourceInfo().getURITemplate()); addTemplateVarValues(values, params, ori.getURITemplate()); } Class<?> realClass = ori.getClassResourceInfo().getServiceClass(); stack.push(new MethodInvocationInfo(ori, realClass, values)); }
public List<Object> getMatchedResources() { if (stack != null) { List<Object> resources = new LinkedList<Object>(); for (MethodInvocationInfo invocation : stack) { resources.add(0, invocation.getRealClass()); } return resources; } LOG.fine("No resource stack information, returning empty list"); return Collections.emptyList(); }