|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.util.CmsResourceTranslator
public class CmsResourceTranslator
This class provides a resource name translation facility.
Resource name translation is required for backward compatibility to the old OpenCms (pre 5.0 beta 2) directory layout. It can also be used to translate special characters or names automatically.
It is also used for translating new resource names that contain illegal chars to legal names. This feature is most useful (and currently only used) for uploaded files. It is also applied to uploded ZIP directories that are extracted after upload.
The translations can be configured in the opencms.properties.
The default directory translation setting is:
directory.translation.rules=s#/default/vfs/content/bodys/(.*)#/default/vfs/system/bodies/$1#, \ s#/default/vfs/pics/system/(.*)#/default/vfs/system/workplace/resources/$1#, \ s#/default/vfs/pics/(.*)#/default/vfs/system/galleries/pics/$1#, \ s#/default/vfs/download/(.*)#/default/vfs/system/galleries/download/$1#, \ s#/default/vfs/externallinks/(.*)#/default/vfs/system/galleries/externallinks/$1#, \ s#/default/vfs/htmlgalleries/(.*)#/default/vfs/system/galleries/htmlgalleries/$1#, \ s#/default/vfs/content/(.*)#/default/vfs/system/modules/default/$1#, \ s#/default/vfs/moduledemos/(.*)#/default/vfs/system/moduledemos/$1#, \ s#/default/vfs/system/workplace/config/language/(.*)#/default/vfs/system/workplace/locales/$1#, \ s#/default/vfs/system/workplace/css/(.*)#/default/vfs/system/workplace/resources/$1#, \ s#/default/vfs/system/workplace/templates/js/(.*)#/default/vfs/system/workplace/scripts/$1#
The default file name translation setting is:
filename.translation.rules=s#[\s]+#_#g, \ s#\\#/#g, \ s#[^0-9a-zA-Z_\.\-\/]#!#g, \ s#!+#x#g
Constructor Summary | |
---|---|
CmsResourceTranslator(java.lang.String[] translations,
boolean continueMatching)
Constructor for the CmsResourceTranslator. |
Method Summary | |
---|---|
java.lang.String[] |
getTranslations()
Returns a copy of the initialized translation rules. |
java.lang.String |
translateResource(java.lang.String resourceName)
Translate a resource name according to the expressions set in the opencms.properties. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CmsResourceTranslator(java.lang.String[] translations, boolean continueMatching)
translations
- The array of translations read from the
opencms,propertiescontinueMatching
- if true
, matching will continue after
the first match was foundMethod Detail |
---|
public java.lang.String[] getTranslations()
public java.lang.String translateResource(java.lang.String resourceName)
resourceName
- The resource name to translate
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |