Package org.silverpeas.core.util.file
Class FileServerUtils
- java.lang.Object
-
- org.silverpeas.core.util.file.FileServerUtils
-
public class FileServerUtils extends Object
- Version:
- Author:
- NEY
-
-
Field Summary
Fields Modifier and Type Field Description static StringARCHIVE_IT_PARAMETERstatic StringCOMPONENT_ID_PARAMETERstatic StringDIR_TYPE_PARAMETERstatic StringDIRECTORY_PARAMETERstatic StringMIME_TYPE_PARAMETERstatic StringNODE_ID_PARAMETERstatic StringPUBLICATION_ID_PARAMETERstatic StringSIZE_PARAMETERstatic StringSOURCE_FILE_PARAMETERstatic StringTYPE_UPLOAD_PARAMETERstatic StringUSER_ID_PARAMETER
-
Constructor Summary
Constructors Constructor Description FileServerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetAliasURL(String componentId, String logicalName, String attachmentId)static StringgetApplicationContext()static StringgetAttachmentURL(String componentId, String logicalName, String attachmentId, String lang)static StringgetImageURL(String originalImageURL, String sizeParams)Gets the URL of the specified image with the specified size.static Map<String,String>getMappedUrl(String spaceId, String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)static StringgetOnlineURL(String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)static StringgetUrl(String componentId, String logicalName)static StringgetUrl(String logicalName, String physicalName, String componentId)static StringgetUrl(String componentId, String name, String mimeType, String subDirectory)static StringgetUrl(String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)static StringgetUrl(String componentId, String userId, String logicalName, String physicalName, String mimeType, boolean archiveIt, int pubId, int nodeId, String subDirectory)static StringgetUrlToTempDir(String logicalName)static StringgetWebUrl(String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)Return the full url to access an attachment from web sitestatic StringreplaceAccentChars(String toParse)Replace accented chars from a string.static StringreplaceInvalidPathChars(String toParse)Replace chars from filename String which can't be used in a file name with '_'.static StringreplaceSpecialChars(String toParse)Replace chars that have special meanings in url by their http substitute.
-
-
-
Field Detail
-
COMPONENT_ID_PARAMETER
public static final String COMPONENT_ID_PARAMETER
- See Also:
- Constant Field Values
-
SOURCE_FILE_PARAMETER
public static final String SOURCE_FILE_PARAMETER
- See Also:
- Constant Field Values
-
DIRECTORY_PARAMETER
public static final String DIRECTORY_PARAMETER
- See Also:
- Constant Field Values
-
ARCHIVE_IT_PARAMETER
public static final String ARCHIVE_IT_PARAMETER
- See Also:
- Constant Field Values
-
DIR_TYPE_PARAMETER
public static final String DIR_TYPE_PARAMETER
- See Also:
- Constant Field Values
-
USER_ID_PARAMETER
public static final String USER_ID_PARAMETER
- See Also:
- Constant Field Values
-
MIME_TYPE_PARAMETER
public static final String MIME_TYPE_PARAMETER
- See Also:
- Constant Field Values
-
TYPE_UPLOAD_PARAMETER
public static final String TYPE_UPLOAD_PARAMETER
- See Also:
- Constant Field Values
-
NODE_ID_PARAMETER
public static final String NODE_ID_PARAMETER
- See Also:
- Constant Field Values
-
PUBLICATION_ID_PARAMETER
public static final String PUBLICATION_ID_PARAMETER
- See Also:
- Constant Field Values
-
SIZE_PARAMETER
public static final String SIZE_PARAMETER
- See Also:
- Constant Field Values
-
-
Method Detail
-
replaceSpecialChars
public static String replaceSpecialChars(String toParse)
Replace chars that have special meanings in url by their http substitute.- Parameters:
toParse- the string which chars that have special meanings in url by their http substitute.- Returns:
- a string without url meaning chars.
-
replaceAccentChars
public static String replaceAccentChars(String toParse)
Replace accented chars from a string.- Parameters:
toParse- the string which accented chars are replaced by non-accented chars.- Returns:
- a string with all its accented chars replaced.
-
getWebUrl
public static String getWebUrl(String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)
Return the full url to access an attachment from web site- Parameters:
componentId-logicalName-physicalName-mimeType-subDirectory-- Returns:
-
getUrl
public static String getUrl(String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)
-
getOnlineURL
public static String getOnlineURL(String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)
-
getAttachmentURL
public static String getAttachmentURL(String componentId, String logicalName, String attachmentId, String lang)
-
getImageURL
public static String getImageURL(String originalImageURL, String sizeParams)
Gets the URL of the specified image with the specified size.Each image uploaded in Silverpeas are kept with their original size. From them, a set of resized images are computed. This method is to get the URL of the resized version of an uploaded image.
- Parameters:
originalImageURL- the URL of the original, non-resized, image.sizeParams- the size of the image to get. The size can be specified either a key in theorg.silverpeas.lookAndFeel.generalLookbundle or as a dimension. The keys of the properties indicating an image size are always prefixed by the 'image.size' term. The dimension of an image must be in the form of WIDTHxHEIGHT with WIDTH the width in pixels of the image and HEIGHT the height in pixels of the image. WIDTH or HEIGHT can be omitted but the 'x' character is required. If null, empty or or not well formed, the original image URL is then returned.- Returns:
- the URL of the image with the specified size.
-
getAliasURL
public static String getAliasURL(String componentId, String logicalName, String attachmentId)
-
getMappedUrl
public static Map<String,String> getMappedUrl(String spaceId, String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)
-
getUrl
public static String getUrl(String componentId, String name, String mimeType, String subDirectory)
-
getUrl
public static String getUrl(String componentId, String userId, String logicalName, String physicalName, String mimeType, boolean archiveIt, int pubId, int nodeId, String subDirectory)
-
replaceInvalidPathChars
public static String replaceInvalidPathChars(String toParse)
Replace chars from filename String which can't be used in a file name with '_'.- Parameters:
toParse- the name of the file.- Returns:
- the name of the file with incorrect chars replaced by '_'.
-
getApplicationContext
public static String getApplicationContext()
-
-