Package org.silverpeas.core.web.http
Class ServletFileResponse
- java.lang.Object
-
- org.silverpeas.core.web.http.FileResponse
-
- org.silverpeas.core.web.http.ServletFileResponse
-
public class ServletFileResponse 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 ServletFileResponse
forceCharacterEncoding(String forcedCharacterEncoding)
Forces the character encoding of the response.ServletFileResponse
forceFileId(String fileId)
Forces the file identifier.
If not forced, the absolute path of the file into Base64 is computed.ServletFileResponse
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.ServletFileResponse
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.ServletFileResponse
noCache()
Sets into response that no cache MUST be handled.void
sendSilverpeasFile(SilverpeasFile file)
Centralization of getting of silverpeas file content.void
sendSilverpeasFile(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
-
sendSilverpeasFile
public void sendSilverpeasFile(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.
-
sendSilverpeasFile
public void sendSilverpeasFile(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.
-
forceFileId
public ServletFileResponse 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 ServletFileResponse 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 ServletFileResponse 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 ServletFileResponse 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 ServletFileResponse noCache()
Description copied from class:FileResponse
Sets into response that no cache MUST be handled.- Overrides:
noCache
in classFileResponse
- Returns:
- itself.
-
-