aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/InOrderServletRequestWrapper.java36
1 files changed, 25 insertions, 11 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/InOrderServletRequestWrapper.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/InOrderServletRequestWrapper.java
index 20f811e39..958ae646e 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/InOrderServletRequestWrapper.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/InOrderServletRequestWrapper.java
@@ -106,9 +106,9 @@ public class InOrderServletRequestWrapper extends HttpServletRequestWrapper {
bodyParameters = new Hashtable();
//Insert code for Query string parsing
- String rawQuery = req.getQueryString();
+ String rawQuery = req.getQueryString();
queryParameters = tokenize(queryParameters, queryParamOrder, rawQuery, DEFAULT_CHARACTER_ENCODING, true);
-
+
//analyze HTTP Post body parameters
if (req.getMethod().equalsIgnoreCase("POST"))
{
@@ -118,6 +118,7 @@ public class InOrderServletRequestWrapper extends HttpServletRequestWrapper {
if (req.getContentType().equals("application/x-www-form-urlencoded"))
{
+
try
{
bodyParameters = parsePostData(bodyParameters, req.getContentLength(), req.getInputStream(), enc);
@@ -217,25 +218,38 @@ public class InOrderServletRequestWrapper extends HttpServletRequestWrapper {
{
String pair = (String) st.nextToken();
int pos = pair.indexOf('=');
- if (pos == -1)
- {
- throw new IllegalArgumentException();
- }
+// if (pos == -1)
+// {
+// throw new IllegalArgumentException();
+// }
try
{
if (decode) {
- key = URLDecoder.decode(pair.substring(0, pos), encoding);
- val = URLDecoder.decode(pair.substring(pos + 1, pair.length()), encoding);
+ if (pos == -1) { // query is not a key=value pair, it is just a key
+ key = URLDecoder.decode(pair, encoding);
+ val = ""; // value is empty string
+ }
+ else {
+ 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());
+ if (pos == -1) { // query is not a key=value pair, it is just a key
+ key = pair;
+ val = ""; // value is empty string
+ }
+ 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)
{
- throw new IllegalArgumentException();
+ Logger.error("Error encoding query", e);
+ throw new IllegalArgumentException();
}
if (ht.containsKey(key))
{