Package org.apache.cocoon.environment

Examples of org.apache.cocoon.environment.Context


                    bean = session.getAttribute(name);
                }
            }
            if ((scope == null && bean == null)
                || SCOPE_CONTEXT.equals(scope)) {
                final Context context =
                    ObjectModelHelper.getContext(objectModel);
                if (context != null) {
                    bean = context.getAttribute(name);
                }
            }
            if ((scope == null && bean == null)
                || SCOPE_SITEMAP.equals(scope)) {
                bean = objectModel.get(name);
View Full Code Here


    }

    public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters param)
    throws Exception {
        Request request = ObjectModelHelper.getRequest(objectModel);
        Context context = ObjectModelHelper.getContext(objectModel);
        if (context != null) {
            context.setAttribute("Wale",new  TestBean("Wale in the big sea", "context"));
        }

        Session session =request.getSession(true);
        session.setAttribute("Mouse",new  TestBean("Liveing in the session","session"));
        objectModel.put("Lion", new TestBean("Lion:walking on the sitemap","sitemap") );
View Full Code Here

        if (session != null) {
            o = session.getAttribute(name);
            if (o != null)
                return o;
        }
        Context context = ObjectModelHelper.getContext(objectModel);
        return context.getAttribute(name);
    }
View Full Code Here

*
* @version $Id: ResetCounterAction.java 433543 2006-08-22 06:22:54Z crossley $
*/
public class ResetCounterAction implements Action {
  public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception {
    Context context = ObjectModelHelper.getContext(objectModel);
    Integer count = new Integer(0);
    context.setAttribute("count", count);
    return new HashMap();
  }
View Full Code Here

  }

  public void generate() throws IOException, SAXException, ProcessingException {
    consumer.startDocument();
    consumer.startElement("", "context", "context", new AttributesImpl());
    Context context = ObjectModelHelper.getContext(objectModel);
    Enumeration keys = context.getAttributeNames();
    while (keys.hasMoreElements()) {
      String key = (String) keys.nextElement();
      Object value = context.getAttribute(key);
      AttributesImpl attrs = new AttributesImpl();
      attrs.addAttribute("", "name", "name", "CDATA", key);
      consumer.startElement("", "key", "key", attrs);
      String str = value.toString();
      consumer.characters(str.toCharArray(), 0, str.length());
View Full Code Here

    /**
     * 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

        this.manager = manager;
    }

    public void contextualize(org.apache.avalon.framework.context.Context context)
      throws ContextException {
        Context ctx = ((Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT));
        this.contextpath = ctx.getRealPath("/");
        this.workdir = context.get(Constants.CONTEXT_WORK_DIR).toString();
    }
View Full Code Here

        if (session != null) {
            o = session.getAttribute(name);
            if (o != null)
                return o;
        }
        Context context = ObjectModelHelper.getContext(objectModel);
        return context.getAttribute(name);
    }
View Full Code Here

        }
        else {
            publicationId = webappUri;
        }
       
        Context context = ObjectModelHelper.getContext(objectModel);
        String servletContextPath = context.getRealPath("");
        return new Publication(publicationId, servletContextPath);
    }
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.