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)
Acquire a reader to a local URL - non applicable to the generic version of ImportSupport
|
protected String |
acquireLocalURLString(String url)
Aquire the content of a local URL.
|
protected Reader |
acquireRemoteURLReader(String url)
Acquire a reader to a remote URL
|
protected String |
acquireRemoteURLString(String url)
Aquire the content of a remote URL.
|
protected void |
configure(ValueParser values)
Configure import support
|
protected URL |
getFileResource(String resource)
Overridable local file URL builder.
|
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)
ImportSupportconfigure in class ImportSupportvalues - configuration valuespublic 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
ImportSupportacquireRemoteURLString in class ImportSupporturl - the remote URL resource to return as stringIOException - if thrown by underlying codeprotected String acquireLocalURLString(String url) throws IOException
ImportSupportacquireLocalURLString 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
ImportSupportacquireRemoteURLReader in class ImportSupporturl - the URL to readIOException - if not allowed or thrown by underlying codeprotected Reader acquireLocalURLReader(String url) throws IOException
ImportSupportacquireLocalURLReader 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
ImportSupportgetFileResource in class ImportSupportresource - the resource to readException - if operation failedCopyright © 2002–2021 The Apache Software Foundation. All rights reserved.