Examples of PageContext


Examples of javax.servlet.jsp.PageContext

    /**
     * Creates the Map that "wraps" application-scoped attributes
     */
    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);
                } else {
                    return null;
                }
View Full Code Here

Examples of javax.servlet.jsp.PageContext

     * Returns null if the variable is not found.
     */
    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

Examples of javax.servlet.jsp.PageContext

  // Logger
  private static Logger logger = LoggerFactory.getLogger(JstlMessageResolver.class);

  public String getResource(String messageKey, String defaultValue, Object... params) {

    PageContext pageContext = (PageContext) params[0];
    String message = null;
    ResourceBundle bundle = null;

    LocalizationContext localizationContext = BundleSupport.getLocalizationContext(pageContext);
View Full Code Here

Examples of javax.servlet.jsp.PageContext

   */
  @Override
  public String getResource(String messageKey, String defaultValue, Object... params) {

    String message = null;
    PageContext pageContext = null;

    // I'm still so ashamed about that...
    pageContext = (PageContext) params[0];

    // Both title and titleKey attributes are not used
    if (messageKey == null || StringUtils.isBlank(messageKey) && StringUtils.isNotBlank(defaultValue)) {
      message = StringUtils.capitalize(defaultValue);
    }
    // The titleKey attribute is used
    else {
      MessageResources resources = (MessageResources) pageContext.getAttribute(Globals.MESSAGES_KEY,
          PageContext.REQUEST_SCOPE);

      if (resources == null) {
        ModuleConfig moduleConfig = (ModuleConfig) pageContext.getRequest().getAttribute(Globals.MODULE_KEY);

        if (moduleConfig == null) {
          moduleConfig = (ModuleConfig) pageContext.getServletContext().getAttribute(Globals.MODULE_KEY);
          pageContext.getRequest().setAttribute(Globals.MODULE_KEY, moduleConfig);
        }

        resources = (MessageResources) pageContext.getAttribute(
            Globals.MESSAGES_KEY + moduleConfig.getPrefix(), PageContext.APPLICATION_SCOPE);
      }

      if (resources == null) {
        resources = (MessageResources) pageContext.getAttribute(Globals.MESSAGES_KEY,
            PageContext.APPLICATION_SCOPE);
      }

      if (resources != null) {
        message = resources.getMessage(messageKey);
View Full Code Here

Examples of javax.servlet.jsp.PageContext

   */
  @Override
  public String getResource(String messageKey, String defaultValue, Object... params) {

    String message = null;
    PageContext pageContext = null;

    // I'm so ashamed about that...
    pageContext = (PageContext) params[0];

    // Both title and titleKey attributes are not used
View Full Code Here

Examples of javax.servlet.jsp.PageContext

    private PageContext internalGetPageContext(Servlet servlet, ServletRequest request,
            ServletResponse response, String errorPageURL, boolean needsSession,
            int bufferSize, boolean autoflush) {
        try {
            PageContext pc = new PageContextImpl();
            pc.initialize(servlet, request, response, errorPageURL,
                    needsSession, bufferSize, autoflush);
            return pc;
        } catch (Throwable ex) {
            /* FIXME: need to do something reasonable here!! */
            log.fatal("Exception initializing page context", ex);
View Full Code Here

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

Examples of javax.servlet.jsp.PageContext

  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

Examples of javax.servlet.jsp.PageContext

  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

Examples of javax.servlet.jsp.PageContext

  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
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.