|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.oreilly.servlet.ServletUtils
public class ServletUtils
A collection of static utility methods useful to servlets. Some methods require Servlet API 2.2.
| 构造方法摘要 | |
|---|---|
ServletUtils()
|
|
| 方法摘要 | |
|---|---|
static URL |
getResource(javax.servlet.ServletContext context,
String resource)
Gets a reference to the given resource within the given context, making sure not to serve the contents of WEB-INF, META-INF, or to display .jsp file source. |
static javax.servlet.Servlet |
getServlet(String name,
javax.servlet.ServletRequest req,
javax.servlet.ServletContext context)
Gets a reference to the named servlet, attempting to load it through an HTTP request if necessary. |
static String |
getStackTraceAsString(Throwable t)
Gets an exception's stack trace as a String |
static void |
returnFile(String filename,
OutputStream out)
Sends the contents of the specified file to the output stream |
static void |
returnURL(URL url,
OutputStream out)
Sends the contents of the specified URL to the output stream |
static void |
returnURL(URL url,
Writer out)
Sends the contents of the specified URL to the Writer (commonly either a PrintWriter or JspWriter) |
static String[] |
split(String str,
String delim)
Splits a String into pieces according to a delimiter. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public ServletUtils()
| 方法详细信息 |
|---|
public static void returnFile(String filename,
OutputStream out)
throws FileNotFoundException,
IOException
filename - the file to sendout - the output stream to write the file
FileNotFoundException - if the file does not exist
IOException - if an I/O error occurs
public static void returnURL(URL url,
OutputStream out)
throws IOException
url - whose contents are to be sentout - the output stream to write the contents
IOException - if an I/O error occurs
public static void returnURL(URL url,
Writer out)
throws IOException
url - whose contents are to be sentout - the Writer to write the contents
IOException - if an I/O error occurspublic static String getStackTraceAsString(Throwable t)
t - the exception or throwable item
public static javax.servlet.Servlet getServlet(String name,
javax.servlet.ServletRequest req,
javax.servlet.ServletContext context)
name - the name of the servletreq - the servlet requestcontext - the servlet context
public static String[] split(String str,
String delim)
str - the string to splitdelim - the delimiter
public static URL getResource(javax.servlet.ServletContext context,
String resource)
throws IOException
context - the context containing the resourceresource - the resource to be read
IOException - if there's any problem accessing the resource
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||