MCPcopy Index your code
hub / github.com/apache/tomcat / init

Method init

java/org/apache/catalina/servlets/CGIServlet.java:303–396  ·  view source on GitHub ↗

Sets instance variables. @param config a ServletConfig object containing the servlet's configuration and initialization parameters @exception ServletException if an exception has occurred that interferes with the servlet's normal operation

(ServletConfig config)

Source from the content-addressed store, hash-verified

301 * @exception ServletException if an exception has occurred that interferes with the servlet's normal operation
302 */
303 @Override
304 public void init(ServletConfig config) throws ServletException {
305
306 super.init(config);
307
308 // Set our properties from the initialization parameters
309 cgiPathPrefix = getServletConfig().getInitParameter("cgiPathPrefix");
310 boolean passShellEnvironment =
311 Boolean.parseBoolean(getServletConfig().getInitParameter("passShellEnvironment"));
312
313 if (passShellEnvironment) {
314 shellEnv.putAll(System.getenv());
315 }
316
317 Enumeration<String> e = config.getInitParameterNames();
318 while (e.hasMoreElements()) {
319 String initParamName = e.nextElement();
320 if (initParamName.startsWith("environment-variable-")) {
321 if (initParamName.length() == 21) {
322 throw new ServletException(sm.getString("cgiServlet.emptyEnvVarName"));
323 }
324 shellEnv.put(initParamName.substring(21), config.getInitParameter(initParamName));
325 }
326 }
327
328 if (getServletConfig().getInitParameter("executable") != null) {
329 cgiExecutable = getServletConfig().getInitParameter("executable");
330 }
331
332 if (getServletConfig().getInitParameter("executable-arg-1") != null) {
333 List<String> args = new ArrayList<>();
334 for (int i = 1;; i++) {
335 String arg = getServletConfig().getInitParameter("executable-arg-" + i);
336 if (arg == null) {
337 break;
338 }
339 args.add(arg);
340 }
341 cgiExecutableArgs = args;
342 }
343
344 if (getServletConfig().getInitParameter("parameterEncoding") != null) {
345 parameterEncoding = getServletConfig().getInitParameter("parameterEncoding");
346 }
347
348 if (getServletConfig().getInitParameter("stderrTimeout") != null) {
349 stderrTimeout = Long.parseLong(getServletConfig().getInitParameter("stderrTimeout"));
350 }
351
352 if (getServletConfig().getInitParameter("envHttpHeaders") != null) {
353 envHttpHeadersPattern = Pattern.compile(getServletConfig().getInitParameter("envHttpHeaders"));
354 }
355
356 if (getServletConfig().getInitParameter("enableCmdLineArguments") != null) {
357 enableCmdLineArguments = Boolean.parseBoolean(config.getInitParameter("enableCmdLineArguments"));
358 }
359
360 if (getServletConfig().getInitParameter("cgiMethods") != null) {

Callers

nothing calls this directly

Calls 15

parseBooleanMethod · 0.80
lengthMethod · 0.80
initMethod · 0.65
getInitParameterMethod · 0.65
getServletConfigMethod · 0.65
getInitParameterNamesMethod · 0.65
getStringMethod · 0.65
putMethod · 0.65
addMethod · 0.65
equalsMethod · 0.65
getAttributeMethod · 0.65
getServletContextMethod · 0.65

Tested by

no test coverage detected