Changes to run vivo on tomcat 7. NIHVIVO-2451
This commit is contained in:
parent
a30f4a4714
commit
9994b120da
4 changed files with 227 additions and 602 deletions
|
@ -2,21 +2,13 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.controller;
|
package edu.cornell.mannlib.vitro.webapp.controller;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.security.Principal;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
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.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpServletRequestWrapper;
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.query.Dataset;
|
import com.hp.hpl.jena.query.Dataset;
|
||||||
|
@ -24,8 +16,8 @@ import com.hp.hpl.jena.query.Dataset;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao;
|
||||||
|
//HttpServletRequest
|
||||||
public class VitroRequest implements HttpServletRequest {
|
public class VitroRequest extends HttpServletRequestWrapper {
|
||||||
|
|
||||||
private static final String FROM_ENCODING = "ISO-8859-1";
|
private static final String FROM_ENCODING = "ISO-8859-1";
|
||||||
private static final String TO_ENCODING = "UTF-8";
|
private static final String TO_ENCODING = "UTF-8";
|
||||||
|
@ -46,6 +38,7 @@ public class VitroRequest implements HttpServletRequest {
|
||||||
private boolean isSinglePortal;
|
private boolean isSinglePortal;
|
||||||
|
|
||||||
public VitroRequest(HttpServletRequest _req) {
|
public VitroRequest(HttpServletRequest _req) {
|
||||||
|
super(_req);
|
||||||
if( _req == null )
|
if( _req == null )
|
||||||
throw new IllegalArgumentException("Non-null HttpServletRequest needed" +
|
throw new IllegalArgumentException("Non-null HttpServletRequest needed" +
|
||||||
"to construct a VitroRequest");
|
"to construct a VitroRequest");
|
||||||
|
@ -220,212 +213,212 @@ public class VitroRequest implements HttpServletRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *********** delegated methods *********** */
|
/* *********** delegated methods *********** */
|
||||||
public Object getAttribute(String name) {
|
// public Object getAttribute(String name) {
|
||||||
return _req.getAttribute(name);
|
// return _req.getAttribute(name);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Enumeration getAttributeNames() {
|
// public Enumeration getAttributeNames() {
|
||||||
return _req.getAttributeNames();
|
// return _req.getAttributeNames();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getAuthType() {
|
// public String getAuthType() {
|
||||||
return _req.getAuthType();
|
// return _req.getAuthType();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getCharacterEncoding() {
|
// public String getCharacterEncoding() {
|
||||||
return _req.getCharacterEncoding();
|
// return _req.getCharacterEncoding();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public int getContentLength() {
|
// public int getContentLength() {
|
||||||
return _req.getContentLength();
|
// return _req.getContentLength();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getContentType() {
|
// public String getContentType() {
|
||||||
return _req.getContentType();
|
// return _req.getContentType();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getContextPath() {
|
// public String getContextPath() {
|
||||||
return _req.getContextPath();
|
// return _req.getContextPath();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Cookie[] getCookies() {
|
// public Cookie[] getCookies() {
|
||||||
return _req.getCookies();
|
// return _req.getCookies();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public long getDateHeader(String name) {
|
// public long getDateHeader(String name) {
|
||||||
return _req.getDateHeader(name);
|
// return _req.getDateHeader(name);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getHeader(String name) {
|
// public String getHeader(String name) {
|
||||||
return _req.getHeader(name);
|
// return _req.getHeader(name);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Enumeration getHeaderNames() {
|
// public Enumeration getHeaderNames() {
|
||||||
return _req.getHeaderNames();
|
// return _req.getHeaderNames();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Enumeration getHeaders(String name) {
|
// public Enumeration getHeaders(String name) {
|
||||||
return _req.getHeaders(name);
|
// return _req.getHeaders(name);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public ServletInputStream getInputStream() throws IOException {
|
// public ServletInputStream getInputStream() throws IOException {
|
||||||
return _req.getInputStream();
|
// return _req.getInputStream();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public int getIntHeader(String name) {
|
// public int getIntHeader(String name) {
|
||||||
return _req.getIntHeader(name);
|
// return _req.getIntHeader(name);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getLocalAddr() {
|
// public String getLocalAddr() {
|
||||||
return _req.getLocalAddr();
|
// return _req.getLocalAddr();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Locale getLocale() {
|
// public Locale getLocale() {
|
||||||
return _req.getLocale();
|
// return _req.getLocale();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Enumeration getLocales() {
|
// public Enumeration getLocales() {
|
||||||
return _req.getLocales();
|
// return _req.getLocales();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getLocalName() {
|
// public String getLocalName() {
|
||||||
return _req.getLocalName();
|
// return _req.getLocalName();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public int getLocalPort() {
|
// public int getLocalPort() {
|
||||||
return _req.getLocalPort();
|
// return _req.getLocalPort();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getMethod() {
|
// public String getMethod() {
|
||||||
return _req.getMethod();
|
// return _req.getMethod();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Enumeration getParameterNames() {
|
// public Enumeration getParameterNames() {
|
||||||
return _req.getParameterNames();
|
// return _req.getParameterNames();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getPathInfo() {
|
// public String getPathInfo() {
|
||||||
return _req.getPathInfo();
|
// return _req.getPathInfo();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getPathTranslated() {
|
// public String getPathTranslated() {
|
||||||
return _req.getPathTranslated();
|
// return _req.getPathTranslated();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getProtocol() {
|
// public String getProtocol() {
|
||||||
return _req.getProtocol();
|
// return _req.getProtocol();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getQueryString() {
|
// public String getQueryString() {
|
||||||
return _req.getQueryString();
|
// return _req.getQueryString();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public BufferedReader getReader() throws IOException {
|
// public BufferedReader getReader() throws IOException {
|
||||||
return _req.getReader();
|
// return _req.getReader();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Deprecated
|
// @Deprecated
|
||||||
public String getRealPath(String path) {
|
// public String getRealPath(String path) {
|
||||||
return _req.getRealPath(path);
|
// return _req.getRealPath(path);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getRemoteAddr() {
|
// public String getRemoteAddr() {
|
||||||
return _req.getRemoteAddr();
|
// return _req.getRemoteAddr();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getRemoteHost() {
|
// public String getRemoteHost() {
|
||||||
return _req.getRemoteHost();
|
// return _req.getRemoteHost();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public int getRemotePort() {
|
// public int getRemotePort() {
|
||||||
return _req.getRemotePort();
|
// return _req.getRemotePort();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getRemoteUser() {
|
// public String getRemoteUser() {
|
||||||
return _req.getRemoteUser();
|
// return _req.getRemoteUser();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public RequestDispatcher getRequestDispatcher(String path) {
|
// public RequestDispatcher getRequestDispatcher(String path) {
|
||||||
return _req.getRequestDispatcher(path);
|
// return _req.getRequestDispatcher(path);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getRequestedSessionId() {
|
// public String getRequestedSessionId() {
|
||||||
return _req.getRequestedSessionId();
|
// return _req.getRequestedSessionId();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getRequestURI() {
|
// public String getRequestURI() {
|
||||||
return _req.getRequestURI();
|
// return _req.getRequestURI();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public StringBuffer getRequestURL() {
|
// public StringBuffer getRequestURL() {
|
||||||
return _req.getRequestURL();
|
// return _req.getRequestURL();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getScheme() {
|
// public String getScheme() {
|
||||||
return _req.getScheme();
|
// return _req.getScheme();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getServerName() {
|
// public String getServerName() {
|
||||||
return _req.getServerName();
|
// return _req.getServerName();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public int getServerPort() {
|
// public int getServerPort() {
|
||||||
return _req.getServerPort();
|
// return _req.getServerPort();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getServletPath() {
|
// public String getServletPath() {
|
||||||
return _req.getServletPath();
|
// return _req.getServletPath();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public HttpSession getSession() {
|
// public HttpSession getSession() {
|
||||||
return _req.getSession();
|
// return _req.getSession();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public HttpSession getSession(boolean create) {
|
// public HttpSession getSession(boolean create) {
|
||||||
return _req.getSession(create);
|
// return _req.getSession(create);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Principal getUserPrincipal() {
|
// public Principal getUserPrincipal() {
|
||||||
return _req.getUserPrincipal();
|
// return _req.getUserPrincipal();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isRequestedSessionIdFromCookie() {
|
// public boolean isRequestedSessionIdFromCookie() {
|
||||||
return _req.isRequestedSessionIdFromCookie();
|
// return _req.isRequestedSessionIdFromCookie();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Deprecated
|
// @Deprecated
|
||||||
public boolean isRequestedSessionIdFromUrl() {
|
// public boolean isRequestedSessionIdFromUrl() {
|
||||||
return _req.isRequestedSessionIdFromUrl();
|
// return _req.isRequestedSessionIdFromUrl();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isRequestedSessionIdFromURL() {
|
// public boolean isRequestedSessionIdFromURL() {
|
||||||
return _req.isRequestedSessionIdFromURL();
|
// return _req.isRequestedSessionIdFromURL();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isRequestedSessionIdValid() {
|
// public boolean isRequestedSessionIdValid() {
|
||||||
return _req.isRequestedSessionIdValid();
|
// return _req.isRequestedSessionIdValid();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isSecure() {
|
// public boolean isSecure() {
|
||||||
return _req.isSecure();
|
// return _req.isSecure();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isUserInRole(String role) {
|
// public boolean isUserInRole(String role) {
|
||||||
return _req.isUserInRole(role);
|
// return _req.isUserInRole(role);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void removeAttribute(String name) {
|
// public void removeAttribute(String name) {
|
||||||
_req.removeAttribute(name);
|
// _req.removeAttribute(name);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setAttribute(String name, Object o) {
|
// public void setAttribute(String name, Object o) {
|
||||||
_req.setAttribute(name, o);
|
// _req.setAttribute(name, o);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setCharacterEncoding(String env)
|
// public void setCharacterEncoding(String env)
|
||||||
throws UnsupportedEncodingException {
|
// throws UnsupportedEncodingException {
|
||||||
_req.setCharacterEncoding(env);
|
// _req.setCharacterEncoding(env);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletInputStream;
|
import javax.servlet.ServletInputStream;
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletRequestWrapper;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.apache.commons.fileupload.FileItem;
|
import org.apache.commons.fileupload.FileItem;
|
||||||
|
@ -51,7 +52,7 @@ import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class FileUploadServletRequest implements HttpServletRequest {
|
public abstract class FileUploadServletRequest extends HttpServletRequestWrapper {
|
||||||
public static final String FILE_ITEM_MAP = "file_item_map";
|
public static final String FILE_ITEM_MAP = "file_item_map";
|
||||||
public static final String FILE_UPLOAD_EXCEPTION = "file_upload_exception";
|
public static final String FILE_UPLOAD_EXCEPTION = "file_upload_exception";
|
||||||
|
|
||||||
|
@ -79,6 +80,7 @@ public abstract class FileUploadServletRequest implements HttpServletRequest {
|
||||||
private final HttpServletRequest delegate;
|
private final HttpServletRequest delegate;
|
||||||
|
|
||||||
public FileUploadServletRequest(HttpServletRequest delegate) {
|
public FileUploadServletRequest(HttpServletRequest delegate) {
|
||||||
|
super(delegate);
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,259 +119,4 @@ public abstract class FileUploadServletRequest implements HttpServletRequest {
|
||||||
*/
|
*/
|
||||||
public abstract FileUploadException getFileUploadException();
|
public abstract FileUploadException getFileUploadException();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// Delegated methods.
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAuthType() {
|
|
||||||
return delegate.getAuthType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getContextPath() {
|
|
||||||
return delegate.getContextPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Cookie[] getCookies() {
|
|
||||||
return delegate.getCookies();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getDateHeader(String name) {
|
|
||||||
return delegate.getDateHeader(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getHeader(String name) {
|
|
||||||
return delegate.getHeader(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Enumeration<?> getHeaderNames() {
|
|
||||||
return delegate.getHeaderNames();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Enumeration<?> getHeaders(String name) {
|
|
||||||
return delegate.getHeaders(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getIntHeader(String name) {
|
|
||||||
return delegate.getIntHeader(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMethod() {
|
|
||||||
return delegate.getMethod();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPathInfo() {
|
|
||||||
return delegate.getPathInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPathTranslated() {
|
|
||||||
return delegate.getPathTranslated();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getQueryString() {
|
|
||||||
return delegate.getQueryString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRemoteUser() {
|
|
||||||
return delegate.getRemoteUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRequestURI() {
|
|
||||||
return delegate.getRequestURI();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public StringBuffer getRequestURL() {
|
|
||||||
return delegate.getRequestURL();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRequestedSessionId() {
|
|
||||||
return delegate.getRequestedSessionId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getServletPath() {
|
|
||||||
return delegate.getServletPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HttpSession getSession() {
|
|
||||||
return delegate.getSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HttpSession getSession(boolean create) {
|
|
||||||
return delegate.getSession(create);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Principal getUserPrincipal() {
|
|
||||||
return delegate.getUserPrincipal();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRequestedSessionIdFromCookie() {
|
|
||||||
return delegate.isRequestedSessionIdFromCookie();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRequestedSessionIdFromURL() {
|
|
||||||
return delegate.isRequestedSessionIdFromURL();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRequestedSessionIdFromUrl() {
|
|
||||||
return delegate.isRequestedSessionIdFromUrl();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRequestedSessionIdValid() {
|
|
||||||
return delegate.isRequestedSessionIdValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUserInRole(String role) {
|
|
||||||
return delegate.isUserInRole(role);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getAttribute(String name) {
|
|
||||||
return delegate.getAttribute(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Enumeration<?> getAttributeNames() {
|
|
||||||
return delegate.getAttributeNames();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCharacterEncoding() {
|
|
||||||
return delegate.getCharacterEncoding();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getContentLength() {
|
|
||||||
return delegate.getContentLength();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getContentType() {
|
|
||||||
return delegate.getContentType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServletInputStream getInputStream() throws IOException {
|
|
||||||
return delegate.getInputStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLocalAddr() {
|
|
||||||
return delegate.getLocalAddr();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLocalName() {
|
|
||||||
return delegate.getLocalName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLocalPort() {
|
|
||||||
return delegate.getLocalPort();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Locale getLocale() {
|
|
||||||
return delegate.getLocale();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Enumeration<?> getLocales() {
|
|
||||||
return delegate.getLocales();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProtocol() {
|
|
||||||
return delegate.getProtocol();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BufferedReader getReader() throws IOException {
|
|
||||||
return delegate.getReader();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRealPath(String path) {
|
|
||||||
return delegate.getRealPath(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRemoteAddr() {
|
|
||||||
return delegate.getRemoteAddr();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRemoteHost() {
|
|
||||||
return delegate.getRemoteHost();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRemotePort() {
|
|
||||||
return delegate.getRemotePort();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RequestDispatcher getRequestDispatcher(String path) {
|
|
||||||
return delegate.getRequestDispatcher(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getScheme() {
|
|
||||||
return delegate.getScheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getServerName() {
|
|
||||||
return delegate.getServerName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getServerPort() {
|
|
||||||
return delegate.getServerPort();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSecure() {
|
|
||||||
return delegate.isSecure();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeAttribute(String name) {
|
|
||||||
delegate.removeAttribute(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAttribute(String name, Object o) {
|
|
||||||
delegate.setAttribute(name, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCharacterEncoding(String env)
|
|
||||||
throws UnsupportedEncodingException {
|
|
||||||
delegate.setCharacterEncoding(env);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,19 +2,16 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.filters;
|
package edu.cornell.mannlib.vitro.webapp.filters;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletResponse;
|
||||||
import javax.servlet.http.Cookie;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpServletResponseWrapper;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -25,7 +22,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapper;
|
import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapper;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapperFactory;
|
import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapperFactory;
|
||||||
|
|
||||||
public class URLRewritingHttpServletResponse implements HttpServletResponse {
|
public class URLRewritingHttpServletResponse extends HttpServletResponseWrapper/*implements HttpServletResponse */{
|
||||||
|
|
||||||
private final static Log log = LogFactory.getLog(URLRewritingHttpServletResponse.class);
|
private final static Log log = LogFactory.getLog(URLRewritingHttpServletResponse.class);
|
||||||
|
|
||||||
|
@ -36,35 +33,16 @@ public class URLRewritingHttpServletResponse implements HttpServletResponse {
|
||||||
private Pattern slashPattern = Pattern.compile("/");
|
private Pattern slashPattern = Pattern.compile("/");
|
||||||
|
|
||||||
public URLRewritingHttpServletResponse(HttpServletResponse response, HttpServletRequest request, ServletContext context) {
|
public URLRewritingHttpServletResponse(HttpServletResponse response, HttpServletRequest request, ServletContext context) {
|
||||||
|
super(response);
|
||||||
this._response = response;
|
this._response = response;
|
||||||
this._context = context;
|
this._context = context;
|
||||||
this.wadf = (WebappDaoFactory) context.getAttribute("webappDaoFactory");
|
this.wadf = (WebappDaoFactory) context.getAttribute("webappDaoFactory");
|
||||||
this.contextPathDepth = slashPattern.split(request.getContextPath()).length-1;
|
this.contextPathDepth = slashPattern.split(request.getContextPath()).length-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** for testing. */
|
||||||
* For use in testing only.
|
protected URLRewritingHttpServletResponse(HttpServletResponse res){
|
||||||
*/
|
super(res);
|
||||||
protected URLRewritingHttpServletResponse(){ }
|
|
||||||
|
|
||||||
public void addCookie(Cookie arg0) {
|
|
||||||
_response.addCookie(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addDateHeader(String arg0, long arg1) {
|
|
||||||
_response.addDateHeader(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addHeader(String arg0, String arg1) {
|
|
||||||
_response.addHeader(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addIntHeader(String arg0, int arg1) {
|
|
||||||
_response.addIntHeader(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean containsHeader(String arg0) {
|
|
||||||
return _response.containsHeader(arg0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -223,101 +201,6 @@ public class URLRewritingHttpServletResponse implements HttpServletResponse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flushBuffer() throws IOException {
|
|
||||||
_response.flushBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBufferSize() {
|
|
||||||
return _response.getBufferSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCharacterEncoding() {
|
|
||||||
return _response.getCharacterEncoding();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContentType() {
|
|
||||||
return _response.getContentType();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Locale getLocale() {
|
|
||||||
return _response.getLocale();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServletOutputStream getOutputStream() throws IOException {
|
|
||||||
return _response.getOutputStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
public PrintWriter getWriter() throws IOException {
|
|
||||||
return _response.getWriter();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCommitted() {
|
|
||||||
return _response.isCommitted();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reset() {
|
|
||||||
_response.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetBuffer() {
|
|
||||||
_response.resetBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendError(int arg0, String arg1) throws IOException {
|
|
||||||
_response.sendError(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendError(int arg0) throws IOException {
|
|
||||||
_response.sendError(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendRedirect(String arg0) throws IOException {
|
|
||||||
_response.sendRedirect(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBufferSize(int arg0) {
|
|
||||||
_response.setBufferSize(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCharacterEncoding(String arg0) {
|
|
||||||
_response.setCharacterEncoding(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContentLength(int arg0) {
|
|
||||||
_response.setContentLength(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContentType(String arg0) {
|
|
||||||
_response.setContentType(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateHeader(String arg0, long arg1) {
|
|
||||||
_response.setDateHeader(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeader(String arg0, String arg1) {
|
|
||||||
_response.setHeader(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIntHeader(String arg0, int arg1) {
|
|
||||||
_response.setIntHeader(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocale(Locale arg0) {
|
|
||||||
_response.setLocale(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
public void setStatus(int arg0, String arg1) {
|
|
||||||
_response.setStatus(arg0, arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(int arg0) {
|
|
||||||
_response.setStatus(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isExternallyLinkedNamespace(String namespace,List<String> externallyLinkedNamespaces) {
|
private boolean isExternallyLinkedNamespace(String namespace,List<String> externallyLinkedNamespaces) {
|
||||||
return externallyLinkedNamespaces.contains(namespace);
|
return externallyLinkedNamespaces.contains(namespace);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ package edu.cornell.mannlib.vitro.webapp.filters;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.ServletResponse;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -23,7 +25,7 @@ public class URLRewritingHttpServletResponseTest {
|
||||||
* with no portals.
|
* with no portals.
|
||||||
*/
|
*/
|
||||||
protected void urlEncodingStyleA(String urlToEncode, String expectedUrlResult ){
|
protected void urlEncodingStyleA(String urlToEncode, String expectedUrlResult ){
|
||||||
URLRewritingHttpServletResponse urhsr = new URLRewritingHttpServletResponse();
|
URLRewritingHttpServletResponse urhsr = new URLRewritingHttpServletResponse(new stubs.javax.servlet.http.HttpServletResponseStub());
|
||||||
|
|
||||||
List<String>externalNamespaces = new ArrayList();
|
List<String>externalNamespaces = new ArrayList();
|
||||||
externalNamespaces.add("http://vivo.med.cornell.edu/individual/");
|
externalNamespaces.add("http://vivo.med.cornell.edu/individual/");
|
||||||
|
@ -41,7 +43,7 @@ public class URLRewritingHttpServletResponseTest {
|
||||||
* URL like http://caruso.mannlib.cornell.edu/ with no portals.
|
* URL like http://caruso.mannlib.cornell.edu/ with no portals.
|
||||||
*/
|
*/
|
||||||
protected void urlEncodingStyleB(String urlToEncode, String expectedUrlResult){
|
protected void urlEncodingStyleB(String urlToEncode, String expectedUrlResult){
|
||||||
URLRewritingHttpServletResponse urhsr = new URLRewritingHttpServletResponse();
|
URLRewritingHttpServletResponse urhsr = new URLRewritingHttpServletResponse(new stubs.javax.servlet.http.HttpServletResponseStub());
|
||||||
|
|
||||||
List<String>externalNamespaces = new ArrayList();
|
List<String>externalNamespaces = new ArrayList();
|
||||||
externalNamespaces.add("http://vivo.med.cornell.edu/individual/");
|
externalNamespaces.add("http://vivo.med.cornell.edu/individual/");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue