Examples of PAPIException


Examples of com.volantis.mcs.papi.PAPIException

                ptFactory.createPageDetailsManager().addPageDetails(
                        pageDetails);
            } catch (PageTrackerException pte) {
                // ptFactory does not log errors so do it here.
                logger.error("pagedetails-creation-failure", pte);
                throw new PAPIException(
                        "Error occured when creating PageDetails", pte);
            }
        }

        // If we have been included in a region then we mustn't throw the
View Full Code Here

Examples of com.volantis.mcs.papi.PAPIException

        String name = attributes.getName();
        Segment segment = pageContext.getSegment(name);
        if (segment == null) {
            logger.error("segment-not-called", new Object[]{name});
            throw new PAPIException(
                    exceptionLocalizer.format("missing-segment", name));
        }

        SegmentInstance segmentInstance
                = (SegmentInstance) pageContext.getFormatInstance(segment,
View Full Code Here

Examples of com.volantis.mcs.papi.PAPIException

        SelectState state = null;

        try {
            state = pageContext.peekSelectState();
        } catch (EmptyStackException e) {
            throw new PAPIException(
                    exceptionLocalizer.format("select-markup-missing"), e);
        }

        if (state.isOtherwiseExecuted()) {
            throw new PAPIException(
                    exceptionLocalizer.format("when-preceed-otherwise"));
        } else if (!state.isMatched() ||
                (state.getPrecept() == Precept.MATCH_EVERY)) {
            // Can continue to see if this when should be evaluated since
            // every precept can be matched or no matches have yet been found
            if (attributes.getExpr() != null) {
                ExpressionContext expressionContext =
                        ContextInternals.getEnvironmentContext(context).
                                getExpressionContext();

                try {
                    // Determine whether the when expression matches that in
                    // the containing select
                    expr = expressionContext.getFactory().
                            createExpressionParser().parse(attributes.getExpr())
                            .
                                    evaluate(expressionContext);

                    if (PipelineExpressionHelper.equals(
                            state.getExpression().getSequence(),
                            expr.getSequence())) {
                        // This when matches the select statement so its
                        // body should be processed
                        returnCode = PROCESS_ELEMENT_BODY;

                        // Ensure that the select state records the fact that
                        // a match has been performed
                        state.setMatched();
                    }
                } catch (ExpressionException e) {
                    throw new PAPIException(e);
                }
            } else {
                throw new PAPIException(
                        exceptionLocalizer.format("missing-expr-attribute"));
            }
        }

        return returnCode;
View Full Code Here

Examples of com.volantis.mcs.papi.PAPIException

            PAPIAttributes papiAttributes)
            throws PAPIException {
        IncludeAttributes attributes = (IncludeAttributes) papiAttributes;

        if (attributes.getHref() == null) {
            throw new PAPIException(
                    exceptionLocalizer.format("include-href-missing"));
        } else {
            // @todo this is a bit duff since it relies on markup naming not to change; do this a different way
            // Set up the markup that will be sent down the pipeline
            StringBuffer markup = new StringBuffer();
            InputSource inputSource;

            markup.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
            markup.append("<urid:fetch xmlns:urid=\"").
                    append(Namespace.URID.getURI()).append("\" href=\"").
                    append(attributes.getHref()).
                    append("\"");

            if (attributes.getParse() != null) {
                markup.append(" parse=\"").
                        append(attributes.getParse()).
                        append("\"");
            }

            if (attributes.getEncoding() != null) {
                markup.append(" encoding=\"").
                        append(attributes.getEncoding()).
                        append("\"");
            }

            markup.append("/>");

            if (logger.isDebugEnabled()) {
                logger.debug("Set up inclusion command as: " +
                        markup.toString());
            }

            inputSource = new InputSource(new StringReader(markup.toString()));

            // Set up and execute the pipeline to perform the required
            // inclusion
            MarinerPageContext pageContext =
                    ContextInternals.getMarinerPageContext(context);
            XMLReader reader = MarlinSAXHelper.getXMLReader(context);
            reader.setContentHandler(MarlinSAXHelper.
                    getContentHandler(context));
            // @todo this is nasty: we assume that the reader is actually an XMLPipelineFilter
            XMLPipelineFilter filter = (XMLPipelineFilter) reader;
            XMLPipelineContext pipelineContext = filter.getPipelineContext();

            // set the Base URI in the pipeline's context
            try {
                URL baseURI = pageContext.getAbsoluteURL(
                        pageContext.getRequestURL(false));

                if (logger.isDebugEnabled()) {
                    logger.debug("Setting Base URI " + baseURI);
                }

                pipelineContext.pushBaseURI(baseURI.toExternalForm());
            } catch (MalformedURLException e) {
                throw new PAPIException(e);
            }

            PipelineIntegrationUtilities.setUpIntegration(
                    filter,
                    pageContext.getCurrentElement(),
                    context,
                    pageContext.getCurrentOutputBuffer());

            if (logger.isDebugEnabled()) {
                logger.debug("Executing inclusion");
            }

            // Execute the inclusion
            try {
                reader.parse(inputSource);
            } catch (IOException e) {
                throw new PAPIException(e);
            } catch (SAXException e) {
                throw new PAPIException(e);
            } finally {
                PipelineIntegrationUtilities.tearDownIntegration(
                        filter);
            }
        }
View Full Code Here

Examples of com.volantis.mcs.papi.PAPIException

                String protocol = fakeUrl.getProtocol();
                if (protocol != null && !"".equals(protocol)) {
                    params.setParameterValue(ParameterNames.SOURCE_HOST, protocol);
                }
            } catch (MalformedURLException e) {
                throw new PAPIException(e);
            }
        }
    }
