This type of custom command has the effect that the GUI sends a request using a configured URL. This URL is configured in the itemRegistry.xml file (see Configuring Custom Commands):
Since the GUI needs to be able to find the servlet, it must be placed in the GUI web application. Place the servlets class file in the subdirectory named like the servlet package name below
Alternatively, the jar file can be placed in lib. Then register the servlet in
The paths above refer to the instance directory concerned.
The servlet is required to descend from the class com.infopark.cm.htmlgui.browse.CustomServlet which provides the following auxiliary functions:
String getLogin(HttpServletRequest request) returns the user name of the current user.
Locale getLocale(HttpServletRequest request) returns the locale (and thus also the language) of the current user.
List getObjectIds(HttpServletRequest request) returns a list of the IDs of all files for which the command has been called (for global commands the empty list).
String getReturnUri(HttpServletRequest request) returns an URI to be requested via a browser redirect for returning to the GUI.
String getDialogId(HttpServletRequest request) returns the dialog ID required for subsequent requests.
Therefore, in the custom servlet the login of the current user and his language can be determined. If the custom command refers to a file or a list of files, the IDs of the files concerned are available as well (see the methods above).
Since the servlet must not harm the GUI, nothing must be stored in the current session. Instead of the methods normally used for this purpose, please use the following auxiliary methods of the same name:
void setAttribute(HttpServletRequest request,
String key, Object value)
Object getAttribute(HttpServletRequest request, String key)
void removeAttribute(HttpServletRequest request, String key)
When the servlet initiates new requests, for example via a redirect or a form, the dialog ID must be passed as a request parameter (URL parameter, form field or the like) for the auxiliar methods to continue to work. This is not necessary when returning to the GUI.
The name of the parameter under which the dialog ID must be passed in the request is stored in the
DIALOG_ID static string field.