Package de.juplo.httpresources
Class HttpResource
- java.lang.Object
-
- de.juplo.httpresources.HttpResource
-
- All Implemented Interfaces:
org.springframework.core.io.InputStreamSource
,org.springframework.core.io.Resource
,org.springframework.web.servlet.resource.HttpResource
public class HttpResource extends Object implements org.springframework.web.servlet.resource.HttpResource
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
contentLength()
org.springframework.util.MimeType
contentType()
HttpResource
createRelative(String relativePath)
HttpResource
createRelative(URI relative)
boolean
equals(Object o)
String
eTag()
boolean
exists()
long
expires()
boolean
fetch()
Fetches the remote resource and reports, if it was modified.boolean
fetched()
Checks, if the remote resource was already fetched.String
getDescription()
File
getFile()
String
getFilename()
InputStream
getInputStream()
org.springframework.http.HttpHeaders
getResponseHeaders()
URI
getURI()
URL
getURL()
int
hashCode()
boolean
isExpired()
boolean
isModified()
boolean
isOpen()
boolean
isReadable()
long
lastModified()
String
toString()
-
-
-
Method Detail
-
expires
public long expires()
-
isExpired
public boolean isExpired()
-
exists
public boolean exists()
- Specified by:
exists
in interfaceorg.springframework.core.io.Resource
-
isReadable
public boolean isReadable()
- Specified by:
isReadable
in interfaceorg.springframework.core.io.Resource
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfaceorg.springframework.core.io.Resource
-
getURL
public URL getURL() throws IOException
- Specified by:
getURL
in interfaceorg.springframework.core.io.Resource
- Throws:
IOException
-
getURI
public URI getURI()
- Specified by:
getURI
in interfaceorg.springframework.core.io.Resource
-
getFile
public File getFile() throws IOException
- Specified by:
getFile
in interfaceorg.springframework.core.io.Resource
- Throws:
IOException
-
contentLength
public long contentLength() throws IOException
- Specified by:
contentLength
in interfaceorg.springframework.core.io.Resource
- Throws:
IOException
-
contentType
public org.springframework.util.MimeType contentType()
-
lastModified
public long lastModified() throws IOException
- Specified by:
lastModified
in interfaceorg.springframework.core.io.Resource
- Throws:
IOException
-
eTag
public String eTag()
-
createRelative
public HttpResource createRelative(String relativePath) throws IOException
- Specified by:
createRelative
in interfaceorg.springframework.core.io.Resource
- Throws:
IOException
-
createRelative
public HttpResource createRelative(URI relative) throws IOException
- Throws:
IOException
-
getFilename
public String getFilename()
- Specified by:
getFilename
in interfaceorg.springframework.core.io.Resource
-
getDescription
public String getDescription()
- Specified by:
getDescription
in interfaceorg.springframework.core.io.Resource
-
getInputStream
public InputStream getInputStream() throws IOException
- Specified by:
getInputStream
in interfaceorg.springframework.core.io.InputStreamSource
- Throws:
IOException
-
isModified
public boolean isModified()
-
fetched
public boolean fetched()
Checks, if the remote resource was already fetched.- Returns:
true
, if the resource was already fetched, otherwisefalse
-
fetch
public boolean fetch()
Fetches the remote resource and reports, if it was modified.This method fetches the remote resource, if was not already fetched. If the resource was already fetched, it revalidates it, if necessary.
- Returns:
true
, if the resource has changed or was fetched for the first time, otherwisefalse
-
getResponseHeaders
public org.springframework.http.HttpHeaders getResponseHeaders()
- Specified by:
getResponseHeaders
in interfaceorg.springframework.web.servlet.resource.HttpResource
-
-