private void setupRequest(byte[] postData, String contentType) throws IOException { FakeHttpServletRequest fakeReq = new FakeHttpServletRequest("/social/rest", "", ""); fakeReq.setPostData(postData); fakeReq.setContentType(contentType); request = fakeReq; }
/** * Sets the a parameter in this fake request. * * @param name the string key * @param values the string array value */ public FakeHttpServletRequest setParameter(String name, String... values) { setParameter(name, false, values); return this; }
public String getParameter(String name) { String[] parameters = getParameterValues(name); if (parameters == null || parameters.length < 1) { return null; } else { return parameters[0]; } }
/** * Sets a single cookie associated with this fake request. Cookies are * cumulative, but ones with the same name will overwrite one another. * * @param c the cookie to associate with this request. */ public FakeHttpServletRequest setCookie(Cookie c) { addToCookieMap(c); setCookieHeader(); return this; }
/** * Example: http://www.example.com:1234/foo/bar?abc=xyz "www.example.com" is * the host 1234 is the port "/foo" is the contextPath "/bar" is the * servletPath "abc=xyz" is the queryString */ public FakeHttpServletRequest(String host, int port, String contextPath, String servletPath, String queryString) { constructor(host, port, contextPath, servletPath, queryString); }
private void setupRequest(byte[] postData, String contentType) throws IOException { FakeHttpServletRequest fakeReq = new FakeHttpServletRequest("/social/rest", "", ""); fakeReq.setPostData(postData); fakeReq.setContentType(contentType); request = fakeReq; }
/** * Sets a single cookie associated with this fake request. Cookies are * cumulative, but ones with the same name will overwrite one another. * * @param c the cookie to associate with this request. */ public FakeHttpServletRequest setCookie(Cookie c) { addToCookieMap(c); setCookieHeader(); return this; }
/** * Sets the a parameter in this fake request. * * @param name the string key * @param values the string array value */ public FakeHttpServletRequest setParameter(String name, String... values) { setParameter(name, false, values); return this; }
public String getParameter(String name) { String[] parameters = getParameterValues(name); if (parameters == null || parameters.length < 1) { return null; } else { return parameters[0]; } }
/** * Example: http://www.example.com:1234/foo/bar?abc=xyz "www.example.com" is * the host 1234 is the port "/foo" is the contextPath "/bar" is the * servletPath "abc=xyz" is the queryString */ public FakeHttpServletRequest(String host, int port, String contextPath, String servletPath, String queryString) { constructor(host, port, contextPath, servletPath, queryString); }
private void setupRequest(byte[] postData, String contentType) throws IOException { FakeHttpServletRequest fakeReq = new FakeHttpServletRequest("/social/rest", "", ""); fakeReq.setPostData(postData); fakeReq.setContentType(contentType); request = fakeReq; }
/** * Sets a single cookie associated with this fake request. Cookies are * cumulative, but ones with the same name will overwrite one another. * * @param c the cookie to associate with this request. */ public FakeHttpServletRequest setCookie(Cookie c) { addToCookieMap(c); setCookieHeader(); return this; }
/** * Sets the a parameter in this fake request. * * @param name the string key * @param values the string array value */ public FakeHttpServletRequest setParameter(String name, String... values) { setParameter(name, false, values); return this; }
public String getParameter(String name) { String[] parameters = getParameterValues(name); if (parameters == null || parameters.length < 1) { return null; } else { return parameters[0]; } }
/** * Example: http://www.example.com:1234/foo/bar?abc=xyz "www.example.com" is * the host 1234 is the port "/foo" is the contextPath "/bar" is the * servletPath "abc=xyz" is the queryString */ public FakeHttpServletRequest(String host, int port, String contextPath, String servletPath, String queryString) { constructor(host, port, contextPath, servletPath, queryString); }
private void setupRequest(byte[] postData, String contentType) throws IOException { FakeHttpServletRequest fakeReq = new FakeHttpServletRequest("/social/rest", "", ""); fakeReq.setPostData(postData); fakeReq.setContentType(contentType); request = fakeReq; }
/** * Sets a single cookie associated with this fake request. Cookies are * cumulative, but ones with the same name will overwrite one another. * * @param c the cookie to associate with this request. */ public FakeHttpServletRequest setCookie(Cookie c) { addToCookieMap(c); setCookieHeader(); return this; }
public String getParameter(String name) { String[] parameters = getParameterValues(name); if (parameters == null || parameters.length < 1) { return null; } else { return parameters[0]; } }
/** * Associates a set of cookies with this fake request. * * @param cookies the cookies associated with this request. */ public FakeHttpServletRequest setCookies(Cookie... cookies) { for (Cookie cookie : cookies) { addToCookieMap(cookie); } setCookieHeader(); return this; }
/** * Associates a set of cookies with this fake request. * * @param cookies the cookies associated with this request. */ public FakeHttpServletRequest setCookies(Cookie... cookies) { for (Cookie cookie : cookies) { addToCookieMap(cookie); } setCookieHeader(); return this; }