net.fckeditor.connector.impl
Class ContextConnector

java.lang.Object
  extended by net.fckeditor.connector.impl.AbstractLocalFileSystemConnector
      extended by net.fckeditor.connector.impl.ContextConnector
All Implemented Interfaces:
Connector

public class ContextConnector
extends AbstractLocalFileSystemConnector

Context filesystem backend connector. The file access will be restricted to the real context root of the currently deployed webapp.

Though, this connector has some drawbacks:

Use the ContextPathBuilder in conjunction with this class.

Version:
$Id: ContextConnector.java 3591 2009-06-01 13:04:42Z mosipov $

Field Summary
 
Fields inherited from class net.fckeditor.connector.impl.AbstractLocalFileSystemConnector
servletContext
 
Fields inherited from interface net.fckeditor.connector.Connector
KEY_NAME, KEY_SIZE
 
Constructor Summary
ContextConnector()
           
 
Method Summary
protected  String getRealUserFilesAbsolutePath(String userFilesAbsolutePath)
          Resolves the userfiles absolute path against the current context real path.
 void init(ServletContext servletContext)
          Initializes this connector.
 
Methods inherited from class net.fckeditor.connector.impl.AbstractLocalFileSystemConnector
createFolder, fileUpload, getFiles, getFolders, getOrCreateResourceTypeDir
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextConnector

public ContextConnector()
Method Detail

init

public void init(ServletContext servletContext)
          throws Exception
Initializes this connector. Called at dispatcher initialization. This method will prepare the connector for further usage, additionally it will check if the aforementioned drawback exists. It will try to resolve the default UserFilesPath with ServletContext.getRealPath(String) against the local filesystem (real path). If it fails, it will emit helpful log messages and will throw an exception too.

Parameters:
servletContext - reference to the ServletContext in which the caller is running
Throws:
Exception - if the connector initialization fails due to some reason

getRealUserFilesAbsolutePath

protected String getRealUserFilesAbsolutePath(String userFilesAbsolutePath)
Resolves the userfiles absolute path against the current context real path.

Specified by:
getRealUserFilesAbsolutePath in class AbstractLocalFileSystemConnector
Parameters:
userFilesAbsolutePath - the userfiles absolute path to resolve against a specific backend
Returns:
the resolved userfiles absolute path


Copyright © 2004-2009 Frederico Caldeira Knabben. All Rights Reserved.