Package org.silverpeas.core.web.http
Class RestFileResponse
- java.lang.Object
-
- org.silverpeas.core.web.http.FileResponse
-
- org.silverpeas.core.web.http.RestFileResponse
-
public class RestFileResponse extends FileResponse
Centralizing the code which permits to send a file, and if necessary or asked to send it partially.- Author:
- Yohann Chastagnier
-
-
Field Summary
-
Fields inherited from class org.silverpeas.core.web.http.FileResponse
DOWNLOAD_CONTEXT_PARAM
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RestFileResponse
forceCharacterEncoding(String forcedCharacterEncoding)
Forces the character encoding of the response.RestFileResponse
forceFileId(String fileId)
Forces the file identifier.
If not forced, the absolute path of the file into Base64 is computed.RestFileResponse
forceFileName(String fileName)
Forces the file name into the response.
If not forced, the file name is computed from the file itself.
Even if a file name has been forced, if the request contains into headers a valuatedforceFileName
parameter, the file name from the request is taken into account.RestFileResponse
forceMimeType(String mimeType)
Forces the mime type of the response.
If not forced, the mime type is computed from the file itself.
Even if a mime type has been forced, if the request contains into headers a valuatedforceMimeType
parameter, the mime type from the request is taken into account.RestFileResponse
noCache()
Sets into response that no cache MUST be handled.javax.ws.rs.core.Response.ResponseBuilder
silverpeasFile(SilverpeasFile file)
Centralization of getting of silverpeas file content.javax.ws.rs.core.Response.ResponseBuilder
silverpeasFile(SilverpeasFile file, boolean downloadContext)
Centralization of getting of silverpeas file content.-
Methods inherited from class org.silverpeas.core.web.http.FileResponse
encodeAttachmentFilenameAsUtf8, encodeInlineFilenameAsUtf8, fromRest, fromServlet
-
-
-
-
Method Detail
-
silverpeasFile
public javax.ws.rs.core.Response.ResponseBuilder silverpeasFile(SilverpeasFile file)
Centralization of getting of silverpeas file content.A download context flag is verified from parameters and attributes of the request.
- Parameters:
file
- the silverpeas file to send.- Returns:
- the response builder.
-
silverpeasFile
public javax.ws.rs.core.Response.ResponseBuilder silverpeasFile(SilverpeasFile file, boolean downloadContext)
Centralization of getting of silverpeas file content.Using directly this method means that the request downloadContext flag is ignored.
- Parameters:
file
- the silverpeas file to send.downloadContext
- indicating a download context in order to specify rightly response headers.- Returns:
- the response builder.
-
forceFileId
public RestFileResponse forceFileId(String fileId)
Description copied from class:FileResponse
Forces the file identifier.
If not forced, the absolute path of the file into Base64 is computed.- Overrides:
forceFileId
in classFileResponse
- Parameters:
fileId
- the file identifier.- Returns:
- itself.
-
forceMimeType
public RestFileResponse forceMimeType(String mimeType)
Description copied from class:FileResponse
Forces the mime type of the response.
If not forced, the mime type is computed from the file itself.
Even if a mime type has been forced, if the request contains into headers a valuatedforceMimeType
parameter, the mime type from the request is taken into account.- Overrides:
forceMimeType
in classFileResponse
- Parameters:
mimeType
- the mime type to set.- Returns:
- itself.
-
forceCharacterEncoding
public RestFileResponse forceCharacterEncoding(String forcedCharacterEncoding)
Description copied from class:FileResponse
Forces the character encoding of the response.- Overrides:
forceCharacterEncoding
in classFileResponse
- Parameters:
forcedCharacterEncoding
- the character encoding to set.- Returns:
- itself.
-
forceFileName
public RestFileResponse forceFileName(String fileName)
Description copied from class:FileResponse
Forces the file name into the response.
If not forced, the file name is computed from the file itself.
Even if a file name has been forced, if the request contains into headers a valuatedforceFileName
parameter, the file name from the request is taken into account.- Overrides:
forceFileName
in classFileResponse
- Parameters:
fileName
- the file name to set.- Returns:
- itself.
-
noCache
public RestFileResponse noCache()
Description copied from class:FileResponse
Sets into response that no cache MUST be handled.- Overrides:
noCache
in classFileResponse
- Returns:
- itself.
-
-