View Javadoc

1   /**
2    * 
3    */
4   package com.atlassian.plugin.descriptors.servlet;
5   
6   import java.util.Collections;
7   import java.util.Enumeration;
8   
9   import javax.servlet.ServletConfig;
10  import javax.servlet.ServletContext;
11  
12  public final class PluginServletConfig implements ServletConfig
13  {
14      private final ServletModuleDescriptor descriptor;
15      private final ServletContext context;
16  
17      public PluginServletConfig(ServletModuleDescriptor descriptor, ServletConfig servletConfig)
18      {
19          this.descriptor = descriptor;
20          context = new PluginServletContextWrapper(descriptor, servletConfig.getServletContext());
21      }
22  
23      public String getServletName()
24      {
25          return descriptor.getName();
26      }
27  
28      public ServletContext getServletContext()
29      {
30          return context;
31      }
32  
33      public String getInitParameter(String s)
34      {
35          return (String) descriptor.getInitParams().get(s);
36      }
37  
38      public Enumeration getInitParameterNames()
39      {
40          return Collections.enumeration(descriptor.getInitParams().keySet());
41      }
42  }