All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xqbase.util.servlet.RequestAttributes Maven / Gradle / Ivy

There is a newer version: 0.2.18
Show newest version
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