@Override public void execute() throws BuildException { if (classpath == null) { throw new BuildException("The classpath is not defined"); } if (wadlFile == null) { throw new BuildException("destfile attribute required", getLocation()); } if (baseUri == null || baseUri.length() == 0) { throw new BuildException("baseUri attribute required", getLocation()); } try { Application a = createApplication(classpath.list()); a.getResources().setBase(baseUri); JAXBContext c = JAXBContext.newInstance("com.sun.research.ws.wadl", this.getClass().getClassLoader()); Marshaller m = c.createMarshaller(); OutputStream out = new BufferedOutputStream(new FileOutputStream(wadlFile)); m.marshal(a, out); out.close(); } catch (Exception e) { throw new BuildException(e); } }
/** * @return the application * @see com.sun.jersey.server.wadl.WadlGenerator#createApplication() */ public Application createApplication(UriInfo requestInfo) { final Application result = _delegate.createApplication(requestInfo); if (_applicationDocs != null && _applicationDocs.getDocs() != null && !_applicationDocs.getDocs().isEmpty()) { result.getDoc().addAll(_applicationDocs.getDocs()); } return result; }