Hello,
In my application, I have clickable points in my flash charts that once clicked, they will open another IE window that will go to my application’s URL but will append extra parameters that will be used to generate a report.
For example, my URL is:
http://192.168.116.128:7001/dashboard
When I click one of the points in my chart, it will give:
http://192.168.116.128:7001/dashboard?k=45AF10E98312D8FE8032D6AF89A6AF9A&r=0&t=01/02/2008%2005:05:59
The three parameters here are:
A password key (k), a report index (r) and a timestamp (t).
In order to interpret these parameters I have the following code:
class MyParameterHandler implements ParameterHandler {
public void handleParameters(Map parameters) {
// Print out the parameters to standard output
for (Iterator it = parameters.keySet().iterator(); it.hasNext();) {
String key = (String) it.next();
String value = ((String[]) parameters.get(key))[0]
;
System.out.println("Key: " + key + ", value: " + value);
if (key.equals("k")) {
try {
String decrypted = decrypt(value);
if (decrypted.equals(LOOKUP_STRING)) {
System.out.println("Ready to perform lookup.");
lookupPermitted = true;
System.out.println("Lookup="+lookupPermitted);
}
} catch (Exception e) {
// Do nothing
}
}
if (key.equals("r")) {
try {
lookupReportIndex = Integer.parseInt(value);
} catch (Exception e) {
// Do nothing
}
}
if (key.equals("t")) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date d = sdf.parse(value);
lookupDate = value;
} catch (Exception e) {
// Do nothing
}
}
}
}
}
What I’d like to do with this information, is allow the user to bypass the login screen and a report will be generated. The problem I am having is that the ParameterHandler seems to be handling the URL and detecting a lookup but then right after that it seems as though my application is initialized again but this time with the URL missing the parameters.
I have been able to detect this by creating a global variable called lookupPermitted. I set it to true when the lookup succeeds in the ParameterHandler. After the parameter handler code I have outputted this ‘lookupPermitted’ value and it has been reset to false (which is not done anywhere in the code, aside from the initial declaration).
If my window code is:
[code]
public MainWindow(MainApplication a) {
// Get the application reference
appRef = a;
final VerticalLayout mainLayout = new VerticalLayout();
setLayout(mainLayout);
MyParameterHandler handler = new MyParameterHandler();
this.addParameterHandler(handler);
System.out.println("Lookup="+lookupPermitted);
}
[/code]
The value of my lookupPermitted will detected as true in the handler, but false outside of it.
Here is the output from the log:
Key: k, value: 45AF10E98312D8FE8032D6AF89A6AF9A
Ready to perform lookup.
Lookup=true
Key: t, value: 01/02/2008 05:05:59
Key: r, value: 0
Lookup=false
Any ideas why?
I am experiencing this with 5.3.0 RC10 and 5.3.0 RC12 of the toolkit.
P.S. Sorry for the lengthy message.
Thanks,
Ajay