Package org.apache.cocoon.pipeline

Examples of org.apache.cocoon.pipeline.ProcessingException


        } catch (MalformedURLException e) {
            String message = "Can't parse URL " + sourceAtt;
            if (this.logger.isErrorEnabled()) {
                this.logger.error(message, e);
            }
            throw new ProcessingException(message, e);
        }
    }
View Full Code Here


    public void endElement(String uri, String localName, String qName) throws SAXException {
        if (DOCS.equals(localName)) {
            try {
                this.solr.commit();
            } catch (Exception e) {
                throw new ProcessingException("Unable to commit the Solr documents.", e);
            }
        } else if (DOC.equals(localName)) {
            try {
                this.solr.add(this.doc);
                this.doc = new SolrInputDocument();
            } catch (Exception e) {
                throw new ProcessingException("Unable to add the Solr document.", e);
            }
        } else if (FIELD.equals(localName)) {
            if (!this.isNull && this.text.length() > 0) {
                this.doc.addField(this.name, this.text.toString(), this.boost);
                this.boost = 1.0f;
View Full Code Here

                this.getSAXConsumer().endDocument();
            } else {
                xmlMarshaller.marshal(this.toBeMarshalled.getObject(), this.getSAXConsumer());
            }
        } catch (Exception e) {
            throw new ProcessingException("Impossible to marshal object of type "
                    + type
                    + " to XML", e);
        }
    }
View Full Code Here

     *
     * @param recorder
     */
    protected void setRecorder(ContentHandler recorder) {
        if (this.isRecording) {
            throw new ProcessingException("Only one recorder can be set.");
        }

        this.isRecording = true;
        this.originalSAXConsumer = this.getSAXConsumer();
        SAXConsumerAdapter saxConsumerAdapter = new SAXConsumerAdapter();
View Full Code Here

        return readCacheKey();
    }

    public void setup(String controllerName, Map<String, Object> inputParameters, Map<String, ? extends Object> configuration) {
        if (!this.applicationContext.isPrototype(controllerName)) {
            throw new ProcessingException("A REST controller bean MUST run within the 'prototype' scope.");
        }

        try {
            // get the prepared controller
            Object controller = this.getController(controllerName, inputParameters, configuration);
View Full Code Here

    private Map<String, ? extends Object> inputParameters;

    public void execute() {
        HttpServletRequest request = HttpContextHelper.getRequest(this.inputParameters);
        if (!"POST".equals(request.getMethod())) {
            throw new ProcessingException("Cannot create consumer source for request that is not POST.");
        }

        InputStream inputStream = null;
        try {
            inputStream = request.getInputStream();
        } catch (IOException e) {
            throw new ProcessingException("Can't open inputStream on request.");
        }

        try {
            XMLUtils.toSax(inputStream, this.getSAXConsumer());
        } catch (PipelineException e) {
            throw e;
        } catch (Exception e) {
            throw new ProcessingException("Can't parse inputStream.", e);
        }
    }
View Full Code Here

        }

        try {
            XMLUtils.toSax(this.service.openConnection(), this.getSAXConsumer());
        } catch (Exception e) {
            throw new ProcessingException("Can't parse " + this.service, e);
        }
    }
View Full Code Here

    private URLConnection getUrlConnection() {
        if (this.servletConnection == null) {
            try {
                this.servletConnection = this.service.openConnection();
            } catch (IOException e) {
                throw new ProcessingException("Can't use connected servlet service: " + this.service, e);
            }
        }

        return this.servletConnection;
    }
View Full Code Here

            return;
        }

        String sourceAtt = atts.getValue(SRC_ATTR);
        if (null == sourceAtt || "".equals(sourceAtt)) {
            throw new ProcessingException("The <include> element must contain a 'src' attribute that contains a URL.");
        }

        try {
            URL source = this.createSource(sourceAtt);

            XMLReader xmlReader = XMLReaderFactory.createXMLReader();
            EmbeddedSAXPipe embeddedSAXPipe = new EmbeddedSAXPipe(this.getSAXConsumer());
            xmlReader.setContentHandler(embeddedSAXPipe);
            xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", embeddedSAXPipe);

            BufferedInputStream inputStream = new BufferedInputStream(source.openStream());
            xmlReader.parse(new InputSource(inputStream));

            return;
        } catch (IOException e) {
            throw new ProcessingException(("Can't read from URL " + sourceAtt), e);
        }
    }
View Full Code Here

                IOUtils.closeQuietly(inputStream);
            }
        } catch (PipelineException e) {
            throw e;
        } catch (Exception e) {
            throw new ProcessingException("Can't parse url connection " + this.source, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.pipeline.ProcessingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.