Trim subrequest
This commit is contained in:
parent
ac2c3eae7e
commit
f2b7846973
|
@ -27,7 +27,8 @@ import java.util.Map;
|
||||||
|
|
||||||
public class ServletSubRequestDetails extends ServletRequestDetails {
|
public class ServletSubRequestDetails extends ServletRequestDetails {
|
||||||
|
|
||||||
private Map<String, List<String>> myHeaders = new HashMap<>();
|
private final ServletRequestDetails myWrap;
|
||||||
|
// private Map<String, List<String>> myHeaders = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -36,40 +37,52 @@ public class ServletSubRequestDetails extends ServletRequestDetails {
|
||||||
*/
|
*/
|
||||||
public ServletSubRequestDetails(ServletRequestDetails theRequestDetails) {
|
public ServletSubRequestDetails(ServletRequestDetails theRequestDetails) {
|
||||||
super(theRequestDetails.getInterceptorBroadcaster());
|
super(theRequestDetails.getInterceptorBroadcaster());
|
||||||
if (theRequestDetails != null) {
|
|
||||||
Map<String, List<String>> headers = theRequestDetails.getHeaders();
|
myWrap = theRequestDetails;
|
||||||
for (Map.Entry<String, List<String>> next : headers.entrySet()) {
|
|
||||||
myHeaders.put(next.getKey().toLowerCase(), next.getValue());
|
// if (theRequestDetails != null) {
|
||||||
}
|
// Map<String, List<String>> headers = theRequestDetails.getHeaders();
|
||||||
}
|
// for (Map.Entry<String, List<String>> next : headers.entrySet()) {
|
||||||
|
// myHeaders.put(next.getKey().toLowerCase(), next.getValue());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHeader(String theName, String theValue) {
|
// public void addHeader(String theName, String theValue) {
|
||||||
String lowerCase = theName.toLowerCase();
|
// String lowerCase = theName.toLowerCase();
|
||||||
List<String> list = myHeaders.get(lowerCase);
|
// List<String> list = myHeaders.get(lowerCase);
|
||||||
if (list == null) {
|
// if (list == null) {
|
||||||
list = new ArrayList<>();
|
// list = new ArrayList<>();
|
||||||
myHeaders.put(lowerCase, list);
|
// myHeaders.put(lowerCase, list);
|
||||||
}
|
// }
|
||||||
list.add(theValue);
|
// list.add(theValue);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHeader(String theName) {
|
public String getHeader(String theName) {
|
||||||
List<String> list = myHeaders.get(theName.toLowerCase());
|
return myWrap.getHeader(theName);
|
||||||
if (list == null || list.isEmpty()) {
|
|
||||||
return null;
|
// List<String> list = myHeaders.get(theName.toLowerCase());
|
||||||
}
|
// if (list == null || list.isEmpty()) {
|
||||||
return list.get(0);
|
// return null;
|
||||||
|
// }
|
||||||
|
// return list.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getHeaders(String theName) {
|
public List<String> getHeaders(String theName) {
|
||||||
List<String> list = myHeaders.get(theName.toLowerCase());
|
return myWrap.getHeaders(theName);
|
||||||
if (list == null || list.isEmpty()) {
|
|
||||||
return null;
|
// List<String> list = myHeaders.get(theName.toLowerCase());
|
||||||
}
|
// if (list == null || list.isEmpty()) {
|
||||||
return list;
|
// return null;
|
||||||
|
// }
|
||||||
|
// return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Object, Object> getUserData() {
|
||||||
|
return myWrap.getUserData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue