public class ConditionalResource extends AbstractIdentifiedInitializableComponent implements org.springframework.core.io.Resource, org.springframework.beans.factory.BeanNameAware, Resource
Resource that may be absent by returning an empty bean file instead.| Modifier and Type | Field and Description |
|---|---|
private static String |
EMPTY_RESOURCE
Dummy content.
|
private org.slf4j.Logger |
log
Logger.
|
private String |
logPrefix
Cached log prefix.
|
private org.springframework.core.io.Resource |
wrappedResource
Resource to wrap.
|
| Constructor and Description |
|---|
ConditionalResource(org.springframework.core.io.Resource wrapped)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
long |
contentLength() |
org.springframework.core.io.Resource |
createRelative(String relativePath) |
Resource |
createRelativeResource(String relativePath) |
boolean |
exists() |
String |
getDescription() |
File |
getFile() |
String |
getFilename() |
InputStream |
getInputStream() |
protected String |
getLogPrefix()
Return a prefix for logging messages for this component.
|
URI |
getURI() |
URL |
getURL() |
boolean |
isOpen() |
boolean |
isReadable() |
long |
lastModified() |
void |
setBeanName(String name) |
void |
setId(String id) |
doInitialize, getIddestroy, doDestroy, initialize, isDestroyed, isInitialized@Nonnull @NotEmpty private static final String EMPTY_RESOURCE
@Nonnull private final org.slf4j.Logger log
@Nonnull private final org.springframework.core.io.Resource wrappedResource
public ConditionalResource(@Nonnull org.springframework.core.io.Resource wrapped)
wrapped - the resource to wrappublic void setId(@Nonnull @NotEmpty String id)
setId in class AbstractIdentifiedInitializableComponentpublic InputStream getInputStream() throws IOException
getInputStream in interface ResourcegetInputStream in interface org.springframework.core.io.InputStreamSourceIOExceptionpublic Resource createRelativeResource(String relativePath) throws IOException
createRelativeResource in interface ResourceIOExceptionpublic void setBeanName(String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic boolean isReadable()
isReadable in interface Resourcepublic URL getURL() throws IOException
getURL in interface ResourceIOExceptionpublic URI getURI() throws IOException
getURI in interface ResourceIOExceptionpublic File getFile() throws IOException
getFile in interface ResourceIOExceptionpublic long contentLength()
throws IOException
contentLength in interface ResourceIOExceptionpublic long lastModified()
throws IOException
lastModified in interface ResourceIOExceptionpublic org.springframework.core.io.Resource createRelative(String relativePath) throws IOException
IOExceptionpublic String getFilename()
getFilename in interface Resourcepublic String getDescription()
getDescription in interface ResourceCopyright © 1999–2019 Shibboleth Consortium. All rights reserved.