|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.velocity.tools.view.ImportSupport
public abstract class ImportSupport
Provides methods to import arbitrary local or remote resources as strings.
Based on ImportSupport from the JSTL taglib by Shawn Bayern
Nested Class Summary | |
---|---|
protected static class |
ImportSupport.ImportResponseWrapper
Wraps responses to allow us to retrieve results as Strings. |
protected static class |
ImportSupport.SafeClosingHttpURLConnectionReader
|
Field Summary | |
---|---|
protected javax.servlet.ServletContext |
application
|
protected static String |
DEFAULT_ENCODING
Default character encoding for response. |
protected Log |
LOG
|
protected javax.servlet.http.HttpServletRequest |
request
|
protected javax.servlet.http.HttpServletResponse |
response
|
protected static String |
VALID_SCHEME_CHARS
|
Constructor Summary | |
---|---|
ImportSupport()
|
Method Summary | |
---|---|
protected Reader |
acquireReader(String url)
|
protected String |
acquireString(String url)
|
static String |
getContentTypeAttribute(String input,
String name)
Get the value associated with a content-type attribute. |
static boolean |
isAbsoluteUrl(String url)
Returns true if our current URL is absolute, false otherwise. |
void |
setLog(Log log)
|
void |
setRequest(javax.servlet.http.HttpServletRequest request)
Sets the current HttpServletRequest . |
void |
setResponse(javax.servlet.http.HttpServletResponse response)
Sets the current HttpServletResponse . |
void |
setServletContext(javax.servlet.ServletContext application)
Sets the ServletContext . |
static String |
stripSession(String url)
Strips a servlet session ID from url. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String VALID_SCHEME_CHARS
protected static final String DEFAULT_ENCODING
protected Log LOG
protected javax.servlet.ServletContext application
protected javax.servlet.http.HttpServletRequest request
protected javax.servlet.http.HttpServletResponse response
Constructor Detail |
---|
public ImportSupport()
Method Detail |
---|
public void setLog(Log log)
public void setRequest(javax.servlet.http.HttpServletRequest request)
HttpServletRequest
. This is required
for this tool to operate and will throw a NullPointerException
if this is not set or is set to null
.
public void setResponse(javax.servlet.http.HttpServletResponse response)
HttpServletResponse
. This is required
for this tool to operate and will throw a NullPointerException
if this is not set or is set to null
.
public void setServletContext(javax.servlet.ServletContext application)
ServletContext
. This is required
for this tool to operate and will throw a NullPointerException
if this is not set or is set to null
.
protected String acquireString(String url) throws IOException, Exception
url
- the URL resource to return as string
IOException
Exception
protected Reader acquireReader(String url) throws IOException, Exception
url
- the URL to read
IOException
Exception
public static boolean isAbsoluteUrl(String url)
url
- the url to check out
public static String stripSession(String url)
url
- the url to strip the session id from
public static String getContentTypeAttribute(String input, String name)
input
- the string containing the attributesname
- the name of the content-type attribute
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |