1 /* 2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 3 * Copyright (C) 2003-2008 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.handlers; 22 23 import javax.servlet.http.HttpServletRequest; 24 25 import net.fckeditor.requestcycle.UserPathBuilder; 26 27 /** 28 * Handler for some base properties.<br> 29 * It's a kind of wrapper to some basic properties handled by the {@link PropertiesLoader}. 30 * 31 * @version $Id: ConnectorHandler.java 1905 2008-04-10 15:32:00Z th-schwarz $ 32 */ 33 public class ConnectorHandler { 34 35 /** 36 * Getter for the base dir (using for user files). 37 * 38 * @return {@link UserPathBuilder#getUserFilesPath(HttpServletRequest)} or the default base dir, if 39 * {@link UserPathBuilder}} isn't set. 40 */ 41 public static String getUserFilesPath(final HttpServletRequest servletRequest) { 42 String userFilePath = RequestCycleHandler.getUserFilePath(servletRequest); 43 return (userFilePath != null) ? userFilePath : getDefaultUserFilesPath(); 44 } 45 46 /** 47 * Getter for the default handling of single extensions. 48 * 49 * @return the forceSingleExtension 50 */ 51 public static boolean isForceSingleExtension() { 52 return Boolean.valueOf(PropertiesLoader.getProperty("connector.forceSingleExtension")); 53 } 54 55 /** 56 * Getter for the value to instruct the connector to return the full URL of a file/folder in the 57 * XML response rather than the absolute URL. 58 * 59 * @return Boolean value of the property 'connector.fullUrl'. 60 */ 61 public static boolean isFullUrl() { 62 return Boolean.valueOf(PropertiesLoader.getProperty("connector.fullUrl")); 63 } 64 65 /** 66 * Getter for the default userFilesPath. 67 * 68 * @return Default userfiles path (/userfiles) 69 */ 70 public static String getDefaultUserFilesPath() { 71 return PropertiesLoader.getProperty("connector.userFilesPath"); 72 } 73 74 /** 75 * Getter for the value to instruct the Connector to check, if the uploaded image is really one. 76 * 77 * @return Boolean value of the property 'connector.secureImageUploads'. 78 */ 79 public static boolean isSecureImageUploads() { 80 return Boolean.valueOf(PropertiesLoader.getProperty("connector.secureImageUploads")); 81 } 82 }