/** * {@inheritDoc} */ public static <PC extends PipelineComponent> LinkedPipelineStarterBuilder<PC> newCachingPipeline() { return newPipeline(new CachingPipeline<PC>()); }
/** * {@inheritDoc} */ public static LinkedSAXPipelineStarterBuilder newCachingPipeline() { return newPipeline(new CachingPipeline<SAXPipelineComponent>()); }
@GET @Path("schema/json") public Response schemaJson(@Context final HttpServletRequest request, @Context final HttpServletResponse response) throws Exception { final Pipeline<SAXPipelineComponent> pipeline = new CachingPipeline<SAXPipelineComponent>(); pipeline.addComponent(new XMLGenerator(applicationWADL())); final XSLTTransformer schemaXSLT = new XSLTTransformer(getClass().getResource("/jsonxsd.xsl")); final Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("contextPath", request.getContextPath()); parameters.put("schema-position", 1); parameters.put("schema-prefix", "schema"); schemaXSLT.setParameters(parameters); pipeline.addComponent(schemaXSLT); pipeline.addComponent(XMLSerializer.createHTML4Serializer()); pipeline.setup(response.getOutputStream()); pipeline.execute(); return Response.ok().build(); }
@GET public Response doGet(@Context final HttpServletRequest request, @Context final HttpServletResponse response) throws Exception { final Pipeline<SAXPipelineComponent> pipeline = new CachingPipeline<SAXPipelineComponent>(); pipeline.addComponent(new XMLGenerator(applicationWADL())); final XSLTTransformer xslt = new XSLTTransformer(getClass().getResource("/indexnew.xsl")); final Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("contextPath", request.getContextPath()); parameters.put("application", "application"); xslt.setParameters(parameters); pipeline.addComponent(xslt); pipeline.addComponent(XMLSerializer.createHTML4Serializer()); pipeline.setup(response.getOutputStream()); pipeline.execute(); return Response.ok().build(); }
@GET @Path("schema") public Response schema(@Context final HttpServletRequest request, @Context final HttpServletResponse response) throws Exception { final Pipeline<SAXPipelineComponent> pipeline = new CachingPipeline<SAXPipelineComponent>(); pipeline.addComponent(new XMLGenerator(applicationWADL())); final XSLTTransformer schemaXSLT = new XSLTTransformer(getClass().getResource("/schemanew.xsl")); final Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("contextPath", request.getContextPath()); parameters.put("schema-position", 1); parameters.put("schema-prefix", "schema"); schemaXSLT.setParameters(parameters); pipeline.addComponent(schemaXSLT); pipeline.addComponent(XMLSerializer.createHTML4Serializer()); pipeline.setup(response.getOutputStream()); pipeline.execute(); return Response.ok().build(); }
String wadl = wadlGenerator.getWadl(); Pipeline<SAXPipelineComponent> pipeline = new CachingPipeline<>(); pipeline.addComponent(new XMLGenerator(wadl)); if ("/index.html".equals(request.getServletPath())) {
public byte[] applicationWADL() throws Exception { final ByteArrayOutputStream baos; final Pipeline<SAXPipelineComponent> pipeline = new CachingPipeline<SAXPipelineComponent>(); final Application application = wadlContext.getApplication(uriInfo, false).getApplication(); /* * Get the current XML WADL into a byte array. */ final Marshaller marshaller = wadlContext.getJAXBContext().createMarshaller(); final ByteArrayOutputStream os = new ByteArrayOutputStream(); marshaller.marshal(application, os); final byte[] wadlXmlRepresentation = os.toByteArray(); final XMLGenerator pipelineComponent = new XMLGenerator(wadlXmlRepresentation); pipeline.addComponent(pipelineComponent); pipeline.addComponent(new XSLTTransformer(getClass().getResource("/prepare-includenew.xsl"))); pipeline.addComponent(new XIncludeTransformer(getClass().getResource("/"))); pipeline.addComponent(XMLSerializer.createXMLSerializer()); baos = new ByteArrayOutputStream(); pipeline.setup(baos); pipeline.execute(); return baos.toByteArray(); }