📄 httpservletconfig.java
字号:
package servlet.http;
import java.io.*;
import java.util.*;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
public class HttpServletConfig
implements ServletConfig
{
public HttpServletConfig(ServletContext servletcontext, Properties properties)
{
sc = servletcontext;
props = properties;
}
public HttpServletConfig(ServletContext servletcontext, String s)
{
props = new Properties();
sc = servletcontext;
if(s != null)
{
s = s.replace(',', '\n');
StringBufferInputStream stringbufferinputstream = new StringBufferInputStream(s);
DataInputStream datainputstream = new DataInputStream(stringbufferinputstream);
try
{
String s1;
while((s1 = datainputstream.readLine()) != null)
{
int i = s1.indexOf("=");
if(i != -1)
{
String s2 = s1.substring(0, i);
String s3 = s1.substring(i + 1, s1.length());
if(s2 != null && s3 != null)
props.put(s2.trim(), s3.trim());
}
}
return;
}
catch(IOException ioexception)
{
System.err.println("Cannot read initial arguments for servlet : ");
ioexception.printStackTrace(System.err);
return;
}
}
else
{
return;
}
}
public ServletContext getServletContext()
{
return sc;
}
public String getInitParameter(String s)
{
return props.getProperty(s);
}
public Enumeration getInitParameterNames()
{
return props.keys();
}
private ServletContext sc;
private Properties props;
public java.lang.String getServletName(){
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -