first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package org.apache.struts.upload;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.struts.action.ActionMapping;
|
||||
import org.apache.struts.action.ActionServlet;
|
||||
|
||||
public interface MultipartRequestHandler {
|
||||
public static final String ATTRIBUTE_MAX_LENGTH_EXCEEDED = "org.apache.struts.upload.MaxLengthExceeded";
|
||||
|
||||
void setServlet(ActionServlet paramActionServlet);
|
||||
|
||||
void setMapping(ActionMapping paramActionMapping);
|
||||
|
||||
ActionServlet getServlet();
|
||||
|
||||
ActionMapping getMapping();
|
||||
|
||||
void handleRequest(HttpServletRequest paramHttpServletRequest) throws ServletException;
|
||||
|
||||
Hashtable getTextElements();
|
||||
|
||||
Hashtable getFileElements();
|
||||
|
||||
Hashtable getAllElements();
|
||||
|
||||
void rollback();
|
||||
|
||||
void finish();
|
||||
}
|
258
hrmsEjb/org/apache/struts/upload/MultipartRequestWrapper.java
Normal file
258
hrmsEjb/org/apache/struts/upload/MultipartRequestWrapper.java
Normal file
@@ -0,0 +1,258 @@
|
||||
package org.apache.struts.upload;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.security.Principal;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
public class MultipartRequestWrapper implements HttpServletRequest {
|
||||
protected Map parameters;
|
||||
|
||||
protected HttpServletRequest request;
|
||||
|
||||
public MultipartRequestWrapper(HttpServletRequest request) {
|
||||
this.request = request;
|
||||
this.parameters = new HashMap();
|
||||
}
|
||||
|
||||
public void setParameter(String name, String value) {
|
||||
String[] mValue = (String[])this.parameters.get(name);
|
||||
if (mValue == null)
|
||||
mValue = new String[0];
|
||||
String[] newValue = new String[mValue.length + 1];
|
||||
System.arraycopy(mValue, 0, newValue, 0, mValue.length);
|
||||
newValue[mValue.length] = value;
|
||||
this.parameters.put(name, newValue);
|
||||
}
|
||||
|
||||
public String getParameter(String name) {
|
||||
String value = this.request.getParameter(name);
|
||||
if (value == null) {
|
||||
String[] mValue = (String[])this.parameters.get(name);
|
||||
if (mValue != null && mValue.length > 0)
|
||||
value = mValue[0];
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public Enumeration getParameterNames() {
|
||||
Enumeration baseParams = this.request.getParameterNames();
|
||||
Vector list = new Vector();
|
||||
while (baseParams.hasMoreElements())
|
||||
list.add(baseParams.nextElement());
|
||||
Collection multipartParams = this.parameters.keySet();
|
||||
Iterator iterator = multipartParams.iterator();
|
||||
while (iterator.hasNext())
|
||||
list.add(iterator.next());
|
||||
return Collections.enumeration(list);
|
||||
}
|
||||
|
||||
public String[] getParameterValues(String name) {
|
||||
String[] value = this.request.getParameterValues(name);
|
||||
if (value == null)
|
||||
value = (String[])this.parameters.get(name);
|
||||
return value;
|
||||
}
|
||||
|
||||
public HttpServletRequest getRequest() {
|
||||
return this.request;
|
||||
}
|
||||
|
||||
public Object getAttribute(String name) {
|
||||
return this.request.getAttribute(name);
|
||||
}
|
||||
|
||||
public Enumeration getAttributeNames() {
|
||||
return this.request.getAttributeNames();
|
||||
}
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return this.request.getCharacterEncoding();
|
||||
}
|
||||
|
||||
public int getContentLength() {
|
||||
return this.request.getContentLength();
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return this.request.getContentType();
|
||||
}
|
||||
|
||||
public ServletInputStream getInputStream() throws IOException {
|
||||
return this.request.getInputStream();
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return this.request.getProtocol();
|
||||
}
|
||||
|
||||
public String getScheme() {
|
||||
return this.request.getScheme();
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
return this.request.getServerName();
|
||||
}
|
||||
|
||||
public int getServerPort() {
|
||||
return this.request.getServerPort();
|
||||
}
|
||||
|
||||
public BufferedReader getReader() throws IOException {
|
||||
return this.request.getReader();
|
||||
}
|
||||
|
||||
public String getRemoteAddr() {
|
||||
return this.request.getRemoteAddr();
|
||||
}
|
||||
|
||||
public String getRemoteHost() {
|
||||
return this.request.getRemoteHost();
|
||||
}
|
||||
|
||||
public void setAttribute(String name, Object o) {
|
||||
this.request.setAttribute(name, o);
|
||||
}
|
||||
|
||||
public void removeAttribute(String name) {
|
||||
this.request.removeAttribute(name);
|
||||
}
|
||||
|
||||
public Locale getLocale() {
|
||||
return this.request.getLocale();
|
||||
}
|
||||
|
||||
public Enumeration getLocales() {
|
||||
return this.request.getLocales();
|
||||
}
|
||||
|
||||
public boolean isSecure() {
|
||||
return this.request.isSecure();
|
||||
}
|
||||
|
||||
public RequestDispatcher getRequestDispatcher(String path) {
|
||||
return this.request.getRequestDispatcher(path);
|
||||
}
|
||||
|
||||
public String getRealPath(String path) {
|
||||
return this.request.getRealPath(path);
|
||||
}
|
||||
|
||||
public String getAuthType() {
|
||||
return this.request.getAuthType();
|
||||
}
|
||||
|
||||
public Cookie[] getCookies() {
|
||||
return this.request.getCookies();
|
||||
}
|
||||
|
||||
public long getDateHeader(String name) {
|
||||
return this.request.getDateHeader(name);
|
||||
}
|
||||
|
||||
public String getHeader(String name) {
|
||||
return this.request.getHeader(name);
|
||||
}
|
||||
|
||||
public Enumeration getHeaders(String name) {
|
||||
return this.request.getHeaders(name);
|
||||
}
|
||||
|
||||
public Enumeration getHeaderNames() {
|
||||
return this.request.getHeaderNames();
|
||||
}
|
||||
|
||||
public int getIntHeader(String name) {
|
||||
return this.request.getIntHeader(name);
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return this.request.getMethod();
|
||||
}
|
||||
|
||||
public String getPathInfo() {
|
||||
return this.request.getPathInfo();
|
||||
}
|
||||
|
||||
public String getPathTranslated() {
|
||||
return this.request.getPathTranslated();
|
||||
}
|
||||
|
||||
public String getContextPath() {
|
||||
return this.request.getContextPath();
|
||||
}
|
||||
|
||||
public String getQueryString() {
|
||||
return this.request.getQueryString();
|
||||
}
|
||||
|
||||
public String getRemoteUser() {
|
||||
return this.request.getRemoteUser();
|
||||
}
|
||||
|
||||
public boolean isUserInRole(String user) {
|
||||
return this.request.isUserInRole(user);
|
||||
}
|
||||
|
||||
public Principal getUserPrincipal() {
|
||||
return this.request.getUserPrincipal();
|
||||
}
|
||||
|
||||
public String getRequestedSessionId() {
|
||||
return this.request.getRequestedSessionId();
|
||||
}
|
||||
|
||||
public String getRequestURI() {
|
||||
return this.request.getRequestURI();
|
||||
}
|
||||
|
||||
public String getServletPath() {
|
||||
return this.request.getServletPath();
|
||||
}
|
||||
|
||||
public HttpSession getSession(boolean create) {
|
||||
return this.request.getSession(create);
|
||||
}
|
||||
|
||||
public HttpSession getSession() {
|
||||
return this.request.getSession();
|
||||
}
|
||||
|
||||
public boolean isRequestedSessionIdValid() {
|
||||
return this.request.isRequestedSessionIdValid();
|
||||
}
|
||||
|
||||
public boolean isRequestedSessionIdFromURL() {
|
||||
return this.request.isRequestedSessionIdFromURL();
|
||||
}
|
||||
|
||||
public boolean isRequestedSessionIdFromUrl() {
|
||||
return this.request.isRequestedSessionIdFromUrl();
|
||||
}
|
||||
|
||||
public Map getParameterMap() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCharacterEncoding(String encoding) {}
|
||||
|
||||
public StringBuffer getRequestURL() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isRequestedSessionIdFromCookie() {
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user