Method from org.apache.commons.chain.web.servlet.MockHttpServletRequest Detail: |
public void addCookie(Cookie cookie) {
Cookie[] newValues = new Cookie[cookies.length + 1];
System.arraycopy(cookies, 0, newValues, 0, cookies.length);
cookies = newValues;
cookies[cookies.length - 1] = cookie;
}
|
public void addCookie(String name,
String value) {
addCookie(new Cookie(name, value));
}
|
public void addHeader(String name,
String value) {
// --------------------------------------------------------- Public Methods
String values[] = (String[]) headers.get(name);
if (values == null) {
String results[] = new String[] { value };
headers.put(name, results);
return;
}
String results[] = new String[values.length + 1];
System.arraycopy(values, 0, results, 0, values.length);
results[values.length] = value;
headers.put(name, results);
}
|
public void addParameter(String name,
String value) {
String values[] = (String[]) parameters.get(name);
if (values == null) {
String results[] = new String[] { value };
parameters.put(name, results);
return;
}
String results[] = new String[values.length + 1];
System.arraycopy(values, 0, results, 0, values.length);
results[values.length] = value;
parameters.put(name, results);
}
|
public Object getAttribute(String name) {
return (attributes.get(name));
}
|
public Enumeration getAttributeNames() {
return (new MockEnumeration(attributes.keySet().iterator()));
}
|
public String getAuthType() {
throw new UnsupportedOperationException();
}
|
public String getCharacterEncoding() {
throw new UnsupportedOperationException();
}
|
public int getContentLength() {
throw new UnsupportedOperationException();
}
|
public String getContentType() {
throw new UnsupportedOperationException();
}
|
public String getContextPath() {
return (contextPath);
}
|
public Cookie[] getCookies() {
return cookies;
}
|
public long getDateHeader(String name) {
throw new UnsupportedOperationException();
}
|
public String getHeader(String name) {
String values[] = (String[]) headers.get(name);
if (values != null) {
return (values[0]);
} else {
return (null);
}
}
|
public Enumeration getHeaderNames() {
return (new MockEnumeration(headers.keySet().iterator()));
}
|
public Enumeration getHeaders(String name) {
String headers[] = (String[]) this.headers.get(name);
if (headers == null) {
headers = new String[0];
}
List list = new ArrayList();
for (int i = 0; i < headers.length; i++) {
list.add(headers[i]);
}
return (new MockEnumeration(list.iterator()));
}
|
public ServletInputStream getInputStream() {
throw new UnsupportedOperationException();
}
|
public int getIntHeader(String name) {
throw new UnsupportedOperationException();
}
|
public String getLocalAddr() {
throw new UnsupportedOperationException();
}
|
public String getLocalName() {
throw new UnsupportedOperationException();
}
|
public int getLocalPort() {
throw new UnsupportedOperationException();
}
|
public Locale getLocale() {
return (locale);
}
|
public Enumeration getLocales() {
throw new UnsupportedOperationException();
}
|
public String getMethod() {
throw new UnsupportedOperationException();
}
|
public String getParameter(String name) {
String values[] = (String[]) parameters.get(name);
if (values != null) {
return (values[0]);
} else {
return (null);
}
}
|
public Map getParameterMap() {
return (parameters);
}
|
public Enumeration getParameterNames() {
return (new MockEnumeration(parameters.keySet().iterator()));
}
|
public String[] getParameterValues(String name) {
return ((String[]) parameters.get(name));
}
|
public String getPathInfo() {
return (pathInfo);
}
|
public String getPathTranslated() {
throw new UnsupportedOperationException();
}
|
public String getProtocol() {
throw new UnsupportedOperationException();
}
|
public String getQueryString() {
return (queryString);
}
|
public BufferedReader getReader() {
throw new UnsupportedOperationException();
}
|
public String getRealPath(String path) {
throw new UnsupportedOperationException();
}
|
public String getRemoteAddr() {
throw new UnsupportedOperationException();
}
|
public String getRemoteHost() {
throw new UnsupportedOperationException();
}
|
public int getRemotePort() {
throw new UnsupportedOperationException();
}
|
public String getRemoteUser() {
if (principal != null) {
return (principal.getName());
} else {
return (null);
}
}
|
public RequestDispatcher getRequestDispatcher(String path) {
throw new UnsupportedOperationException();
}
|
public String getRequestURI() {
StringBuffer sb = new StringBuffer();
if (contextPath != null) {
sb.append(contextPath);
}
if (servletPath != null) {
sb.append(servletPath);
}
if (pathInfo != null) {
sb.append(pathInfo);
}
if (sb.length() > 0) {
return (sb.toString());
}
throw new UnsupportedOperationException();
}
|
public StringBuffer getRequestURL() {
throw new UnsupportedOperationException();
}
|
public String getRequestedSessionId() {
throw new UnsupportedOperationException();
}
|
public String getScheme() {
return ("http");
}
|
public String getServerName() {
return ("localhost");
}
|
public int getServerPort() {
return (8080);
}
|
public String getServletPath() {
return (servletPath);
}
|
public HttpSession getSession() {
return (getSession(true));
}
|
public HttpSession getSession(boolean create) {
if (create && (session == null)) {
throw new UnsupportedOperationException();
}
return (session);
}
|
public Principal getUserPrincipal() {
return (principal);
}
|
public boolean isRequestedSessionIdFromCookie() {
throw new UnsupportedOperationException();
}
|
public boolean isRequestedSessionIdFromURL() {
throw new UnsupportedOperationException();
}
|
public boolean isRequestedSessionIdFromUrl() {
throw new UnsupportedOperationException();
}
|
public boolean isRequestedSessionIdValid() {
throw new UnsupportedOperationException();
}
|
public boolean isSecure() {
return (false);
}
|
public boolean isUserInRole(String role) {
if ((principal != null) && (principal instanceof MockPrincipal)) {
return (((MockPrincipal) principal).isUserInRole(role));
} else {
return (false);
}
}
|
public void removeAttribute(String name) {
attributes.remove(name);
}
|
public void setAttribute(String name,
Object value) {
if (value == null) {
attributes.remove(name);
} else {
attributes.put(name, value);
}
}
|
public void setCharacterEncoding(String name) {
throw new UnsupportedOperationException();
}
|
public void setHttpSession(HttpSession session) {
this.session = session;
}
|
public void setLocale(Locale locale) {
this.locale = locale;
}
|
public void setPathElements(String contextPath,
String servletPath,
String pathInfo,
String queryString) {
this.contextPath = contextPath;
this.servletPath = servletPath;
this.pathInfo = pathInfo;
this.queryString = queryString;
}
|
public void setUserPrincipal(Principal principal) {
this.principal = principal;
}
|