This Java(tm) servlet implements FileManager. You can use this servlet for example for remote site management: upload/download files, copy/move files, edit files etc. The main advantage is the usage HTTP protocol only for access to your host. So this approach is free from any firewall's restrictions.
How to use it:
a) copy fmanagerPackage.jar into WEB-INF/lib
b) describe FileManager servlet in web.inf file:
c) define a mapping for FileManager servlet in your web.xml file.
now you can run this servlet:
Parameter config is optional. This parameter lets you define some configuration settings as an initial parameter for your servlet. You must set a path to the configuration file as an initial parameter for FileManager servlet.
Configuration file is a text file, each line describes one parameter in the form of
Empty lines and any line starts with # or // are ignored.
Current version supports the following list of parameters:
# base (initial) directory. By default it will be the root directory
of your servletunner.
# title (by default is empty - no title)
# style. Describes a link for your CSS style file. By default is empty. E.g.:
# background color (by default is #3366FF)
# foreground color (by default is #FFFFFF)
# color for visited directories (default is #FFFF00)
#font size (by default is current browser's font)
#font face (by default is current browser's font)
# file extensions for visible files. Here you can set commas separated
# list of extensions. Only such files will be visible. By default
# this parameter is empty (all files are visible)
# file extensions for text editor. Here you can set commas separated
# extensions. All such files are editable through this servlet.
# By default it is: txt,htm,shtml,html,java,jsp,cpp,h,jsp,pl,sh,csh,xml,bat,ini
# E.g. :
# head. You can set here some file contains any html-code. This code
# outputted at the beginning of the each page. So you can set for example some banners.
# By default this value is empty
# Look and feel mode. By default it is 1 (list of files like Norton
Commander for example)
# 2 means Explorer like view
# security mode. Default value is 0 - user may see any available directory
# on your server. If you set it to 1 user may see only initial
# directory and any directory below
# enable/disable functions. Possible values are 1 (enabled) or
# 0 (disabled). By default all actions are enabled.
# enable/disable uploading. Default value is 1
# enable/disable edit. Default value is 1
# enable/disable create directories
# enable/disable copy files
# enable/disable move/rename files
# enable/disable delete files
# how to open files. Default value is 0 - open in place, 1 - open in the
# separate window
# maximal size for uploaded file (in bytes). By default size is unlimited
# authorization flag (See Authorization section below)
# login page
# Date format. By default will use full date.
# You may set here format for date. E.g.:
# localization support. You can set character encoding for input parameters
# here. Default value is ISO-8859-1
You may incorporate this servlet into your portal where your users will be authorized. In order to prevent access to files from not authorized visitors you may use authorized parameter in your config file. Servlet assumes that your authorization procedure will put some object into session (as a flag for authorized users). And name for this object should be described for FileManager as a parameter authorized. Servlet checks session and if there is no such attribute than request will be forwarded or redirected to the page, described as a parameter login.
If login value starts with http than request will be redirected to that site. Otherwise servlet assumes a local resource and forwards request.
1. You can save such configuration file anywhere on your server. Just use the proper path for setting servlet's parameter. Short path (just name of the file) means that your configuration file is saved under the root (docBase) directory of your container.
2. Evaluation version adds an exta © information to the edited file and restricts size for the uploaded files.
For downloading: fmanagerPackage.jar
Sample of config file: fmconf
© Coldbeans  Comments?
See also JSOS - the largest collection of servlets and filters.