Package org.apache.cocoon.environment

Examples of org.apache.cocoon.environment.Context


    /**
     * Returns the mime-type of the resource in process.
     */
    public String getMimeType() {
        Context ctx = ObjectModelHelper.getContext(objectModel);
        if (ctx != null) {
            final String mimeType = ctx.getMimeType(source);
            if (mimeType != null) {
                return mimeType;
            }
        }
        return inputSource.getMimeType();
View Full Code Here


        final Map objectModel = ContextHelper.getObjectModel(this.context);

        Request request = ObjectModelHelper.getRequest(objectModel);
        JXPathContext context = (JXPathContext) request.getAttribute(Constants.JXPATH_CONTEXT);
        if (context == null) {
            Context envContext = ObjectModelHelper.getContext(objectModel);
            JXPathContext parentContext = null;

            Session session = request.getSession(false);
            if (session != null) {
                parentContext = getSessionContext(session, envContext);
View Full Code Here

    /**
     * Returns the mime-type of the resource in process.
     */
    public String getMimeType () {
        Context ctx = (Context) objectModel.get(Constants.CONTEXT_OBJECT);

        if (ctx != null) {
           return ctx.getMimeType(this.source);
        } else {
           return null;
        }
    }
View Full Code Here

        throws IOException {
            File file = new File(filename);
            if (file.isAbsolute() && file.exists()) {
                return filename;
            }
            Context context = (Context) objectModel.get(Constants.CONTEXT_OBJECT);
            return NetUtils.getPath(context.getResource(filename).toExternalForm());
    }
View Full Code Here

        }
    }

    public static Object getContextAttribute(Map objectModel, String name)
    {
        Context context = (Context) objectModel.get(Constants.CONTEXT_OBJECT);
        return context.getAttribute(name);
    }
View Full Code Here

     * @param location The location
     * @return The URL pointed to by the location
     * @exception MalformedURLException If the location is malformed
     */
    public URL getURL(String location) throws MalformedURLException {
        Context envContext = null;
        try {
            envContext = (Context)this.context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
        } catch (ContextException e){
            getLogger().error("ContextException in getURL",e);
        }
        if (envContext == null) {
            getLogger().warn("no environment-context in application context (making an absolute URL)");
            return new URL(location);
        }
        URL u = envContext.getResource("/" + location);
        if (u != null)
            return u;
        else {
            getLogger().error(location + " could not be found. (possible context problem)");
            throw new RuntimeException(location + " could not be found. (possible context problem)");
View Full Code Here

        throws IOException {
            File file = new File(filename);
            if (file.isAbsolute() && file.exists()) {
                return filename;
            }
            Context context = ObjectModelHelper.getContext(objectModel);
            return NetUtils.getPath(context.getResource(filename).toExternalForm());
    }
View Full Code Here

        }
    }

    public static Object getContextAttribute(Map objectModel, String name)
    {
        Context context = ObjectModelHelper.getContext(objectModel);
        return context.getAttribute(name);
    }
View Full Code Here

     */
    public static Publication getPublication(Map objectModel) throws PublicationException {

        assert objectModel != null;
        Request request = ObjectModelHelper.getRequest(objectModel);
        Context context = ObjectModelHelper.getContext(objectModel);
        return getPublication(request, context);
    }
View Full Code Here

     * @return A publication.
     * @throws PublicationException when something went wrong.
     */
    public static Publication getPublicationFlow(FOM_Cocoon cocoon) throws PublicationException {
        Request request = cocoon.getRequest();
        Context context = cocoon.getContext();
        return getPublication(request, context);
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.environment.Context

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.