package kr.co.udapsoft.ebid.buyer.common.file;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.Principal;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import com.oreilly.servlet.MultipartRequest;

/**
 * 
 *<ul>
 * <li>프  로  그  램 : HttpFileUploadRequest.java</li>
 * <li>프로그램설명 : HttpFileUploadRequest를 HttpServletRequest처럼 사용할 수 있도록 처리한 클래스</li>
 * <li>관련프로그램 : </li>
 * <li>관련  테이블 : </li>
 * <li>작  성  일  자 : </li>
 * <li>수  정  내  역 : </li>
 * <li>참  고  사  항 : </li>
 * </ul>
 * @author 
 */
public class HttpFileUploadRequest implements HttpServletRequest {

	private HttpServletRequest _req;
	private MultipartRequest _mreq;
	private Map _pmap;
	public HttpFileUploadRequest(HttpServletRequest req,MultipartRequest mreq){
		
		_req=req;
		_mreq=mreq;
		
		_pmap=new HashMap();
		Enumeration e=_mreq.getParameterNames();
		while(e.hasMoreElements()){
			Object o=e.nextElement();
			_pmap.put(o, _mreq.getParameterValues((String)o));
		}
		
	}
	public String getAuthType() {
		
		return this._req.getAuthType();
	}

	public String getContextPath() {
		
		return this._req.getContextPath();
	}

	public Cookie[] getCookies() {
		
		return this._req.getCookies();
	}

	public long getDateHeader(String arg0) {
		
		return this._req.getDateHeader(arg0);
	}

	public String getHeader(String arg0) {
		
		return this._req.getHeader(arg0);
	}

	public Enumeration getHeaderNames() {
		
		return this._req.getHeaderNames();
	}

	public Enumeration getHeaders(String arg0) {
		
		return this._req.getHeaders(arg0);
	}

	public int getIntHeader(String arg0) {
		
		return this._req.getIntHeader(arg0);
	}

	public String getMethod() {
		
		return this._req.getMethod();
	}

	public String getPathInfo() {
		
		return this._req.getPathInfo();
	}

	public String getPathTranslated() {
		
		return this._req.getPathTranslated();
	}

	public String getQueryString() {
		
		return this._req.getQueryString();
	}

	public String getRemoteUser() {
		
		return this._req.getRemoteUser();
	}

	public String getRequestedSessionId() {
		
		return this._req.getRequestedSessionId();
	}

	public String getRequestURI() {
		
		return this._req.getRequestURI();
	}

	public StringBuffer getRequestURL() {
		
		return this._req.getRequestURL();
	}

	public String getServletPath() {
		
		return this._req.getServletPath();
	}

	public HttpSession getSession() {
		
		return this._req.getSession();
	}

	public HttpSession getSession(boolean arg0) {
		
		return this._req.getSession(arg0);
	}

	public Principal getUserPrincipal() {
		
		return this._req.getUserPrincipal();
	}

	public boolean isRequestedSessionIdFromCookie() {
		
		return this._req.isRequestedSessionIdFromCookie();
	}

	public boolean isRequestedSessionIdFromUrl() {
		
		return this._req.isRequestedSessionIdFromUrl();
	}

	public boolean isRequestedSessionIdFromURL() {
		
		return this._req.isRequestedSessionIdFromURL();
	}

	public boolean isRequestedSessionIdValid() {
		
		return this._req.isRequestedSessionIdValid();
	}

	public boolean isUserInRole(String arg0) {
		
		return this._req.isUserInRole(arg0);
	}

	public Object getAttribute(String arg0) {
		
		return this._req.getAttribute(arg0);
	}

	public Enumeration getAttributeNames() {
		
		return this._req.getAttributeNames();
	}

	public String getCharacterEncoding() {
		
		return this._req.getCharacterEncoding();
	}

	public int getContentLength() {
		
		return this._req.getContentLength();
	}

	public String getContentType() {
		
		return this._req.getContentType();
	}

	public ServletInputStream getInputStream() throws IOException {
		
		return this._req.getInputStream();
	}

	public String getLocalAddr() {
		
		//return this._req.getLocalAddr();
		return "";
	}

	public Locale getLocale() {
		
		return this._req.getLocale();
	}

	public Enumeration getLocales() {
		
		return this._req.getLocales();
	}

	public String getLocalName() {
		
		//return this._req.getLocalName();
		return "";
	}

	public int getLocalPort() {
		
		//return this._req.getLocalPort();
		return 0;
	}

	public String getParameter(String arg0) {
		
		return this._mreq.getParameter(arg0);
		
		
	}

	public Map getParameterMap() {
		
		return this._pmap;
	}

	public Enumeration getParameterNames() {
		
		return this._mreq.getParameterNames();
		
	}

	public String[] getParameterValues(String arg0) {
		
		return this._mreq.getParameterValues(arg0);
		//return this._req.getParameterValues(arg0);
	}

	public String getProtocol() {
		
		return this._req.getProtocol();
	}

	public BufferedReader getReader() throws IOException, IllegalStateException {
		
		return this._req.getReader();
	}

	public String getRealPath(String arg0) {
		
		return this._req.getRealPath(arg0);
	}

	public String getRemoteAddr() {
		
		return this._req.getRemoteAddr();
	}

	public String getRemoteHost() {
		
		return this._req.getRemoteHost();
	}

	public int getRemotePort() {
		
		//return this._req.getRemotePort();
		return 0;
	}

	public RequestDispatcher getRequestDispatcher(String arg0) {
		
		return this._req.getRequestDispatcher(arg0);
	}

	public String getScheme() {
		
		return this._req.getScheme();
	}

	public String getServerName() {
		
		return this._req.getServerName();
	}

	public int getServerPort() {
		
		return this._req.getServerPort();
	}

	public boolean isSecure() {
		
		return this._req.isSecure();
	}

	public void removeAttribute(String arg0) {
		
		this._req.removeAttribute(arg0);
		
	}

	public void setAttribute(String arg0, Object arg1) {
		
		this._req.setAttribute(arg0,arg1);
	}

	public void setCharacterEncoding(String arg0) throws UnsupportedEncodingException {
		
		this._req.setCharacterEncoding(arg0);
	}
	public File getFile(String prmName){
		return this._mreq.getFile(prmName);
	}
	public String getOriginalFileName(String prmName){
		return this._mreq.getOriginalFileName(prmName);
	}
	public Enumeration getFileNames(){
		return this._mreq.getFileNames();
		
	}
	public String getFileSystemName(String prmName){
		return this._mreq.getFilesystemName(prmName);
	}

}
