@Override public void visitAbstractSubResourceLocator(AbstractSubResourceLocator locator) { checkParameters(locator, locator.getMethod()); if (void.class == locator.getMethod().getReturnType()) { issueList.add(new ResourceModelIssue( locator, ImplMessages.ERROR_SUBRES_LOC_RETURNS_VOID(locator.getMethod()), true)); } if ((null == locator.getPath()) || (null == locator.getPath().getValue()) || (locator.getPath().getValue().length() == 0)) { issueList.add(new ResourceModelIssue( locator, ImplMessages.ERROR_SUBRES_LOC_URI_PATH_INVALID(locator.getMethod(), locator.getPath()), true)); } // Sub-resource locator can not have an entity parameter for (Parameter parameter : locator.getParameters()) { if (Parameter.Source.ENTITY == parameter.getSource()) { issueList.add(new ResourceModelIssue( locator, ImplMessages.ERROR_SUBRES_LOC_HAS_ENTITY_PARAM(locator.getMethod()), true)); } } } private static final Set<Class> ParamAnnotationSET = createParamAnnotationSet();
private static void workOutSubResourceLocatorsList( AbstractResource resource, MethodList methodList, boolean isEncoded) { for (AnnotatedMethod m : methodList.hasNotMetaAnnotation(HttpMethod.class). hasAnnotation(Path.class)) { final Path mPathAnnotation = m.getAnnotation(Path.class); final AbstractSubResourceLocator subResourceLocator = new AbstractSubResourceLocator( resource, m.getMethod(), new PathValue( mPathAnnotation.value()), m.getAnnotations()); processParameters( subResourceLocator.getResource().getResourceClass(), subResourceLocator.getMethod().getDeclaringClass(), subResourceLocator, m, isEncoded); resource.getSubResourceLocators().add(subResourceLocator); } }
public ContainerRequest filter(ContainerRequest request) { LOGGER.log(Level.INFO, "Sub-Resource Locator matched. " + "\n Path: " + asrl.getPath().getValue() + (context != null ? "\n Matched Result: " + context.getUriInfo().getMatchedResults().get(0) : "") + "\n Resource: " + asrl.getResource().getResourceClass().getName() + "\n Method: " + asrl.getMethod().toGenericString()); return request; } }
public ContainerRequest filter(ContainerRequest request) { LOGGER.log(Level.INFO, "Sub-Resource Locator matched. " + "\n Path: " + asrl.getPath().getValue() + (context != null ? "\n Matched Result: " + context.getUriInfo().getMatchedResults().get(0) : "") + "\n Resource: " + asrl.getResource().getResourceClass().getName() + "\n Method: " + asrl.getMethod().toGenericString()); return request; } }
public SubLocatorRule(UriTemplate template, List<Injectable> is, List<ContainerRequestFilter> requestFilters, List<ContainerResponseFilter> responseFilters, DispatchingListener dispatchingListener, AbstractSubResourceLocator locator) { super(template); this.is = AbstractHttpContextInjectable.transform(is); this.requestFilters = requestFilters; this.responseFilters = responseFilters; this.dispatchingListener = dispatchingListener; this.locator = locator; this.m = locator.getMethod(); }
PathPattern p = null; try { p = new PathPattern(new PathTemplate(locator.getPath().getValue())); } catch (IllegalArgumentException ex) { Errors.error(String.format("Illegal URI template for sub-resource locator %s: %s", locator.getMethod(), ex.getMessage())); continue; + "and the URI template %s transform to the same regular expression %s", p.getTemplate().getTemplate(), locator.getMethod(), conflict.getTemplate().getTemplate(), p)); locator.getMethod(), locator.getParameters(), ComponentScope.PerRequest); if (is.contains(null)) { Errors.missingDependency(locator.getMethod(), i);
public ContainerRequest filter(ContainerRequest request) { LOGGER.log(Level.INFO, "Sub-Resource Locator matched. " + "\n Path: " + asrl.getPath().getValue() + (context != null ? "\n Matched Result: " + context.getUriInfo().getMatchedResults().get(0) : "") + "\n Resource: " + asrl.getResource().getResourceClass().getName() + "\n Method: " + asrl.getMethod().toGenericString()); return request; } }
private static void workOutSubResourceLocatorsList( AbstractResource resource, MethodList methodList, boolean isEncoded) { for (AnnotatedMethod m : methodList.hasNotMetaAnnotation(HttpMethod.class). hasAnnotation(Path.class)) { final Path mPathAnnotation = m.getAnnotation(Path.class); final AbstractSubResourceLocator subResourceLocator = new AbstractSubResourceLocator( resource, m.getMethod(), new PathValue( mPathAnnotation.value()), m.getAnnotations()); processParameters( subResourceLocator.getResource().getResourceClass(), subResourceLocator.getMethod().getDeclaringClass(), subResourceLocator, m, isEncoded); resource.getSubResourceLocators().add(subResourceLocator); } }
l.getMethod().getReturnType()); Resource wadlSubResource = generateResource(subResource, l.getPath().getValue(), visitedClasses); wadlResource.getMethodOrResource().add(wadlSubResource); for (Parameter p : l.getParameters()) { Param wadlParam = generateParam(r, l, p); if (wadlParam != null && wadlParam.getStyle() == ParamStyle.TEMPLATE) {
private static void workOutSubResourceLocatorsList( AbstractResource resource, MethodList methodList, boolean isEncoded) { for (AnnotatedMethod m : methodList.hasNotMetaAnnotation(HttpMethod.class). hasAnnotation(Path.class)) { final Path mPathAnnotation = m.getAnnotation(Path.class); final AbstractSubResourceLocator subResourceLocator = new AbstractSubResourceLocator( resource, m.getMethod(), new PathValue( mPathAnnotation.value()), m.getAnnotations()); processParameters( subResourceLocator.getResource().getResourceClass(), subResourceLocator.getMethod().getDeclaringClass(), subResourceLocator, m, isEncoded); resource.getSubResourceLocators().add(subResourceLocator); } }
@Override public void visitAbstractSubResourceLocator(AbstractSubResourceLocator locator) { checkParameters(locator, locator.getMethod()); if (void.class == locator.getMethod().getReturnType()) { issueList.add(new ResourceModelIssue( locator, ImplMessages.ERROR_SUBRES_LOC_RETURNS_VOID(locator.getMethod()), true)); } if ((null == locator.getPath()) || (null == locator.getPath().getValue()) || (locator.getPath().getValue().length() == 0)) { issueList.add(new ResourceModelIssue( locator, ImplMessages.ERROR_SUBRES_LOC_URI_PATH_INVALID(locator.getMethod(), locator.getPath()), true)); } // Sub-resource locator can not have an entity parameter for (Parameter parameter : locator.getParameters()) { if (Parameter.Source.ENTITY == parameter.getSource()) { issueList.add(new ResourceModelIssue( locator, ImplMessages.ERROR_SUBRES_LOC_HAS_ENTITY_PARAM(locator.getMethod()), true)); } } } private static final Set<Class> ParamAnnotationSET = createParamAnnotationSet();
public SubLocatorRule(UriTemplate template, List<Injectable> is, List<ContainerRequestFilter> requestFilters, List<ContainerResponseFilter> responseFilters, DispatchingListener dispatchingListener, AbstractSubResourceLocator locator) { super(template); this.is = AbstractHttpContextInjectable.transform(is); this.requestFilters = requestFilters; this.responseFilters = responseFilters; this.dispatchingListener = dispatchingListener; this.locator = locator; this.m = locator.getMethod(); }
@Override public void visitAbstractSubResourceLocator(AbstractSubResourceLocator locator) { checkParameters(locator, locator.getMethod()); if (void.class == locator.getMethod().getReturnType()) { issueList.add(new ResourceModelIssue( locator, ImplMessages.ERROR_SUBRES_LOC_RETURNS_VOID(locator.getMethod()), true)); } if ((null == locator.getPath()) || (null == locator.getPath().getValue()) || (locator.getPath().getValue().length() == 0)) { issueList.add(new ResourceModelIssue( locator, ImplMessages.ERROR_SUBRES_LOC_URI_PATH_INVALID(locator.getMethod(), locator.getPath()), true)); } // Sub-resource locator can not have an entity parameter for (Parameter parameter : locator.getParameters()) { if (Parameter.Source.ENTITY == parameter.getSource()) { issueList.add(new ResourceModelIssue( locator, ImplMessages.ERROR_SUBRES_LOC_HAS_ENTITY_PARAM(locator.getMethod()), true)); } } } private static final Set<Class> ParamAnnotationSET = createParamAnnotationSet();
public SubLocatorRule(UriTemplate template, List<Injectable> is, List<ContainerRequestFilter> requestFilters, List<ContainerResponseFilter> responseFilters, DispatchingListener dispatchingListener, AbstractSubResourceLocator locator) { super(template); this.is = AbstractHttpContextInjectable.transform(is); this.requestFilters = requestFilters; this.responseFilters = responseFilters; this.dispatchingListener = dispatchingListener; this.locator = locator; this.m = locator.getMethod(); }
PathPattern p = null; try { p = new PathPattern(new PathTemplate(locator.getPath().getValue())); } catch (IllegalArgumentException ex) { Errors.error(String.format("Illegal URI template for sub-resource locator %s: %s", locator.getMethod(), ex.getMessage())); continue; + "and the URI template %s transform to the same regular expression %s", p.getTemplate().getTemplate(), locator.getMethod(), conflict.getTemplate().getTemplate(), p)); locator.getMethod(), locator.getParameters(), ComponentScope.PerRequest); if (is.contains(null)) { Errors.missingDependency(locator.getMethod(), i);
protected Set<Class> getDefiningClasses(AbstractResource resourceClass) { HashSet<Class> definingClasses = new HashSet<Class>(); for (AbstractResourceMethod resourceMethod : resourceClass.getResourceMethods()) { definingClasses.add(new AnnotatedMethod(resourceMethod.getMethod()).getMethod().getDeclaringClass()); } for (AbstractResourceMethod resourceMethod : resourceClass.getSubResourceMethods()) { definingClasses.add(new AnnotatedMethod(resourceMethod.getMethod()).getMethod().getDeclaringClass()); } for (AbstractSubResourceLocator locator : resourceClass.getSubResourceLocators()) { definingClasses.add(new AnnotatedMethod(locator.getMethod()).getMethod().getDeclaringClass()); } return definingClasses; }
l.getMethod().getReturnType()); Resource wadlSubResource = generateResource(subResource, l.getPath().getValue(), visitedClasses); wadlResource.getMethodOrResource().add(wadlSubResource); for (Parameter p : l.getParameters()) { Param wadlParam = generateParam(r, l, p); if (wadlParam != null && wadlParam.getStyle() == ParamStyle.TEMPLATE) {