Skip to content

Package: JspFactory

JspFactory

nameinstructionbranchcomplexitylinemethod
JspFactory()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getDefaultFactory()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setDefaultFactory(JspFactory)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 1997, 2020 Oracle and/or its affiliates and others.
3: * All rights reserved.
4: * Copyright 2004 The Apache Software Foundation
5: *
6: * Licensed under the Apache License, Version 2.0 (the "License");
7: * you may not use this file except in compliance with the License.
8: * You may obtain a copy of the License at
9: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: package jakarta.servlet.jsp;
20:
21: import jakarta.servlet.Servlet;
22: import jakarta.servlet.ServletRequest;
23: import jakarta.servlet.ServletResponse;
24: import jakarta.servlet.ServletContext;
25:
26: /**
27: * <p>
28: * The JspFactory is an abstract class that defines a number of factory methods available to a JSP page at runtime for
29: * the purposes of creating instances of various interfaces and classes used to support the JSP implementation.
30: * <p>
31: * A conformant JSP Engine implementation will, during it's initialization instantiate an implementation dependent
32: * subclass of this class, and make it globally available for use by JSP implementation classes by registering the
33: * instance created with this class via the static <code> setDefaultFactory() </code> method.
34: * <p>
35: * The only implementation-dependent classes that can be created from the factory are: PageContext, JspEngineInfo, and
36: * JspApplicationContext.
37: * <p>
38: * With the exception of JspApplicationContext, JspFactory objects should not be used by JSP application developers.
39: */
40: public abstract class JspFactory {
41:
42: private static volatile JspFactory deflt = null;
43:
44: /**
45: * Sole constructor. (For invocation by subclass constructors, typically implicit.)
46: */
47: public JspFactory() {
48: }
49:
50: /**
51: * <p>
52: * set the default factory for this implementation. It is illegal for any principal other than the JSP Engine
53: * runtime to call this method.
54: * </p>
55: *
56: * @param deflt The default factory implementation
57: */
58: public static void setDefaultFactory(JspFactory deflt) {
59: JspFactory.deflt = deflt;
60: }
61:
62: /**
63: * Returns the default factory for this implementation.
64: *
65: * @return the default factory for this implementation
66: */
67: public static JspFactory getDefaultFactory() {
68: return deflt;
69: }
70:
71: /**
72: * <p>
73: * obtains an instance of an implementation dependent jakarta.servlet.jsp.PageContext abstract class for the calling
74: * Servlet and currently pending request and response.
75: * </p>
76: *
77: * <p>
78: * This method is typically called early in the processing of the _jspService() method of a JSP implementation class
79: * in order to obtain a PageContext object for the request being processed.
80: * </p>
81: * <p>
82: * Invoking this method shall result in the PageContext.initialize() method being invoked. The PageContext returned
83: * is properly initialized.
84: * </p>
85: * <p>
86: * All PageContext objects obtained via this method shall be released by invoking releasePageContext().
87: * </p>
88: *
89: * @param servlet the requesting servlet
90: * @param request the current request pending on the servlet
91: * @param response the current response pending on the servlet
92: * @param errorPageURL the URL of the error page for the requesting JSP, or null
93: * @param needsSession true if the JSP participates in a session
94: * @param buffer size of buffer in bytes, JspWriter.NO_BUFFER if no buffer, JspWriter.DEFAULT_BUFFER if
95: * implementation default.
96: * @param autoflush should the buffer autoflush to the output stream on buffer overflow, or throw an IOException?
97: *
98: * @return the page context
99: *
100: * @see jakarta.servlet.jsp.PageContext
101: */
102: public abstract PageContext getPageContext(Servlet servlet, ServletRequest request, ServletResponse response,
103: String errorPageURL, boolean needsSession, int buffer, boolean autoflush);
104:
105: /**
106: * <p>
107: * called to release a previously allocated PageContext object. Results in PageContext.release() being invoked. This
108: * method should be invoked prior to returning from the _jspService() method of a JSP implementation class.
109: * </p>
110: *
111: * @param pc A PageContext previously obtained by getPageContext()
112: */
113: public abstract void releasePageContext(PageContext pc);
114:
115: /**
116: * <p>
117: * called to get implementation-specific information on the current JSP engine.
118: * </p>
119: *
120: * @return a JspEngineInfo object describing the current JSP engine
121: */
122: public abstract JspEngineInfo getEngineInfo();
123:
124: /**
125: * Obtains the <code>JspApplicationContext</code> instance associated with the web application for the given
126: * <code>ServletContext</code>.
127: *
128: * @param context The <code>ServletContext</code> for the web application the desired
129: * <code>JspApplicationContext</code> is associated with.
130: * @return The <code>JspApplicationContext</code> associated with the web application.
131: * @since 2.1
132: */
133: public abstract JspApplicationContext getJspApplicationContext(ServletContext context);
134: }