private Resource generateSubResource(AbstractResource r, String path) { Resource wadlResource = new Resource(); if (r.isRootResource()) { StringBuilder b = new StringBuilder(r.getPath().getValue()); if (!(r.getPath().getValue().endsWith("/") || path.startsWith("/"))) { b.append("/"); } b.append(path); wadlResource.setPath(b.toString()); } // for each sub-resource method Map<String, Param> wadlSubResourceParams = new HashMap<String, Param>(); for (AbstractSubResourceMethod m : r.getSubResourceMethods()) { // find or create sub resource for uri template String template = m.getPath().getValue(); if (!template.equals(path) && !template.equals('/' + path)) { continue; } com.sun.research.ws.wadl.Method wadlMethod = generateMethod(r, wadlSubResourceParams, m); wadlResource.getMethodOrResource().add(wadlMethod); } // add parameters that are associated with each sub-resource method PATH template for (Param wadlParam : wadlSubResourceParams.values()) { wadlResource.getParam().add(wadlParam); } return wadlResource; }
/** * @param r Jersey resource component for which the WADL reource is to be created. * @param path path where the resource is exposed. * @return the enhanced {@link com.sun.research.ws.wadl.Resource}. * @see org.glassfish.jersey.server.wadl.WadlGenerator#createResource(org.glassfish.jersey.server.model.Resource, String) */ public Resource createResource(final org.glassfish.jersey.server.model.Resource r, final String path) { final Resource result = delegate.createResource(r, path); for (final Class<?> resourceClass : r.getHandlerClasses()) { final ClassDocType classDoc = resourceDoc.getClassDoc(resourceClass); if (classDoc != null && !isEmpty(classDoc.getCommentText())) { final Doc doc = new Doc(); doc.getContent().add(classDoc.getCommentText()); result.getDoc().add(doc); } } return result; }
wadlSubResource.getAny().add(WadlApplicationContextImpl.EXTENDED_ELEMENT); wadlSubResource.getParam().add(wadlParam); wadlResource.getMethodOrResource().add(wadlMethod); wadlResource.getParam().add(wadlParam); continue; wadlResource.getMethodOrResource().add(childWadlResource);
@Override public Resource createResource(org.glassfish.jersey.server.model.Resource resource, String path) { Resource wadlResource = new Resource(); if (path != null) { wadlResource.setPath(path); } else if (resource.getPath() != null) { wadlResource.setPath(resource.getPath()); } if (resource.isExtended()) { wadlResource.getAny().add(WadlApplicationContextImpl.EXTENDED_ELEMENT); } return wadlResource; }
@Override public Application getApplication(final UriInfo info, final org.glassfish.jersey.server.model.Resource resource, final boolean detailedWadl) { // Get the root application description // final ApplicationDescription description = getApplication(info, detailedWadl); final WadlGenerator wadlGenerator = wadlGeneratorConfig.createWadlGenerator(injectionManager); final Application application = new WadlBuilder(wadlGenerator, detailedWadl, info).generate(description, resource); if (application == null) { return null; } for (final Resources resources : application.getResources()) { resources.setBase(info.getBaseUri().toString()); } // Attach any grammar we may have attachExternalGrammar(application, description, info.getRequestUri()); for (final Resources resources : application.getResources()) { final Resource r = resources.getResource().get(0); r.setPath(info.getBaseUri().relativize(info.getAbsolutePath()).toString()); // remove path params since path is fixed at this point r.getParam().clear(); } return application; }
/** * Create an instance of {@link Resource } * */ public Resource createResource() { return new Resource(); }
List<Resource> resourceList = appResources.getResource(); for (Resource appResource : resourceList) { String path = appResource.getPath(); if (RestPaths.SLIDER_CONTEXT_ROOT.equals(path)) { List<Object> sliderResources = appResource.getMethodOrResource(); Iterator<Object> itor = sliderResources.iterator(); while (itor.hasNext()) { if (sliderRes instanceof Resource) { Resource res = (Resource) sliderRes; if (RestPaths.SLIDER_SUBPATH_AGENTS.equals(res.getPath())) {
@Override public Resource createResource(org.glassfish.jersey.server.model.Resource resource, String path) { Resource wadlResource = new Resource(); if (path != null) { wadlResource.setPath(path); } else if (resource.getPath() != null) { wadlResource.setPath(resource.getPath()); } if (resource.isExtended()) { wadlResource.getAny().add(WadlApplicationContextImpl.EXTENDED_ELEMENT); } return wadlResource; }
@Override public Application getApplication(final UriInfo info, final org.glassfish.jersey.server.model.Resource resource, final boolean detailedWadl) { // Get the root application description // final ApplicationDescription description = getApplication(info, detailedWadl); final WadlGenerator wadlGenerator = wadlGeneratorConfig.createWadlGenerator(injectionManager); final Application application = new WadlBuilder(wadlGenerator, detailedWadl, info).generate(description, resource); if (application == null) { return null; } for (final Resources resources : application.getResources()) { resources.setBase(info.getBaseUri().toString()); } // Attach any grammar we may have attachExternalGrammar(application, description, info.getRequestUri()); for (final Resources resources : application.getResources()) { final Resource r = resources.getResource().get(0); r.setPath(info.getBaseUri().relativize(info.getAbsolutePath()).toString()); // remove path params since path is fixed at this point r.getParam().clear(); } return application; }
/** * Create an instance of {@link Resource } * */ public Resource createResource() { return new Resource(); }
List<Resource> resourceList = appResources.getResource(); for (Resource appResource : resourceList) { String path = appResource.getPath(); if (RestPaths.SLIDER_CONTEXT_ROOT.equals(path)) { List<Object> sliderResources = appResource.getMethodOrResource(); Iterator<Object> itor = sliderResources.iterator(); while (itor.hasNext()) { if (sliderRes instanceof Resource) { Resource res = (Resource) sliderRes; if (RestPaths.SLIDER_SUBPATH_AGENTS.equals(res.getPath())) {
Param wadlParam = generateParam(r, null, fp); if (wadlParam != null) { wadlResource.getParam().add(wadlParam); wadlResource.getMethodOrResource().add(wadlMethod); wadlResource.getParam().add(wadlParam); Map<String, Param> wadlSubResourceParams = wadlSubResourcesParams.get(template); if (wadlSubResource == null) { wadlSubResource = new Resource(); wadlSubResource.setPath(template); wadlSubResources.put(template, wadlSubResource); wadlSubResourceParams = new HashMap<String, Param>(); wadlSubResourcesParams.put(template, wadlSubResourceParams); wadlResource.getMethodOrResource().add(wadlSubResource); wadlSubResource.getMethodOrResource().add(wadlMethod); Map<String, Param> wadlSubResourceParams = wadlSubResourcesParams.get(template); for (Param wadlParam : wadlSubResourceParams.values()) { wadlSubResource.getParam().add(wadlParam); Resource wadlSubResource = generateResource(subResource, l.getPath().getValue(), visitedClasses); wadlResource.getMethodOrResource().add(wadlSubResource); wadlSubResource.getParam().add(wadlParam);
wadlSubResource.getAny().add(WadlApplicationContextImpl.EXTENDED_ELEMENT); wadlSubResource.getParam().add(wadlParam); wadlResource.getMethodOrResource().add(wadlMethod); wadlResource.getParam().add(wadlParam); continue; wadlResource.getMethodOrResource().add(childWadlResource);
@Override public Resource createResource(org.glassfish.jersey.server.model.Resource resource, String path) { Resource wadlResource = new Resource(); if (path != null) { wadlResource.setPath(path); } else if (resource.getPath() != null) { wadlResource.setPath(resource.getPath()); } if (resource.isExtended()) { wadlResource.getAny().add(WadlApplicationContextImpl.EXTENDED_ELEMENT); } return wadlResource; }
@Override public Application getApplication(UriInfo info, AbstractResource resource, String path) { // Get the root application description // ApplicationDescription description = getApplication(info); WadlGenerator wadlGenerator = wadlGeneratorConfig.createWadlGenerator(); Application a = path == null ? new WadlBuilder( wadlGenerator ).generate(providers,fap,info, description,resource) : new WadlBuilder( wadlGenerator ).generate(providers, fap, info, description, resource, path); for (Resources resources : a.getResources()) { resources.setBase(info.getBaseUri().toString()); } // Attach any grammar we may have attachExternalGrammar(a, description, info.getRequestUri()); for (Resources resources : a.getResources()) { final Resource r = resources.getResource().get(0); r.setPath(info.getBaseUri().relativize(info.getAbsolutePath()).toString()); // remove path params since path is fixed at this point r.getParam().clear(); } return a; }
/** * Create an instance of {@link Resource } * */ public Resource createResource() { return new Resource(); }
/** * @param r Jersey resource component for which the WADL reource is to be created. * @param path path where the resource is exposed. * @return the enhanced {@link com.sun.research.ws.wadl.Resource}. * @see org.glassfish.jersey.server.wadl.WadlGenerator#createResource(org.glassfish.jersey.server.model.Resource, String) */ public Resource createResource(final org.glassfish.jersey.server.model.Resource r, final String path) { final Resource result = delegate.createResource(r, path); for (final Class<?> resourceClass : r.getHandlerClasses()) { final ClassDocType classDoc = resourceDoc.getClassDoc(resourceClass); if (classDoc != null && !isEmpty(classDoc.getCommentText())) { final Doc doc = new Doc(); doc.getContent().add(classDoc.getCommentText()); result.getDoc().add(doc); } } return result; }