日期:2014-05-17 浏览次数:20745 次
public class Utils{
public static InputStream getInputStream(Class<?> basePathClazz,String resourceName) throws IOException {
return basePathClazz.getResource(resourceName).openStream();
}
}
@Override
public void service(ServletRequest arg0, ServletResponse arg1)
throws ServletException, IOException {
InputStream is = Utils.getInputStream(getClass(), "");
byte[] buff = new byte[1024];
int count = is.read(buff);
StringBuilder result = new StringBuilder();
while(count>0) {
String string =new String(buff, 0, count);
result.append(string);
}
arg1.getWriter().write(result.toString());
}