congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
CachingPipeline
Code IndexAdd Tabnine to your IDE (free)

How to use
CachingPipeline
in
org.apache.cocoon.pipeline

Best Java code snippets using org.apache.cocoon.pipeline.CachingPipeline (Showing top 11 results out of 315)

origin: org.apache.cocoon.pipeline/cocoon-pipeline

/**
 * {@inheritDoc}
 */
public static <PC extends PipelineComponent> LinkedPipelineStarterBuilder<PC> newCachingPipeline() {
  return newPipeline(new CachingPipeline<PC>());
}
origin: org.apache.cocoon.pipeline/cocoon-pipeline

@Override
public void setup(OutputStream outputStream, Map<String, Object> parameters) {
  // create a caching output stream to intercept the result
  this.cachingOutputStream = new CachingOutputStream(outputStream);
  super.setup(this.cachingOutputStream, parameters);
  this.cacheKey = this.constructCacheKey();
}
origin: org.apache.cocoon.pipeline/cocoon-pipeline

@Override
public void execute() throws Exception {
  if (this.logger.isDebugEnabled()) {
    this.logger.debug("Used cache: " + this.cache);
  }
  // checked for a cached value first
  CacheValue cachedValue = this.getCachedValue(this.cacheKey);
  if (this.isCacheKeyValid(cachedValue)) {
    // cached value found
    if (this.logger.isDebugEnabled()) {
      this.logger.debug("Write cache value to output stream: " + cachedValue);
    }
    cachedValue.writeTo(this.cachingOutputStream.getOutputStream());
    return;
  }
  // execute the pipeline
  this.invokeStarter();
  // cache the result
  CompleteCacheValue cacheValue = new CompleteCacheValue(this.cachingOutputStream.getContent(), this.cacheKey);
  this.setCachedValue(this.cacheKey, cacheValue);
}
origin: org.apache.cocoon.pipeline/cocoon-pipeline

for (PipelineComponent pipelineComponent : this.getComponents()) {
  if (pipelineComponent instanceof CachingPipelineComponent) {
    CachingPipelineComponent cachablePipelineComponent = (CachingPipelineComponent) pipelineComponent;
origin: org.apache.cocoon.servlet/cocoon-servlet

if (pipeline instanceof CachingPipeline) {
  CachingPipeline<PipelineComponent> cachingPipeline = (CachingPipeline<PipelineComponent>) pipeline;
  CacheKey cacheKey = cachingPipeline.getCacheKey();
  if (cacheKey != null) {
    setETag(Integer.toHexString(cacheKey.hashCode()));
origin: org.apache.cocoon.sax/cocoon-sax

/**
 * {@inheritDoc}
 */
public static LinkedSAXPipelineStarterBuilder newCachingPipeline() {
  return newPipeline(new CachingPipeline<SAXPipelineComponent>());
}
origin: org.lwapp/lwapp-dropwizard-core

@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();
}
origin: org.lwapp/lwapp-dropwizard-core

@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();
}
origin: org.lwapp/lwapp-dropwizard-core

@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();
}
origin: org.apache.syncope.core/syncope-core-rest-cxf

String wadl = wadlGenerator.getWadl();
Pipeline<SAXPipelineComponent> pipeline = new CachingPipeline<>();
pipeline.addComponent(new XMLGenerator(wadl));
if ("/index.html".equals(request.getServletPath())) {
origin: org.lwapp/lwapp-dropwizard-core

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();
}
org.apache.cocoon.pipelineCachingPipeline

Javadoc

A Pipeline implementation that returns a cached result if, and only if all its components support caching. A PipelineComponent is cacheable if it implements the interface CachingPipelineComponent.

Most used methods

  • <init>
  • constructCacheKey
  • getCacheKey
  • getCachedValue
  • getComponents
  • invokeStarter
  • isCacheKeyValid
  • setCachedValue

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • findViewById (Activity)
  • setRequestProperty (URLConnection)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • ImageIO (javax.imageio)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now