From 7317c03005cec9c99e3f4ed8b5497f0050a42a77 Mon Sep 17 00:00:00 2001 From: "peter.danner" Date: Wed, 7 Sep 2005 14:29:25 +0000 Subject: WebDAV Enhancement des Proxy git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@500 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../moa/id/util/InOrderServletRequestWrapper.java | 43 ++++++++++++++++++---- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'id.server/src') diff --git a/id.server/src/at/gv/egovernment/moa/id/util/InOrderServletRequestWrapper.java b/id.server/src/at/gv/egovernment/moa/id/util/InOrderServletRequestWrapper.java index 78d0a0db0..18fc0587e 100644 --- a/id.server/src/at/gv/egovernment/moa/id/util/InOrderServletRequestWrapper.java +++ b/id.server/src/at/gv/egovernment/moa/id/util/InOrderServletRequestWrapper.java @@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequestWrapper; +import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.URLDecoder; /** @@ -91,7 +92,7 @@ public class InOrderServletRequestWrapper extends HttpServletRequestWrapper { //Insert code for Query string parsing String rawQuery = req.getQueryString(); - queryParameters = tokenize(queryParameters, queryParamOrder, rawQuery, DEFAULT_CHARACTER_ENCODING); + queryParameters = tokenize(queryParameters, queryParamOrder, rawQuery, DEFAULT_CHARACTER_ENCODING, true); //analyze HTTP Post body parameters if (req.getMethod().equalsIgnoreCase("POST")) @@ -171,7 +172,7 @@ public class InOrderServletRequestWrapper extends HttpServletRequestWrapper { } postedBody = new String(postedBytes); - Hashtable ht2 = tokenize(ht, bodyParamOrder, postedBody, encoding); + Hashtable ht2 = tokenize(ht, bodyParamOrder, postedBody, encoding, false); return ht2; } @@ -186,7 +187,7 @@ public class InOrderServletRequestWrapper extends HttpServletRequestWrapper { * * @return the Hashtable with the parsed data */ - private Hashtable tokenize(Hashtable ht, Vector order, final String parameterString, final String encoding) + private Hashtable tokenize(Hashtable ht, Vector order, final String parameterString, final String encoding, boolean decode) { String[] valArray = null; @@ -207,8 +208,15 @@ public class InOrderServletRequestWrapper extends HttpServletRequestWrapper { } try { - key = URLDecoder.decode(pair.substring(0, pos), encoding); - val = URLDecoder.decode(pair.substring(pos + 1, pair.length()), encoding); + if (decode) { + key = URLDecoder.decode(pair.substring(0, pos), encoding); + val = URLDecoder.decode(pair.substring(pos + 1, pair.length()), encoding); + } else { + key = pair.substring(0, pos); + val = pair.substring(pos + 1, pair.length()); + } + //Logger.debug("(" + Integer.toString(key.length()) + "=" + Integer.toString(pair.substring(0, pos).length()) + ")"+key+"|--|"+pair.substring(0, pos)); + //Logger.debug("(" + Integer.toString(val.length()) + "=" + Integer.toString(pair.substring(pos + 1, pair.length()).length()) + ")"+val+"|--|"+pair.substring(pos + 1, pair.length())); } catch (Exception e) { @@ -321,14 +329,35 @@ public class InOrderServletRequestWrapper extends HttpServletRequestWrapper { return vallist; } + /** + * + * Returns an Enumeration of String objects containing the names of the + * parameters. If there are no parameters, the method returns an empty + * Enumeration. + * + * @return an Enumeration of String objects, each String + * containing the name of a request parameter; or an empty Enumeration if the + * request has no parameters + * + */ + public final Enumeration getParameterNames() + { + Vector FullParamOrder = new Vector(); + for (Enumeration enu = queryParamOrder.elements(); enu.hasMoreElements();) { + FullParamOrder.addElement(enu.nextElement()); + } + for (Enumeration enu = bodyParamOrder.elements(); enu.hasMoreElements();) { + FullParamOrder.addElement(enu.nextElement()); + } + return FullParamOrder.elements(); + } + /** * * Returns an Enumeration of String objects containing the names of the * parameters contained in this request. If the request has no parameters, the method returns an empty * Enumeration. * @param parameterType type of parameter - * @see at.gv.egovernment.moa.id.util.ParametersInOrderServlet#QUERY_PARAM - * and @see at.gv.egovernment.moa.id.util.ParametersInOrderServlet#BODY_PARAM * * @return an Enumeration of String objects, each String * containing the name of a request parameter; or an empty Enumeration if the -- cgit v1.2.3