aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java
diff options
context:
space:
mode:
authorkstranacher <kstranacher@d688527b-c9ab-4aba-bd8d-4036d912da1d>2011-01-24 13:51:25 +0000
committerkstranacher <kstranacher@d688527b-c9ab-4aba-bd8d-4036d912da1d>2011-01-24 13:51:25 +0000
commit9419526705fcc60555a686c3c91bc45d06efe739 (patch)
tree36d0d978edb2c82db87eed3275cca79beeb5b80a /id/server/idserverlib/src/main/java
parente3e957865676e8d4fe5893fa43e9a23fa33824ab (diff)
downloadmoa-id-spss-9419526705fcc60555a686c3c91bc45d06efe739.tar.gz
moa-id-spss-9419526705fcc60555a686c3c91bc45d06efe739.tar.bz2
moa-id-spss-9419526705fcc60555a686c3c91bc45d06efe739.zip
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1194 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'id/server/idserverlib/src/main/java')
-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))
{