View Full Code Here

Examples of com.volantis.mcs.papi.PAPIException

                            URI uri = null;
                            try {
                                uri = new URI(url);
                            }catch(URISyntaxException e){
                                throw new PAPIException(e);
                            }

                            // Create MediaAgent request based on old-style transcoder URI.
                            Request request = pageContext.getMediaAgentRequestFactory()
                                .createRequestFromICSURI(uri);

                            setHostAndPort(request, uri, pageContext);

                            // Create MediaAgent response callback.
                            MAPResponseCallback callback = new MAPResponseCallbackXDIME1(
                                pattributes,
                                MAPResponseCallback.createURLRewriter(pageContext, PageURLType.IMAGE));

                            // Send MediaAgent request.
                            MediaAgent mediaAgent = pageContext.getMediaAgent(true);
                            mediaAgent.requestURL(request, callback);
                        }   
                    }
                }
            } else if (urlc != null) {
                url = ContextInternals.constructImageURL(context, urlc);

                // processes and removes any aspect ratio parameter.
                url = processAspectRatioParameter(url,
                        pageContext.getVolantisBean().getAssetTranscoder());

                createFakeAssetURLMapEntry(context, url);
            } else {
                createFakeAssetURLMapEntry(context, url);
            }

            pattributes.setSrc(url);

            protocol.writeImage(pattributes);
        } catch (RepositoryException re) {
            throw new PAPIException(re);
        } catch (ProtocolException e) {

            logger.error("rendering-error",
                    new Object[]{pattributes.getTagName()}, e);
            throw new PAPIException(
                    exceptionLocalizer.format("rendering-error",
                            pattributes.getTagName()),
                    e);
        }
View Full Code Here

Examples of com.volantis.mcs.papi.PAPIException

    void writeOpenMarkup(VolantisProtocol protocol) throws PAPIException {
        try {
            protocol.writeOpenSpan(pattributes);
        } catch (ProtocolException e) {
            logger.error("open-span-error", e);
            throw new PAPIException(
                    exceptionLocalizer.format("open-span-error"), e);
        }
    }
View Full Code Here

Examples of com.volantis.mcs.papi.PAPIException

        // Setup the fragmentation state for the form
        try {
            pageContext.updateFormFragmentationState(form);
        }
        catch (LayoutException le) {
            throw new PAPIException(exceptionLocalizer.format(
                    "form-fragmentation-update-failure"));
        }

        // Initialise form event attributes.
        PAPIInternals.initialiseFormEventAttributes(pageContext, attributes,
View Full Code Here

Examples of com.volantis.mcs.papi.PAPIException

        try {
            protocol.doForm(pattributes);
        } catch (ProtocolException e) {
            logger.error("rendering-error", pattributes.getTagName(), e);
            throw new PAPIException(
                    exceptionLocalizer.format("rendering-error",
                            pattributes.getTagName()),
                    e);
        }
View Full Code Here

Examples of com.volantis.mcs.papi.PAPIException

        // Do the rest of the field processing.
        try {
            doField(pageContext, attributes, pattributes);
        } catch (ProtocolException e) {
            logger.error("rendering-error", pattributes.getTagName(), e);
            throw new PAPIException(
                    exceptionLocalizer.format("rendering-error",
                            pattributes.getTagName()),
                    e);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.