fix legacy getHeaderCookies to work with cookies from original

HttpServletRequest, by moving to RequestHeader.
pull/93/head
reger 8 years ago
parent 30f8d1e2d7
commit 60ba5c117c

@ -744,25 +744,6 @@ public class HeaderFramework extends TreeMap<String, String> implements Map<Stri
setCookie( name, value, null, null, null, false);
}
/**
* Gets the header entry "Cookie"
*
* @return String with cookies separated by ';'
*/
public String getHeaderCookies(){
final Iterator<Map.Entry<String, String>> it = entrySet().iterator();
while(it.hasNext())
{
final Map.Entry<String, String> e = it.next();
//System.out.println(""+e.getKey()+" : "+e.getValue());
if(e.getKey().equals("Cookie"))
{
return e.getValue();
}
}
return "";
}
public Vector<Entry> getAdditionalHeaderProperties() {
return this.headerProps;
}

@ -146,6 +146,21 @@ public class RequestHeader extends HeaderFramework implements HttpServletRequest
return false;
}
/**
* Gets the header entry "Cookie" as on string containing all cookies
*
* @return String with cookies separated by ';'
* @see getCookies()
*/
public String getHeaderCookies() { // TODO: harmonize with standard getCookies
String cookiestring = this.get(COOKIE); // get from legacy or HttpServletRequest
if (cookiestring == null) {
return "";
} else {
return cookiestring;
}
}
// implementation of HttpServletRequest procedures
// the general approach is to prefer values in the YaCy legacy RequestHeader.map and if no value exists
// to use the httpservletrequest. This approach is used, because legacy requestheader allows to add or

Loading…
Cancel
Save