/** * Creates the {@link com.mockrunner.mock.web.MockPageContext} using <code>new</code>. * This method can be overridden to return a subclass of {@link com.mockrunner.mock.web.MockPageContext}. * @return the {@link com.mockrunner.mock.web.MockPageContext} */ public MockPageContext createMockPageContext() { return new MockPageContext(); }
public Object getAttribute(String name) { return getAttribute(name, PageContext.PAGE_SCOPE); }
public void removeAttribute(String name) { int scope = getAttributesScope(name); if (scope != 0) { removeAttribute(name, scope); } }
public Object getAttribute(String name, int scope) { if(scope == PageContext.PAGE_SCOPE) { return attributes.get(name); } else if(scope == PageContext.REQUEST_SCOPE) { if(null == request) return null; return request.getAttribute(name); } else if(scope == PageContext.SESSION_SCOPE) { if(null == getSession()) return null; return getSession().getAttribute(name); } else if(scope == PageContext.APPLICATION_SCOPE) { if(null == getServletContext()) return null; return getServletContext().getAttribute(name); } else { throw new IllegalArgumentException("Invalid scope " + scope); } }
private void setUpDependencies() { config.setServletContext(context); request.setSession(session); session.setupServletContext(context); pageContext = createMockPageContext(); pageContext.setServletConfig(config); pageContext.setServletRequest(request); pageContext.setServletResponse(response); filterConfig.setupServletContext(context); setUpJspFactory(); }
/** * Gets the output data the current tag has rendered. Makes only sense * after calling at least {@link #doStartTag} or {@link #processTagLifecycle} * @return the output data */ public String getOutput() { MockJspWriter writer = (MockJspWriter)mockFactory.getMockPageContext().getOut(); return writer.getOutputAsString(); }
public void include(String path, boolean flush) throws ServletException, IOException { if(flush) { jspWriter.flush(); } include(path); }
public void setAttribute(String name, Object value) { setAttribute(name, value, PageContext.PAGE_SCOPE); }
public Object getAttribute(String name, int scope) { if(scope == PageContext.PAGE_SCOPE) { return attributes.get(name); } else if(scope == PageContext.REQUEST_SCOPE) { if(null == request) return null; return request.getAttribute(name); } else if(scope == PageContext.SESSION_SCOPE) { if(null == getSession()) return null; return getSession().getAttribute(name); } else if(scope == PageContext.APPLICATION_SCOPE) { if(null == getServletContext()) return null; return getServletContext().getAttribute(name); } else { throw new IllegalArgumentException("Invalid scope " + scope); } }
private void setUpDependencies() { config.setServletContext(context); request.setSession(session); session.setupServletContext(context); pageContext = createMockPageContext(); pageContext.setServletConfig(config); pageContext.setServletRequest(request); pageContext.setServletResponse(response); filterConfig.setupServletContext(context); setUpJspFactory(); }
/** * Gets the output data the current tag has rendered. Makes only sense * after calling at least {@link #doStartTag} or {@link #processTagLifecycle} * @return the output data */ public String getOutput() { MockJspWriter writer = (MockJspWriter)mockFactory.getMockPageContext().getOut(); return writer.getOutputAsString(); }
public void include(String path, boolean flush) throws ServletException, IOException { if(flush) { jspWriter.flush(); } include(path); }
public void setAttribute(String name, Object value) { setAttribute(name, value, PageContext.PAGE_SCOPE); }
public Object getAttribute(String name, int scope) { if(scope == PageContext.PAGE_SCOPE) { return attributes.get(name); } else if(scope == PageContext.REQUEST_SCOPE) { if(null == request) return null; return request.getAttribute(name); } else if(scope == PageContext.SESSION_SCOPE) { if(null == getSession()) return null; return getSession().getAttribute(name); } else if(scope == PageContext.APPLICATION_SCOPE) { if(null == getServletContext()) return null; return getServletContext().getAttribute(name); } else { throw new IllegalArgumentException("Invalid scope " + scope); } }
private void setUpDependencies() { config.setServletContext(context); request.setSession(session); session.setupServletContext(context); pageContext = createMockPageContext(); pageContext.setServletConfig(config); pageContext.setServletRequest(request); pageContext.setServletResponse(response); filterConfig.setupServletContext(context); setUpJspFactory(); }
public void removeAttribute(String name) { int scope = getAttributesScope(name); if (scope != 0) { removeAttribute(name, scope); } }
public Object getAttribute(String name) { return getAttribute(name, PageContext.PAGE_SCOPE); }
/** * Creates the {@link com.mockrunner.mock.web.MockPageContext} using <code>new</code>. * This method can be overridden to return a subclass of {@link com.mockrunner.mock.web.MockPageContext}. * @return the {@link com.mockrunner.mock.web.MockPageContext} */ public MockPageContext createMockPageContext() { return new MockPageContext(); }
/** * Gets the output data the current tag has rendered. Makes only sense * after calling at least {@link #doStartTag} or {@link #processTagLifecycle} * @return the output data */ public String getOutput() { MockJspWriter writer = (MockJspWriter)mockFactory.getMockPageContext().getOut(); return writer.getOutputAsString(); }
public void include(String path, boolean flush) throws ServletException, IOException { if(flush) { jspWriter.flush(); } include(path); }