net.fckeditor.connector.impl
Class ContextConnector
java.lang.Object
net.fckeditor.connector.impl.AbstractLocalFileSystemConnector
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:
- Stored files and folders will be gone if the context is undeployed,
unless you have saved them before.
- Some servers are unable to write to the real context root (like
WebSphere), see
init(ServletContext)
for more details.
- Some containers (like Jetty) unpack the war file to a different directory
at server start which means that files are gone in temp.
Use the ContextPathBuilder
in conjunction with this class.
- Version:
- $Id: ContextConnector.java 4785 2009-12-21 20:10:28Z mosipov $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ContextConnector
public ContextConnector()
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-2010 Frederico Caldeira Knabben. All Rights Reserved.