public class StaticResource extends Object implements GetableResource
| Constructor and Description |
|---|
StaticResource(File file,
String url,
String contentType) |
| Modifier and Type | Method and Description |
|---|---|
Object |
authenticate(String user,
String password)
Check the given credentials, and return a relevant object if accepted.
|
boolean |
authorise(Request request,
Request.Method method,
Auth auth)
Return true if the current user is permitted to access this resource using
the specified method.
|
String |
checkRedirect(Request request)
Determine if a redirect is required for this request, and if so return
the URL to redirect to.
|
int |
compareTo(Resource res) |
Long |
getContentLength()
The length of the content in this resource.
|
String |
getContentType(String accepts)
Given a comma seperated listed of preferred content types acceptable for a client, return one content type which is the best.
|
Long |
getMaxAgeSeconds()
How many seconds to allow the content to be cached for, or null if caching is not allowed
|
Date |
getModifiedDate()
The date and time that this resource, or any part of this resource, was last
modified.
|
String |
getName()
Note that this name MUST be consistent with URL resolution in your ResourceFactory
If they arent consistent Milton will generate a different href in PropFind
responses then what clients have request and this will cause either an
error or no resources to be displayed
|
String |
getRealm()
Return the security realm for this resource.
|
String |
getUniqueId() |
void |
sendContent(OutputStream out,
Range range,
Map<String,String> params)
If range not null is a Partial content request
|
public String getUniqueId()
getUniqueId in interface Resourcepublic int compareTo(Resource res)
compareTo in interface Comparable<Resource>public void sendContent(OutputStream out, Range range, Map<String,String> params) throws IOException
GetableResourcesendContent in interface GetableResourceIOExceptionpublic String getName()
Resourcepublic Object authenticate(String user, String password)
Resourceauthenticate in interface Resourceuser - - the username provided by the user's agentpassword - - the password provided by the user's agentpublic boolean authorise(Request request, Request.Method method, Auth auth)
Resourcepublic String getRealm()
Resourcepublic Date getModifiedDate()
ResourcegetModifiedDate in interface Resourcepublic Long getContentLength()
GetableResourcegetContentLength in interface GetableResourcepublic String getContentType(String accepts)
GetableResourcegetContentType in interface GetableResourcepublic String checkRedirect(Request request)
ResourcecheckRedirect in interface Resourcepublic Long getMaxAgeSeconds()
GetableResourcegetMaxAgeSeconds in interface GetableResourceCopyright © 2020. All rights reserved.