Examples of PageContext


Examples of com.atlassian.confluence.renderer.PageContext

        when(pageManager.getPage(anyInt())).thenReturn(this.page);

        this.contentPropertyManager = new DefaultContentPropertyManager();
         
     
        PageContext pageContext = mock(PageContext.class);
        when(pageContext.getSpaceKey()).thenReturn("FOO");
       
        conversionContext = new DefaultConversionContext(pageContext);
    when(conversionContext.getEntity()).thenReturn(page);
   
    }
View Full Code Here

Examples of com.esri.gpt.framework.jsf.PageContext

@Override
public void encodeBegin(FacesContext context) throws IOException {
  super.encodeBegin(context);

  try {
    PageContext pageContext = PageContext.extract();
   
    if (pageContext!=null && pageContext.getPrepareView().length()>0) {
      // infoke action listener
      MethodBinding binding = context.getApplication().createMethodBinding(
        pageContext.getPrepareView(), null);
      binding.invoke(context, null);
    }
   
  } catch (Throwable t) {
    MessageBroker messageBroker =
View Full Code Here

Examples of example.generics.persist.api.PageContext

    }

    @Test
    public void findAll(){

        PageContext pageContext = new PageImpl(0,1);
        List<Episode> results = getModelDao().findAll(pageContext);
        assertTrue(results.size() == 1);

        pageContext = new PageImpl(1,1);
        results = getModelDao().findAll(pageContext);
View Full Code Here

Examples of javax.servlet.jsp.PageContext

    }

    protected void doRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        // save the old PageContext
        PageContext oldPageContext = ServletActionContext.getPageContext();

        // create a new PageContext
        JspFactory jspFactory = JspFactory.getDefaultFactory();

        PageContext pageContext = jspFactory.getPageContext(this, request, response, null, true, 8192, true);

        // put the new PageContext into ActionContext
        ActionContext actionContext = ActionContext.getContext();

        actionContext.put(ServletActionContext.PAGE_CONTEXT, pageContext);

        /*
         * Must put the stack into HttpServletRequest, because the WebWork JSP
         * Taglib will use it to judge whether there are some errors in stack.
         */
        OgnlValueStack stack = ActionContext.getContext().getValueStack();

        //request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY,
        // stack);
        //Moved to WebWorkPortlet doService()

        VelocityManager velocityManager = VelocityManager.getInstance();
        Context resultContext = velocityManager.createContext(stack, request, response);

        response.setContentType("text/html");

        try {
            String location = (String) ActionContext.getContext().get("template");
            Template template = velocityManager.getVelocityEngine().getTemplate(location);

            Writer writer = pageContext.getOut();
            template.merge(resultContext, writer);
            writer.flush();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
View Full Code Here

Examples of javax.servlet.jsp.PageContext

    JspFactory factory = JspFactory.getDefaultFactory();
    String errorPageURL = null;
    int bufferSize = (JspWriter.DEFAULT_BUFFER <= 0) ? 1024 : JspWriter.DEFAULT_BUFFER;
    boolean needsSession = false;
    boolean autoFlush = true;
    PageContext pageContext = null;
    try {
      req.setCharacterEncoding("UTF-8");
      pageContext = factory.getPageContext(this, req, resp,
        errorPageURL, needsSession, bufferSize, autoFlush);
   
      // Create a shared wrapper
      PageRequest request = new JspPageRequest(pageContext);
      PageResponse response = new JspPageResponse(pageContext);

      // Extract the file name
      String encoding = "utf-8"; // We use utf-8 in our JSPs
      String fileUrl = SearchToolkit.extractFileUrl(req.getRequestURI(), encoding);

      // Check the file
      try {
        if (SearchToolkit.allowFileAccess(request, fileUrl)) {
          // Access allowed -> Send the file
          SearchToolkit.sendFile(request, response, RegainToolkit.urlToFile(fileUrl));
        } else {
          // Access not allowed -> Send 403 Forbidden
          resp.sendError(403);
        }
      }
      catch (RegainException exc) {
        throw new ServletException("Checking file access failed: " + fileUrl, exc);
      }
    }
    catch (Exception exc) {
      pageContext.handlePageException(exc);
    } finally {
      factory.releasePageContext(pageContext);
    }
  }
View Full Code Here

Examples of javax.servlet.jsp.PageContext

     * Returns a variable resolver that will resolve variables by searching through
     * the page scope, request scope, session scope and application scope for an
     * attribute with a matching name.
     */
    public VariableResolver getVariableResolver() {
        final PageContext ctx = this;

        return new VariableResolver() {
            public Object resolveVariable(String name) throws ELException {
                return ctx.findAttribute(name);
            }
        };
    }
View Full Code Here

Examples of javax.servlet.jsp.PageContext

     * Returns a variable resolver that will resolve variables by searching through
     * the page scope, request scope, session scope and application scope for an
     * attribute with a matching name.
     */
    public VariableResolver getVariableResolver() {
        final PageContext ctx = this;

        return new VariableResolver() {
            public Object resolveVariable(String name) throws ELException {
                return ctx.findAttribute(name);
            }
        };
    }
View Full Code Here

Examples of javax.servlet.jsp.PageContext

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

Examples of javax.servlet.jsp.PageContext

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

Examples of javax.servlet.jsp.PageContext

    /**
     * Creates the Map that "wraps" session-scoped attributes
     */
    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);
                } else {
                    return null;
                }
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.