request 객체 정보 조회

2024. 7. 27. 22:25Java

 

		log.debug("url: " + request.getRequestURI());
		log.debug("parameter---------------------");
		Enumeration<String> params = request.getParameterNames();
		while(params.hasMoreElements()) {
			String name = (String)params.nextElement();
			if(request.getParameter(name) != null) {
				log.debug(name +": "+ request.getParameter(name));
			}
		}
		log.debug("attribute---------------------");
		Enumeration<String> attributes = request.getAttributeNames();
		while(attributes.hasMoreElements()) {
			String name = (String)attributes.nextElement();
			if(request.getAttribute(name) != null) {
				log.debug(name +": "+ request.getAttribute(name));
			}
		}		
		log.debug("header---------------------");
		Enumeration<String> headers = request.getHeaderNames();
		while(headers.hasMoreElements()) {
			String name = (String)headers.nextElement();
			if(request.getHeader(name) != null) {
				log.debug(name +": "+ request.getHeader(name));
			}
		}

 

'Java' 카테고리의 다른 글

nslookup 구현  (0) 2024.08.23
Class 정보 가져오기  (0) 2024.07.27
java Tip  (0) 2022.02.02
pom.xml 셋팅  (0) 2022.01.31
maven 에러  (0) 2022.01.30