Package javax.servlet.jsp

Examples of javax.servlet.jsp.PageContext


  public static Map createPageScopeMap (PageContext pContext)

  {

    final PageContext context = pContext;

    return new EnumeratedMap ()

      {

  public Enumeration enumerateKeys ()

  {

    return context.getAttributeNamesInScope

      (PageContext.PAGE_SCOPE);

  }



  public Object getValue (Object pKey)

  {

    if (pKey instanceof String) {

      return context.getAttribute

        ((String) pKey,

         PageContext.PAGE_SCOPE);
View Full Code Here


  public static Map createRequestScopeMap (PageContext pContext)

  {

    final PageContext context = pContext;

    return new EnumeratedMap ()

      {

  public Enumeration enumerateKeys ()

  {

    return context.getAttributeNamesInScope

      (PageContext.REQUEST_SCOPE);

  }



  public Object getValue (Object pKey)

  {

    if (pKey instanceof String) {

      return context.getAttribute

        ((String) pKey,

         PageContext.REQUEST_SCOPE);
View Full Code Here

  public static Map createSessionScopeMap (PageContext pContext)

  {

    final PageContext context = pContext;

    return new EnumeratedMap ()

      {

  public Enumeration enumerateKeys ()

  {

    return context.getAttributeNamesInScope

      (PageContext.SESSION_SCOPE);

  }



  public Object getValue (Object pKey)

  {

    if (pKey instanceof String) {

      return context.getAttribute

        ((String) pKey,

         PageContext.SESSION_SCOPE);
View Full Code Here

  public static Map createApplicationScopeMap (PageContext pContext)

  {

    final PageContext context = pContext;

    return new EnumeratedMap ()

      {

  public Enumeration enumerateKeys ()

  {

    return context.getAttributeNamesInScope

      (PageContext.APPLICATION_SCOPE);

  }



  public Object getValue (Object pKey)

  {

    if (pKey instanceof String) {

      return context.getAttribute

        ((String) pKey,

         PageContext.APPLICATION_SCOPE);
View Full Code Here

   **/
  public Object resolveVariable (String pName,
         Object pContext)
    throws ELException
  {
    PageContext ctx = (PageContext) pContext;

    // Check for implicit objects
    if ("pageContext".equals (pName)) {
      return ctx;
    }
    else if ("pageScope".equals (pName)) {
      return ImplicitObjects.
  getImplicitObjects (ctx).
  getPageScopeMap ();
    }
    else if ("requestScope".equals (pName)) {
      return ImplicitObjects.
  getImplicitObjects (ctx).
  getRequestScopeMap ();
    }
    else if ("sessionScope".equals (pName)) {
      return ImplicitObjects.
  getImplicitObjects (ctx).
  getSessionScopeMap ();
    }
    else if ("applicationScope".equals (pName)) {
      return ImplicitObjects.
  getImplicitObjects (ctx).
  getApplicationScopeMap ();
    }
    else if ("param".equals (pName)) {
      return ImplicitObjects.
  getImplicitObjects (ctx).
  getParamMap ();
    }
    else if ("paramValues".equals (pName)) {
      return ImplicitObjects.
  getImplicitObjects (ctx).
  getParamsMap ();
    }
    else if ("header".equals (pName)) {
      return ImplicitObjects.
  getImplicitObjects (ctx).
  getHeaderMap ();
    }
    else if ("headerValues".equals (pName)) {
      return ImplicitObjects.
  getImplicitObjects (ctx).
  getHeadersMap ();
    }
    else if ("initParam".equals (pName)) {
      return ImplicitObjects.
  getImplicitObjects (ctx).
  getInitParamMap ();
    }
    else if ("cookie".equals (pName)) {
      return ImplicitObjects.
  getImplicitObjects (ctx).
  getCookieMap ();
    }

    // Otherwise, just look it up in the page context
    else {
      return ctx.findAttribute (pName);
    }
  }
View Full Code Here

      builder.append('\n');
    }
  }

    private String getContextPath() {
        PageContext context = (PageContext) getJspContext();
        return ((HttpServletRequest) context.getRequest()).getContextPath();
    }
View Full Code Here

        return wroConfig.getWroTagLibConfig().getLessPath();
    }

    private String getContextPath() {
        PageContext context = (PageContext) getJspContext();
        return ((HttpServletRequest) context.getRequest()).getContextPath();
    }
View Full Code Here

              String errorPageURL,
                                      boolean needsSession, int bufferSize,
                                      boolean autoflush)
    {
        try {
      PageContext pc;
      if( usePool ) {
    pc=(PageContext)pool.get();
    if( pc == null ) pc= new PageContextImpl(this);
      } else {
    pc =  new PageContextImpl(this);
      }

      //      System.out.println("JspFactoryImpl.getPC"  + pc);
      pc.initialize(servlet, request, response, errorPageURL,
                          needsSession, bufferSize, autoflush);
     
            return pc;
        } catch (Throwable ex) {
            /* FIXME: need to do something reasonable here!! */
 
View Full Code Here

    if (prop == null)
      return null;

    context.setPropertyResolved(true);

    PageContext jspContext = (PageContext) context.getContext(JspContext.class);

    switch (prop) {
    case PAGE_CONTEXT:
      return jspContext;
     
    case PAGE_SCOPE:
      {
        HashMap<String,Object> map = new HashMap<String,Object>();

        Enumeration e = jspContext.getAttributeNamesInScope(PageContext.PAGE_SCOPE);
        while (e.hasMoreElements()) {
          String name = (String) e.nextElement();

          map.put(name, jspContext.getAttribute(name));
        }

        return map;
      }
     
    case REQUEST_SCOPE:
      {
        HashMap<String,Object> map = new HashMap<String,Object>();

        ServletRequest request = jspContext.getRequest();

        Enumeration e = request.getAttributeNames();
        while (e.hasMoreElements()) {
          String name = (String) e.nextElement();

          map.put(name, request.getAttribute(name));
        }

        return map;
      }
     
    case SESSION_SCOPE:
      {
        HashMap<String,Object> map = new HashMap<String,Object>();

        HttpSession session = jspContext.getSession();

        if (session == null)
          return null;

        Enumeration e = session.getAttributeNames();
        while (e.hasMoreElements()) {
          String name = (String) e.nextElement();

          map.put(name, session.getAttribute(name));
        }

        return map;
      }
     
    case APPLICATION_SCOPE:
      {
        HashMap<String,Object> map = new HashMap<String,Object>();

        ServletContext app = jspContext.getServletContext();

        Enumeration e = app.getAttributeNames();
        while (e.hasMoreElements()) {
          String name = (String) e.nextElement();

          map.put(name, app.getAttribute(name));
        }

        return map;
      }
     
    case PARAM:
      {
        HashMap<String,Object> map = new HashMap<String,Object>();

        ServletRequest request = jspContext.getRequest();

        Enumeration e = request.getParameterNames();
        while (e.hasMoreElements()) {
          String name = (String) e.nextElement();

          map.put(name, request.getParameter(name));
        }

        return map;
      }
     
    case PARAM_VALUES:
      {
        HashMap<String,Object> map = new HashMap<String,Object>();

        ServletRequest request = jspContext.getRequest();

        Enumeration e = request.getParameterNames();
        while (e.hasMoreElements()) {
          String name = (String) e.nextElement();

          map.put(name, request.getParameterValues(name));
        }

        return map;
      }
     
    case HEADER:
      {
        HashMap<String,Object> map = new HashMap<String,Object>();

        HttpServletRequest request = (HttpServletRequest) jspContext.getRequest();

        Enumeration e = request.getHeaderNames();
        while (e.hasMoreElements()) {
          String name = (String) e.nextElement();

          map.put(name, request.getHeader(name));
        }

        return map;
      }
     
    case HEADER_VALUES:
      {
        HashMap<String,Object> map = new HashMap<String,Object>();

        HttpServletRequest request = (HttpServletRequest) jspContext.getRequest();

        Enumeration e = request.getHeaderNames();
        while (e.hasMoreElements()) {
          String name = (String) e.nextElement();

          map.put(name, request.getHeaders(name));
        }

        return map;
      }
     
    case COOKIE:
      {
        HashMap<String,Object> map = new HashMap<String,Object>();

        HttpServletRequest request
          = (HttpServletRequest) jspContext.getRequest();

        Cookie []cookies = request.getCookies();

        if (cookies == null)
          return map;

        for (int i = cookies.length - 1; i >= 0; i--) {
          map.put(cookies[i].getName(), cookies[i].getValue());
        }

        return map;
      }
   
    case INIT_PARAM:
      {
        HashMap<String,Object> map = new HashMap<String,Object>();

        ServletContext app = jspContext.getServletContext();

        Enumeration e = app.getInitParameterNames();
        while (e.hasMoreElements()) {
          String name = (String) e.nextElement();
View Full Code Here

    getFeatureDescriptors(ELContext context, Object base)
  {
    if (base != null)
      return null;

    PageContext pageContext
      = (PageContext) context.getContext(JspContext.class);

    context.setPropertyResolved(true);

    ArrayList<FeatureDescriptor> keys = new ArrayList<FeatureDescriptor>();

    Enumeration e = pageContext.getAttributeNamesInScope(PageContext.PAGE_SCOPE);
    while (e.hasMoreElements()) {
      Object key = e.nextElement();
      String name = (String) key;

      FeatureDescriptor desc = new FeatureDescriptor();
View Full Code Here

TOP

Related Classes of javax.servlet.jsp.PageContext

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.