All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mockrunner.mock.web.MockJspFactory Maven / Gradle / Ivy

There is a newer version: 2.0.7
Show newest version
package com.mockrunner.mock.web;

import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.jsp.JspApplicationContext;
import javax.servlet.jsp.JspEngineInfo;
import javax.servlet.jsp.JspFactory;
import javax.servlet.jsp.PageContext;

/**
 * Mock implementation of JspFactory.
 * This implementation returns null
 * for {@link #getJspApplicationContext}. For full
 * support of JspApplicationContext use
 * {@link JasperJspFactory}.
 */
public class MockJspFactory extends JspFactory
{
    private JspEngineInfo engineInfo;
    private JspApplicationContext applicationContext;
    private PageContext pageContext;

    public MockJspFactory()
    {
        engineInfo = new MockJspEngineInfo();
    }
    
    /**
     * Set the JspEngineInfo. Per default, 
     * {@link MockJspEngineInfo} is used.
     * @param engineInfo the JspEngineInfo
     */
    public void setEngineInfo(JspEngineInfo engineInfo)
    {
        this.engineInfo = engineInfo;
    }

    /**
     * Set the JspApplicationContext.
     * @param applicationContext the JspApplicationContext
     */
    public void setJspApplicationContext(JspApplicationContext applicationContext)
    {
        this.applicationContext = applicationContext;
    }

    /**
     * Set the PageContext.
     * @param pageContext the PageContext
     */
    public void setPageContext(PageContext pageContext)
    {
        this.pageContext = pageContext;
    }

    /**
     * Returns the PageContext.
     * @return the PageContext
     */
    public PageContext getPageContext()
    {
        return pageContext;
    }

    public JspEngineInfo getEngineInfo()
    {
        return engineInfo;
    }

    public JspApplicationContext getJspApplicationContext(ServletContext context)
    {
        return applicationContext;
    }

    public PageContext getPageContext(Servlet servlet, ServletRequest request, ServletResponse response, String errorPageURL, boolean needsSession, int buffer, boolean autoflush)
    {
        return pageContext;
    }

    public void releasePageContext(PageContext pageContext)
    {

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy