public class ConditionalResource
extends net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
implements org.springframework.core.io.Resource, org.springframework.beans.factory.BeanNameAware, net.shibboleth.utilities.java.support.resource.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) |
net.shibboleth.utilities.java.support.resource.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, getId@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 net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponentpublic InputStream getInputStream() throws IOException
getInputStream in interface net.shibboleth.utilities.java.support.resource.ResourcegetInputStream in interface org.springframework.core.io.InputStreamSourceIOExceptionpublic net.shibboleth.utilities.java.support.resource.Resource createRelativeResource(String relativePath) throws IOException
createRelativeResource in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic void setBeanName(String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic boolean exists()
exists in interface net.shibboleth.utilities.java.support.resource.Resourcepublic boolean isReadable()
isReadable in interface net.shibboleth.utilities.java.support.resource.Resourcepublic boolean isOpen()
isOpen in interface net.shibboleth.utilities.java.support.resource.Resourcepublic URL getURL() throws IOException
getURL in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic URI getURI() throws IOException
getURI in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic File getFile() throws IOException
getFile in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic long contentLength()
throws IOException
contentLength in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic long lastModified()
throws IOException
lastModified in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic org.springframework.core.io.Resource createRelative(String relativePath) throws IOException
IOExceptionpublic String getFilename()
getFilename in interface net.shibboleth.utilities.java.support.resource.Resourcepublic String getDescription()
getDescription in interface net.shibboleth.utilities.java.support.resource.ResourceCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.