com.stratelia.webactiv.util
Class FileServerUtils

java.lang.Object
  extended by com.stratelia.webactiv.util.FileServerUtils

public class FileServerUtils
extends Object

Version:
Author:
NEY

Field Summary
static String ARCHIVE_IT_PARAMETER
           
static String COMPONENT_ID_PARAMETER
           
static String DIR_TYPE_PARAMETER
           
static String DIRECTORY_PARAMETER
           
static String MIME_TYPE_PARAMETER
           
static String NODE_ID_PARAMETER
           
static String PUBLICATION_ID_PARAMETER
           
static String SIZE_PARAMETER
           
static String SOURCE_FILE_PARAMETER
           
static String TYPE_UPLOAD_PARAMETER
           
static String USER_ID_PARAMETER
           
 
Constructor Summary
FileServerUtils()
           
 
Method Summary
static String getAliasURL(String componentId, String logicalName, String attachmentId)
           
static String getApplicationContext()
           
static String getAttachmentURL(String componentId, String logicalName, String attachmentId, String lang)
           
static String getImageURL(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 String getOnlineURL(String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)
           
static String getUrl(String componentId, String logicalName)
           
static String getUrl(String logicalName, String physicalName, String mimeType)
           
static String getUrl(String componentId, String name, String mimeType, String subDirectory)
           
static String getUrl(String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)
           
static String getUrl(String componentId, String userId, String logicalName, String physicalName, String mimeType, boolean archiveIt, int pubId, int nodeId, String subDirectory)
           
static String getUrlToTempDir(String logicalName)
           
static String getWebUrl(String componentId, String logicalName, String physicalName, String mimeType, String subDirectory)
          Return the full url to access an attachment from web site
static String replaceAccentChars(String toParse)
          Replace accented chars from a string.
static String replaceInvalidPathChars(String toParse)
          Replace chars from filename String which can't be used in a file name with '_'.
static String replaceSpecialChars(String toParse)
          Replace chars that have special meanings in url by their http substitute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

FileServerUtils

public FileServerUtils()
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)

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 the org.silverpeas.lookAndFeel.generalLook bundle 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 logicalName,
                            String physicalName,
                            String mimeType)

getUrl

public static String getUrl(String componentId,
                            String userId,
                            String logicalName,
                            String physicalName,
                            String mimeType,
                            boolean archiveIt,
                            int pubId,
                            int nodeId,
                            String subDirectory)

getUrlToTempDir

public static String getUrlToTempDir(String logicalName)

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()


Copyright © 2016 Silverpeas. All Rights Reserved.