protected void finish(final Pipeline<SAXPipelineComponent> pipeline, final HttpServletResponse response) throws ServletException, IOException { pipeline.addComponent(XMLSerializer.createHTML4Serializer()); pipeline.setup(response.getOutputStream()); try { pipeline.execute(); } catch (Exception e) { throw new ServletException(e); } }
public LinkedPipelineSetupBuilder<SAXPipelineComponent> setConfiguration(final Map<String, ? extends Object> parameters) { if (parameters == null) { throw new IllegalArgumentException("Parameter 'parameters' must be not null"); } pipeline.setConfiguration(parameters); return new LinkedPipelineSetupBuilder<SAXPipelineComponent>() { public Pipeline<SAXPipelineComponent> setup(final OutputStream outputStream) { if (outputStream == null) { throw new IllegalArgumentException("Parameter 'outputStream' must be not null"); } pipeline.setup(outputStream); return pipeline; } }; }
/** * {@inheritDoc} * * @see org.apache.cocoon.sitemap.Invocation#execute() */ public void execute() throws Exception { if (this.pipeline == null) { throw new IllegalStateException("InvocationImpl has been executed without having a pipeline."); } // first setup everything for (final Action action : this.actions) { action.setup(this.parameters); } this.pipeline.setup(this.outputStream, this.parameters); // then execute for (final Action action : this.actions) { action.execute(); } this.pipeline.execute(); }
/** * {@inheritDoc} */ public <SPC extends SAXPipelineComponent> LinkedSAXPipelineComponentBuilder addComponent(SPC pipelineComponent) { if (pipelineComponent == null) { throw new IllegalArgumentException("Parameter 'pipelineComponent' must not be null"); } this.pipeline.addComponent(pipelineComponent); return this; }
final long lastModified = pipeline.getLastModified(); String newValue = pipeline.getContentType(); if (newValue != null) { setMimeType(newValue);
/** * {@inheritDoc} */ public <SPC extends SAXPipelineComponent> LinkedSAXPipelineComponentBuilder setStarter(SPC starter) { if (starter == null) { throw new IllegalArgumentException("Parameter 'starter' must be not null"); } if (!(starter instanceof Starter)) { throw new IllegalArgumentException("Parameter 'starter' must be org.apache.cocoon.pipeline.component.Starter instance"); } this.pipeline.addComponent(starter); return new LinkedSAXPipelineComponentBuilderImpl(this.pipeline); }
@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(); }
throw new IllegalArgumentException("Parameter 'starter' must be org.apache.cocoon.pipeline.component.Starter instance"); pipeline.addComponent(starter);
/** * {@inheritDoc} * * @see org.apache.cocoon.sitemap.Invocation#installPipeline(java.lang.String, * java.util.Map) */ public void installPipeline(String type, Map<String, ? extends Object> componentParameters) { this.pipeline = this.componentProvider.createPipeline(type); Map<String, ? extends Object> resolvedParameters = this.resolveParameters(componentParameters); this.pipeline.setConfiguration(resolvedParameters); }
@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(); }
/** * {@inheritDoc} */ public LinkedPipelineConfigurationBuilder<SAXPipelineComponent> addSerializer() { this.pipeline.addComponent(new XMLSerializer()); return new LinkedPipelineConfigurationBuilder<SAXPipelineComponent>() { @SuppressWarnings("unchecked") public LinkedPipelineSetupBuilder<SAXPipelineComponent> withEmptyConfiguration() { return this.setConfiguration(Collections.EMPTY_MAP); } public LinkedPipelineSetupBuilder<SAXPipelineComponent> setConfiguration(final Map<String, ? extends Object> parameters) { if (parameters == null) { throw new IllegalArgumentException("Parameter 'parameters' must be not null"); } pipeline.setConfiguration(parameters); return new LinkedPipelineSetupBuilder<SAXPipelineComponent>() { public Pipeline<SAXPipelineComponent> setup(final OutputStream outputStream) { if (outputStream == null) { throw new IllegalArgumentException("Parameter 'outputStream' must be not null"); } pipeline.setup(outputStream); return pipeline; } }; } }; }
@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(); }
/** * {@inheritDoc} * * @see org.apache.cocoon.sitemap.Invocation#installComponent(java.lang.String, * java.util.Map) */ public void installComponent(String type, Map<String, ? extends Object> componentParameters) { if (this.pipeline == null) { throw new IllegalStateException("Pipeline component cannot be installed without having a pipeline."); } PipelineComponent component = this.componentProvider.createComponent(type); Map<String, ? extends Object> resolvedParameters = this.resolveParameters(componentParameters); component.setConfiguration(resolvedParameters); this.pipeline.addComponent(component); if (component instanceof Finisher) { this.hasFinisher = true; } }
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(); }
pipeline.addComponent(new XMLGenerator(wadl)); if ("/index.html".equals(request.getServletPath())) { XSLTTransformer xslt = new XSLTTransformer(getClass().getResource("/wadl2html/index.xsl")); xslt.setParameters(parameters); pipeline.addComponent(xslt); xslt.setParameters(parameters); pipeline.addComponent(xslt);
Pipeline<SAXPipelineComponent> pipeline = new NonCachingPipeline<SAXPipelineComponent>(); pipeline.addComponent(new XMLGenerator(xmlString)); for (URL xsltUrl : xsltUrls) { XSLTTransformer xsltTransformer = new XSLTTransformer(xsltUrl); xsltTransformer.setParameters(xsltParameters); pipeline.addComponent(xsltTransformer); outputProperties = new Properties(); pipeline.addComponent(new XMLSerializer(outputProperties)); pipeline.setup(outputStream, null); pipeline.execute();
pipeline.addComponent(new XMLGenerator(zis)); StandardCharsets.UTF_8))); xsl2html.setParameters(parameters); pipeline.addComponent(xsl2html); pipeline.addComponent(XMLSerializer.createXHTMLSerializer()); break; StandardCharsets.UTF_8))); xsl2pdf.setParameters(parameters); pipeline.addComponent(xsl2pdf); pipeline.addComponent(new FopSerializer(MimeConstants.MIME_PDF)); break; StandardCharsets.UTF_8))); xsl2rtf.setParameters(parameters); pipeline.addComponent(xsl2rtf); pipeline.addComponent(new FopSerializer(MimeConstants.MIME_RTF)); break; StandardCharsets.UTF_8))); xsl2csv.setParameters(parameters); pipeline.addComponent(xsl2csv); pipeline.addComponent(new TextSerializer()); break; pipeline.addComponent(XMLSerializer.createXMLSerializer()); pipeline.setup(os);