Hi All

Having extended BridgeServlet for my servlet, I found I could not pass in
any other parameters apart from the pre-defined [session=abc+]number format.
The culprit lies in the readQuery function in the following code:
        if (query.startsWith("session=")) {
            // indicated the session name in the query:
session=<sessionname>+<nodenumber>

            int plus = query.indexOf("+", 8);
            if (plus == -1) {
                res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Malformed URL: No node number found after session.");
                return null;
            }
            sessionName = query.substring(8, plus);
            nodeNumber  = query.substring(plus + 1);
        } else {
            nodeNumber  = query;
        }

ie. the assignment of nodeNumber.  Could that not be changed, so that the
code reads something like :

            sessionName = query.substring(8, plus);
            int nodeEnd = query.indexOf("&");
            if (nodeEnd==-1)
                nodeEnd = query.length();
            nodeNumber  = query.substring(plus + 1, nodeEnd);
        } else {

            int nodeEnd = query.indexOf("&");
            if (nodeEnd==-1)
                nodeEnd = query.length();
            nodeNumber  = query.substring(1, nodeEnd);
        }

This would at least allow for other parameters, although would require
"session=<sessionname>+<nodenumber>" to be first.

It would be really cool if there was a servlet url tag which quaranteed this
format as well.

Regards
Emile


Reply via email to