
cat.inspiracio.servlet.jsp.PageContextFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dummy-servlet Show documentation
Show all versions of dummy-servlet Show documentation
Dummy Servlet provides some implementations for the interfaces and classes
of the Java Servlet spec that are useful for testing and simulation.
Version 5.0.0 is for Servlet 5.0.0.
The newest version!
package cat.inspiracio.servlet.jsp;
import jakarta.servlet.jsp.PageContext;
/** Easy access to page context within the same thread. */
public class PageContextFactory {
private static final ThreadLocal threadLocal = new ThreadLocal();
/** Sets factory for this request thread.
* Call this somewhere are the start of a request.
* @param pc factory for this thread.
* */
public static void setPageContext(PageContext pc){
threadLocal.set(pc);
}
/** Can call this anywhere during the thread.
* @return factory for this thread */
public static PageContext getPageContext(){
return threadLocal.get();
}
/** Forbids instantiation. */
private PageContextFactory(){}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy