public interface GetableResource extends Resource
| Modifier and Type | Method and Description |
|---|---|
Long |
getContentLength()
The length of the content in this resource.
|
String |
getContentType(String accepts)
Given a comma separated listed of preferred content types acceptable for a client,
return one content type which is the best.
|
Long |
getMaxAgeSeconds(Auth auth)
How many seconds to allow the content to be cached for, or null if caching is not allowed
The provided auth object allows this method to determine an appropriate caching
time depending on authenticated context.
|
void |
sendContent(OutputStream out,
Range range,
Map<String,String> params,
String contentType)
Send the resource's content using the given output stream.
|
authenticate, authorise, checkRedirect, getModifiedDate, getName, getRealm, getUniqueIdvoid sendContent(OutputStream out, Range range, Map<String,String> params, String contentType) throws IOException, io.milton.http.exceptions.NotAuthorizedException, io.milton.http.exceptions.BadRequestException, io.milton.http.exceptions.NotFoundException
out - - the output stream to send the content torange - - null for normal GET's, not null for partial GET's. May be ignoredparams - - request parameterscontentType - - the contentType selected by negotiationIOException - - if there is an exception writing content to the output stream. This
indicates that the client has disconnected (as frequently occurs with http transfers). DO NOT
throw an IOException if there was an internal error generating the response (eg if reading from a database)com.bradmcevoy.http.exceptions.NotAuthorizedExceptionio.milton.http.exceptions.NotAuthorizedExceptionio.milton.http.exceptions.BadRequestExceptionio.milton.http.exceptions.NotFoundExceptionLong getMaxAgeSeconds(Auth auth)
String getContentType(String accepts)
String mime = ContentTypeUtils.findContentTypes( this.file ); return ContentTypeUtils.findAcceptableContentType( mime, preferredList );
com.bradmcevoy.common.ContentTypeUtilsLong getContentLength()