コード例 #1
0
  public void testCreateRequest() throws Exception {
    MockHttpServletRequestImpl request = context_.createRequest("/hello.html");
    assertEquals("1", "/s2jsf-example", request.getContextPath());
    assertEquals("2", "/hello.html", request.getServletPath());

    request = context_.createRequest("/hello.html?aaa=hoge");
    assertEquals("3", "aaa=hoge", request.getQueryString());
  }
コード例 #2
0
 public MockHttpServletRequest createRequest(String path) {
   String queryString = null;
   int question = path.indexOf('?');
   if (question >= 0) {
     queryString = path.substring(question + 1);
     path = path.substring(0, question);
   }
   MockHttpServletRequestImpl request = new MockHttpServletRequestImpl(this, path);
   request.setQueryString(queryString);
   return request;
 }