View Javadoc

1   /*
2    * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3    * Copyright (C) 2004-2009 Frederico Caldeira Knabben
4    * 
5    * == BEGIN LICENSE ==
6    * 
7    * Licensed under the terms of any of the following licenses at your
8    * choice:
9    * 
10   *  - GNU General Public License Version 2 or later (the "GPL")
11   *    http://www.gnu.org/licenses/gpl.html
12   * 
13   *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14   *    http://www.gnu.org/licenses/lgpl.html
15   * 
16   *  - Mozilla Public License Version 1.1 or later (the "MPL")
17   *    http://www.mozilla.org/MPL/MPL-1.1.html
18   * 
19   * == END LICENSE ==
20   */
21  package net.fckeditor.connector.impl;
22  
23  import javax.servlet.ServletContext;
24  
25  import net.fckeditor.requestcycle.impl.ServerRootPathBuilder;
26  
27  /**
28   * Real local filesystem backend connector. The file access is translated as-is
29   * to the local filesystem.
30   * <p>
31   * This maybe interesting for those who serve userfiles
32   * <ul>
33   * <li>from a static context of a servlet container/application
34   * server,</li>
35   * <li>from virtual servers with Apache HTTPd on different
36   * domains, e.g. <code>http://userfiles.mydomain.com</code>, or</li>
37   * <li>on a per-user basis, e.g. uploading to
38   * <code>/home/$USERNAME/public_html/fckeditor</code> and an Apache HTTPd serves
39   * as <code>/~$USERNAME/fckeditor</code>.</li>
40   * </ul>
41   * </p>
42   * Use the {@link ServerRootPathBuilder} in conjunction with this class.
43   * 
44   * @version $Id: LocalConnector.java 3591 2009-06-01 13:04:42Z mosipov $
45   */
46  public class LocalConnector extends AbstractLocalFileSystemConnector {
47  
48  	/**
49  	 * {@inheritDoc} Assigns only the {@code servletContext}.
50  	 */
51  	public void init(final ServletContext servletContext) throws Exception {
52  		this.servletContext = servletContext;
53  	}
54  
55  	/**
56  	 * Returns the passed parameter as-is.
57  	 */
58  	@Override
59  	protected String getRealUserFilesAbsolutePath(String userFilesAbsolutePath) {
60  		return userFilesAbsolutePath;
61  	}
62  
63  }