Changeset 2101 for FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/ConnectorServlet.java
- Timestamp:
- 2008-06-23 00:00:48 (7 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/ConnectorServlet.java
r2028 r2101 51 51 52 52 /** 53 * Servlet to upload and browse files.<br> 54 * 55 * This servlet accepts 4 commands used to retrieve and create files and folders from a server 56 * directory. The allowed commands are: 53 * Servlet to upload and browse files.<br /> 54 * 55 * This servlet accepts 4 commands which interact with the server-side 56 * filesystem.<br /> 57 * The allowed commands are: 57 58 * <ul> 58 * <li>GetFolders: Retrieve the list of directory under the current folder 59 * <li>GetFoldersAndFiles: Retrive the list of files and directory under the current folder 60 * <li>CreateFolder: Create a new directory under the current folder 61 * <li>FileUpload: Send a new file to the server (must be sent with a POST) 59 * <li><code>GetFolders</code>: Retrieves a list of folders in the current 60 * folder</li> 61 * <li><code>GetFoldersAndFiles</code>: Retrives a list of files and folders 62 * in the current folder</li> 63 * <li><code>CreateFolder</code>: Creates a new folder in the current folder</li> 64 * <li><code>FileUpload</code>: Stores an uploaded file into the current 65 * folder. (must be sent with POST)</li> 62 66 * </ul> 63 67 * … … 70 74 71 75 /** 72 * Initialize the servlet.<br> 73 * The default directory for user files will be constructed. 76 * Initialize the servlet: <code>mkdir</code> <DefaultUserFilesPath> 74 77 */ 75 78 public void init() throws ServletException, IllegalArgumentException { 76 // check, if 'baseDir' exists77 79 String realDefaultUserFilesPath = getServletContext().getRealPath( 78 80 ConnectorHandler.getDefaultUserFilesPath()); … … 81 83 UtilsFile.checkDirAndCreate(defaultUserFilesDir); 82 84 83 logger.info("ConnectorServlet successful initialized!");85 logger.info("ConnectorServlet successfully initialized!"); 84 86 } 85 87 86 88 /** 87 * Manage the Get requests (GetFolders, GetFoldersAndFiles, CreateFolder).<br> 89 * Manage the <code>GET</code> requests (<code>GetFolders</code>, 90 * <code>GetFoldersAndFiles</code>, <code>CreateFolder</code>).<br/> 88 91 * 89 * The servlet accepts commands sent in the following format:<br> 90 * connector?Command=CommandName&Type=ResourceType&CurrentFolder=FolderPath<br> 91 * <br> 92 * It executes the commands and then return the results to the client in XML format. 93 * 92 * The servlet accepts commands sent in the following format:<br/> 93 * <code>connector?Command=<CommandName>&Type=<ResourceType>&CurrentFolder=<FolderPath></code> 94 * <p> 95 * It executes the commands and then returns the result to the client in XML 96 * format. 97 * </p> 94 98 */ 95 99 public void doGet(HttpServletRequest request, HttpServletResponse response) … … 174 178 175 179 /** 176 * Manage the Post requests (FileUpload).<br>180 * Manage the <code>POST</code> requests (<code>FileUpload</code>).<br /> 177 181 * 178 * The servlet accepts commands sent in the following format:<br> 179 * connector?Command=FileUpload&Type=ResourceType&CurrentFolder=FolderPath<br> 182 * The servlet accepts commands sent in the following format:<br /> 183 * <code>connector?Command=<FileUpload>&Type=<ResourceType>&CurrentFolder=<FolderPath></code> 184 * with the file in the <code>POST</code> body.<br /> 180 185 * <br> 181 * It store the file (renaming it in case a file with the same name exists) and then return an182 * HTML file with a javascript command in it.186 * It stores an uploaded file (renames a file if another exists with the 187 * same name) and then returns the JavaScript callback. 183 188 */ 184 189 @SuppressWarnings("unchecked") … … 202 207 UploadResponse ur; 203 208 204 // if this is a QuickUpload-Request, 'commandStr' and 'currentFolderStr' are empty 209 // if this is a QuickUpload request, 'commandStr' and 'currentFolderStr' 210 // are empty 205 211 if (Utils.isEmpty(commandStr) && Utils.isEmpty(currentFolderStr)) { 206 212 commandStr = "QuickUpload";