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.handlers; 22 23 import javax.servlet.http.HttpServletRequest; 24 25 import net.fckeditor.requestcycle.UserPathBuilder; 26 27 /** 28 * Handler for Connector-related properties.<br /> 29 * Wraps to the {@link PropertiesLoader}. 30 * 31 * @version $Id: ConnectorHandler.java 3840 2009-07-08 20:29:46Z mosipov $ 32 */ 33 public class ConnectorHandler { 34 35 /** 36 * Getter for the <code>UserFilesPath</code>. 37 * 38 * @return {@link UserPathBuilder#getUserFilesPath(HttpServletRequest)} or 39 * the <code>DefaultUserFilePath</code> if {@link UserPathBuilder} 40 * isn't set. 41 */ 42 public static String getUserFilesPath(final HttpServletRequest request) { 43 String userFilePath = RequestCycleHandler.getUserFilePath(request); 44 return (userFilePath != null) ? userFilePath : getDefaultUserFilesPath(); 45 } 46 47 /** 48 * Getter for the default handling of files with multiple extensions. 49 * 50 * @return <code>true</code> if single extension only should be enforced 51 * else <code>false</code>. 52 */ 53 public static boolean isForceSingleExtension() { 54 return Boolean.valueOf(PropertiesLoader.getProperty("connector.forceSingleExtension")); 55 } 56 57 /** 58 * Getter for the value to instruct the connector to return the full URL of 59 * a file/folder in the XML response rather than the absolute URL. 60 * 61 * @return <code>true</code> if the property <code>connector.fullUrl</code> is 62 * set else <code>false</code>. 63 */ 64 public static boolean isFullUrl() { 65 return Boolean.valueOf(PropertiesLoader.getProperty("connector.fullUrl")); 66 } 67 68 /** 69 * Getter for the default <code>UserFilesPath</code>. 70 * 71 * @return <code>DefaultUserFilesPath</code> (/userfiles) 72 */ 73 public static String getDefaultUserFilesPath() { 74 return PropertiesLoader.getProperty("connector.userFilesPath"); 75 } 76 77 /** 78 * Getter for the value to instruct the Connector to check if the uploaded 79 * image is really an image. 80 * 81 * @return Boolean value of the property 82 * <code>connector.secureImageUploads</code>. 83 */ 84 public static boolean isSecureImageUploads() { 85 return Boolean.valueOf(PropertiesLoader.getProperty("connector.secureImageUploads")); 86 } 87 }