210 eClient 101 Customization and Integration
8.1.4 Maximum length of a URL
There are two ways to interface with servlets: by putting parameters in the URL
or by putting parameters for the servlet in the session object. Each browser has
different limits on the length of a URL. In general, you should not use more than
300 characters in a URL.
For example, if you add a new function to the action drop-down box in the eClient
search results that can act on more than one item, do not pass the list of PIDs for
all selected items in the URL directly. You may want to check the length of the
generated list from the selected items to see if you have exceeded the maximum.
You need to handle the situation when the maximum length is exceeded.
8.1.5 Variations in Web browsers
If you want to use HTML that is browser specific, for example the Netscape
<embed> tag, you should check the browser version in the session object. Be
aware that there are differences in the way Web browsers work.
The version of the requesting Web browser is available in the session object and
can therefore be checked in a custom servlet or the JSPs.
8.2 General programming tips
In many cases, your customizations may need to have configurable properties.
Two common ways to specify configuration information are via properties files
and XML files.
An example of using properties files is the IDM.properties file in the eClient
installation directory. Properties files can easily be read using class
java.util.ResourcBundle or java.util.Properties.
An example of an XML configuration file is the icmrm_logging.xml in the resource
manager application. A frequently used XML parser is the Xerces parser, also
contained in WebSphere Studio Application Developer.
8.2.1 Accessing configuration data using properties files
A properties file is similar to a Windows .ini file. A properties file contains a pair of
keywords and associated values. For example, you may have a properties file,
c:\XYZCorp\config.properties, that contains the following text:
Chapter 8. Design and implementation considerations 211
You can use the following code in your application to retrieve those values:
import java.io.FileInputStream;
import java.util.Properties;
Properties eClientProps = new Properties();
FileInputStream in = null;
String strValue = ““;
in = new FileInputStream(“C:\\XYZCorp\\config.properties”);
strValue = eClientProps.getProperty(“LOG_FILE_NAME”);
The example above (with error handling added) is included in the sample code
XYZUtils.java and is called from the modified version of IDMNoteLog.jsp. For
more information about using the properties object, see the following URL:
8.2.2 Using cookies to maintain session status
A cookie is a piece of data passed between a Web server and a Web browser.
The Web server sends a cookie that contains data it requires the next time the
browser accesses the server. The client returns the cookie on each subsequent
request. This is one way to maintain the state between a browser and a server.
Cookie data can be stored so that it is only valid for the current browser session,
or it can be stored for a longer period of time specified by your application.
If the browser supports cookies, these are used to associate the browser with a
session object on the server. For example when using the HttpSession support in
the servlet API, the session manager can use cookies to store a session ID on
the browser.
But you can also use the Cookies API directly to store and retrieve user-specific
Example 8-1 Cookie API sample
public void doGet(HttpServletRequest req, HttpServletResponse res) {
Cookie[] cookies = req.getCookies();
if(cookies != null) {
for(int i=0; i<cookies.length; i++) {
+ "=" cookies[i].getValue());

Get eClient 101 Customization and Integration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.