Getting the URL parameters in a Domino Java web agent
In my dataProxy agent I needed an easy way to get all the URL parameters. I figured I would post that in a separate entry so it wouldn’t get lost.
private HashMap getURLParameters() throws NotesException {
String url = agentContext.getDocumentContext().getItemValueString("QUERY_STRING");
String[] vals = url.split("&");
HashMap m = new HashMap();
for( int i = 0; i < vals.length; i++){
String[] p = vals[i].split("=");
if( p.length == 2 ){
try {
m.put(p[0], URLDecoder.decode(p[1],"UTF-8") );
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return m;
}
I can then save them in a member of my agent as a HashMap like param.get(“db”) or param.containsKey(“db”) and can get at them where ever I am.
-
edtoh likes this
-
notesonmobile posted this