com.xqbase.util.servlet.RequestAttributes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xqbase-util-jdk17 Show documentation
Show all versions of xqbase-util-jdk17 Show documentation
Reusable Java components for www.xqbase.com
package com.xqbase.util.servlet;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RequestAttributes implements WrapperFactory {
private LinkedHashMap attrMap = new LinkedHashMap<>();
public RequestAttributes(ServletContext sc) {
String[] ss = sc.getInitParameter(RequestAttributes.
class.getName() + ".requestAttributes").split(",");
for (String s : ss) {
String[] keyValue = s.split("=", 2);
attrMap.put(keyValue[0], keyValue[1]);
}
}
@Override
public Void getWrapper(HttpServletRequest req, HttpServletResponse resp) {
for (Map.Entry entry : attrMap.entrySet()) {
req.setAttribute(entry.getKey(), entry.getValue());
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy