public class ViewImportSupport extends ImportSupport
Provides methods to import arbitrary local or remote resources as strings.
Based on ImportSupport from the JSTL taglib by Shawn Bayern
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ViewImportSupport.ImportResponseWrapper
Wraps responses to allow us to retrieve results as Strings.
|
protected static class |
ViewImportSupport.SafeClosingHttpURLConnectionReader |
| Modifier and Type | Field and Description |
|---|---|
protected javax.servlet.ServletContext |
application |
protected javax.servlet.http.HttpServletRequest |
request |
protected javax.servlet.http.HttpServletResponse |
response |
RESOURCE_KEY, URL_KEY, VALID_SCHEME_CHARSLOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY| Constructor and Description |
|---|
ViewImportSupport() |
| Modifier and Type | Method and Description |
|---|---|
protected Reader |
acquireLocalURLReader(String url) |
protected String |
acquireLocalURLString(String url) |
protected Reader |
acquireRemoteURLReader(String url) |
protected String |
acquireRemoteURLString(String url) |
protected void |
configure(ValueParser values) |
protected URL |
getFileResource(String resource) |
protected String |
mergeQueryStrings(String url)
Merge original parameters into the query string
|
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.
|
acquireReader, acquireString, getClasspathResource, getContentTypeAttribute, getProtocol, getResourceReader, getResourceString, isRemoteURL, setSafeModeconfigure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfigprotected javax.servlet.ServletContext application
protected javax.servlet.http.HttpServletRequest request
protected javax.servlet.http.HttpServletResponse response
protected void configure(ValueParser values)
configure in class ImportSupportpublic 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.request - servlet requestpublic 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.response - servlet responsepublic 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.application - servlet contextprotected String acquireRemoteURLString(String url) throws IOException
acquireRemoteURLString in class ImportSupporturl - the remote URL resource to return as stringIOException - if thrown by underlying codeprotected String acquireLocalURLString(String url) throws IOException
acquireLocalURLString in class ImportSupporturl - the local URL resource to return as stringIOException - if not allowed or if thrown by underlying codeprotected Reader acquireRemoteURLReader(String url) throws IOException
acquireRemoteURLReader in class ImportSupporturl - the URL to readIOException - if not allowed or thrown by underlying codeprotected Reader acquireLocalURLReader(String url) throws IOException
acquireLocalURLReader in class ImportSupporturl - the URL to readIOException - if thrown by underlying codepublic static String stripSession(String url)
url - the url to strip the session id fromprotected String mergeQueryStrings(String url)
url - the url to includeprotected URL getFileResource(String resource) throws Exception
getFileResource in class ImportSupportExceptionCopyright © 2002–2021 The Apache Software Foundation. All rights reserved.