public void onConflict(PathPattern p1, PathPattern p2) { Errors.error(String.format("Conflicting URI templates. " + "The URI templates %s and %s for root resource classes " + "transform to the same regular expression %s", p1.getTemplate().getTemplate(), p2.getTemplate().getTemplate(), p1)); } });
public void onConflict(PathPattern p1, PathPattern p2) { Errors.error(String.format("Conflicting URI templates. " + "The URI templates %s and %s for sub-resource methods " + "and/or sub-resource locators of resource class %s " + "transform to the same regular expression %s", p1.getTemplate().getTemplate(), p2.getTemplate().getTemplate(), resource.getResourceClass().getName(), p1)); } });
private boolean isPatternValid(PathPattern p, Class c) { if (p == null) return false; final PathPattern conflict = rules.hasConflict(p); if (conflict != null) { Errors.error(String.format("Conflicting URI templates. " + "The URI template %s for root resource class %s " + "and the URI template %s transform to the same regular expression %s", p.getTemplate().getTemplate(), c.getName(), conflict.getTemplate().getTemplate(), p)); return false; } else { return true; } }
private void trace(Object resource, Object subResource, UriRuleContext context) { final String prevPath = context.getUriInfo().getMatchedURIs().get(1); final String currentPath = context.getUriInfo().getMatchedURIs().get(0); context.trace( String.format("accept sub-resource locator: \"%s\" : \"%s\" -> @Path(\"%s\") " + "%s = %s", prevPath, currentPath.substring(prevPath.length()), getTemplate().getTemplate(), ReflectionHelper.methodInstanceToString(resource, m), subResource)); }
/** * Create the WADL resource method for OPTIONS. * <p> * This is created using reflection so that there is no runtime * dependency on JAXB. If the JAXB jars are not in the class path * then WADL generation will not be supported. * * @param resource the resource model * @return the WADL resource OPTIONS method */ public ResourceMethod createWadlOptionsMethod( Map<String, List<ResourceMethod>> methods, AbstractResource resource, PathPattern p) { if (!isSupported()) return null; if (p == null) { return new WadlMethodFactory.WadlOptionsMethod(methods, resource, null, wadlApplicationContext); } else { // Remove the '/' from the beginning String path = p.getTemplate().getTemplate().substring(1); return new WadlMethodFactory.WadlOptionsMethod(methods, resource, path, wadlApplicationContext); } }
/** * Trie initialization */ private TrieNode<R> initTrie(List<PatternRulePair<R>> rules) { TrieNode<R> a = new TrieNode<R>(); for (PatternRulePair<R> prp : rules) { if (prp.p instanceof PathPattern) { PathPattern p = (PathPattern)prp.p; a.add(p.getTemplate().getTemplate(), prp.r, prp.p); } else { throw new IllegalArgumentException( "The automata matching algorithm currently only works" + "for UriPattern instance that are instances of " + "PathPattern"); } } a.pack(); return a; }
String.format("accept resource: \"%s\" -> @Path(\"%s\") %s", context.getUriInfo().getMatchedURIs().get(0), getTemplate().getTemplate(), ReflectionHelper.objectToString(resourceObject)
"accept resource: \"%s\" -> @Path(\"%s\") %s", context.getUriInfo().getMatchedURIs().get(0), getTemplate().getTemplate(), ReflectionHelper.objectToString(resource)
+ "The URI template %s for sub-resource locator %s " + "and the URI template %s transform to the same regular expression %s", p.getTemplate().getTemplate(), locator.getMethod(), conflict.getTemplate().getTemplate(), p)); continue;
public void onConflict(PathPattern p1, PathPattern p2) { Errors.error(String.format("Conflicting URI templates. " + "The URI templates %s and %s for root resource classes " + "transform to the same regular expression %s", p1.getTemplate().getTemplate(), p2.getTemplate().getTemplate(), p1)); } });
public void onConflict(PathPattern p1, PathPattern p2) { Errors.error(String.format("Conflicting URI templates. " + "The URI templates %s and %s for root resource classes " + "transform to the same regular expression %s", p1.getTemplate().getTemplate(), p2.getTemplate().getTemplate(), p1)); } });
public void onConflict(PathPattern p1, PathPattern p2) { Errors.error(String.format("Conflicting URI templates. " + "The URI templates %s and %s for sub-resource methods " + "and/or sub-resource locators of resource class %s " + "transform to the same regular expression %s", p1.getTemplate().getTemplate(), p2.getTemplate().getTemplate(), resource.getResourceClass().getName(), p1)); } });
public void onConflict(PathPattern p1, PathPattern p2) { Errors.error(String.format("Conflicting URI templates. " + "The URI templates %s and %s for sub-resource methods " + "and/or sub-resource locators of resource class %s " + "transform to the same regular expression %s", p1.getTemplate().getTemplate(), p2.getTemplate().getTemplate(), resource.getResourceClass().getName(), p1)); } });
private boolean isPatternValid(PathPattern p, Class c) { if (p == null) return false; final PathPattern conflict = rules.hasConflict(p); if (conflict != null) { Errors.error(String.format("Conflicting URI templates. " + "The URI template %s for root resource class %s " + "and the URI template %s transform to the same regular expression %s", p.getTemplate().getTemplate(), c.getName(), conflict.getTemplate().getTemplate(), p)); return false; } else { return true; } }
private boolean isPatternValid(PathPattern p, Class c) { if (p == null) return false; final PathPattern conflict = rules.hasConflict(p); if (conflict != null) { Errors.error(String.format("Conflicting URI templates. " + "The URI template %s for root resource class %s " + "and the URI template %s transform to the same regular expression %s", p.getTemplate().getTemplate(), c.getName(), conflict.getTemplate().getTemplate(), p)); return false; } else { return true; } }
private void trace(Object resource, Object subResource, UriRuleContext context) { final String prevPath = context.getUriInfo().getMatchedURIs().get(1); final String currentPath = context.getUriInfo().getMatchedURIs().get(0); context.trace( String.format("accept sub-resource locator: \"%s\" : \"%s\" -> @Path(\"%s\") " + "%s = %s", prevPath, currentPath.substring(prevPath.length()), getTemplate().getTemplate(), ReflectionHelper.methodInstanceToString(resource, m), subResource)); }
private void trace(Object resource, Object subResource, UriRuleContext context) { final String prevPath = context.getUriInfo().getMatchedURIs().get(1); final String currentPath = context.getUriInfo().getMatchedURIs().get(0); context.trace( String.format("accept sub-resource locator: \"%s\" : \"%s\" -> @Path(\"%s\") " + "%s = %s", prevPath, currentPath.substring(prevPath.length()), getTemplate().getTemplate(), ReflectionHelper.methodInstanceToString(resource, m), subResource)); }
/** * Trie initialization */ private TrieNode<R> initTrie(List<PatternRulePair<R>> rules) { TrieNode<R> a = new TrieNode<R>(); for (PatternRulePair<R> prp : rules) { if (prp.p instanceof PathPattern) { PathPattern p = (PathPattern)prp.p; a.add(p.getTemplate().getTemplate(), prp.r, prp.p); } else { throw new IllegalArgumentException( "The automata matching algorithm currently only works" + "for UriPattern instance that are instances of " + "PathPattern"); } } a.pack(); return a; }
/** * Trie initialization */ private TrieNode<R> initTrie(List<PatternRulePair<R>> rules) { TrieNode<R> a = new TrieNode<R>(); for (PatternRulePair<R> prp : rules) { if (prp.p instanceof PathPattern) { PathPattern p = (PathPattern)prp.p; a.add(p.getTemplate().getTemplate(), prp.r, prp.p); } else { throw new IllegalArgumentException( "The automata matching algorithm currently only works" + "for UriPattern instance that are instances of " + "PathPattern"); } } a.pack(); return a; }
/** * Create the WADL resource method for OPTIONS. * <p> * This is created using reflection so that there is no runtime * dependency on JAXB. If the JAXB jars are not in the class path * then WADL generation will not be supported. * * @param resource the resource model * @return the WADL resource OPTIONS method */ public ResourceMethod createWadlOptionsMethod( Map<String, List<ResourceMethod>> methods, AbstractResource resource, PathPattern p) { if (!isSupported()) return null; if (p == null) { return new WadlMethodFactory.WadlOptionsMethod(methods, resource, null, wadlApplicationContext); } else { // Remove the '/' from the beginning String path = p.getTemplate().getTemplate().substring(1); return new WadlMethodFactory.WadlOptionsMethod(methods, resource, path, wadlApplicationContext); } }