Saturday 24 September 2011

Handling a limited length redirect URL

Handling a limited length redirect URL By default, all input parameters to the controller command are propagated to the redirect view command. If there is a limit on the number of characters in the redirect URL, this may cause a problem. An example of when the length may be limited is if the client is using the Internet Explorer browser. For this browser, the URL cannot exceed 2083 bytes. If the URL does exceed this limit,
the URL gets truncated. As such, you can encounter a problem if there are a large number of input parameters, or if you are using encryption, because an encrypted string is typically two to three times longer than a string that is not encrypted. There arethe URL gets truncated. As such, you can encounter a problem if there are a large number of input parameters, or if you are using encryption, because an encrypted string is typically two to three times longer than a string that is not encrypted. There are two approaches for handling a limited length redirect URL: 
1. Override the getViewInputProperties method in the controller command to return only the sets of parameters that are required to be passed to the redirect view command.
2. Use a specified special character in the URL parameters to indicate which parameters can be removed from the input parameter string.To demonstrate each of the preceding approaches, consider the following set of input parameters to the controller command: URL="MyView";
// All of the following are inputs to the original controller command. 
ip1="ipv1";
ip2="ipv2";
ip3="ipv3";
iq1="iqv1";
iq2="iqv2";
ir1="ipr1";
ir2="ipr2";
is="isv";
If you are overriding the getViewInputProperties method, the new method can be written so that only the following parameters are passed to the view command: ir2="ipr2"; is="isv"; Using the second approach, the view command can be invoked using special parameters to indicate that certain input parameters should be removed. For example, you can achieve the same result by specifying the following as the URL parameter: URL="MyView?ip*=&iq*=&ir1=" This URL parameter instructs the WebSphere Commerce run-time framework of the following: 
 The ip*= specification means that all parameters whose names start with ip should be removed.
The iq*= specification means that all parameters whose names start with iq should be removed. 
The ir1= specification means that the ir1 parameter should be removed.

No comments:

Post a Comment

How to customize java.util.logging.Logger class to write logs in separate file than System.out.log in Websphere commerce/ HCL commerce)

/** * This method updated the passed in java.util.logging.Logger object with * custom file handler to write logs data form that class ...