Code example for Dictionary

Methods: get

0
    wrapper.setContentType("text/plain");
    wrapper.getWriter().write("Lorum lipsum.");
    Dictionary<String, String> headers = wrapper.getResponseHeaders();
    assertEquals(200, wrapper.getResponseStatus()); // Default code should be 200
    assertEquals(false, wrapper.isCommitted()); // Should always be false!
    assertEquals("bar", headers.get("foo"));
    assertEquals("beta", headers.get("alfa"));
    assertEquals("42", headers.get("life"));
    assertEquals("text/plain", wrapper.getContentType());
    assertEquals("text/plain", headers.get("Content-Type"));
    assertEquals("42", headers.get("life"));
    assertEquals("Lorum lipsum.", wrapper.getDataAsString());
     
    // test UTF-8 
    wrapper = new ResponseWrapper(response);
    wrapper.getWriter().write("事业单位改革工作座谈会在京召开");
    assertEquals("事业单位改革工作座谈会在京召开", wrapper.getDataAsString());
    // Test status codes 
    wrapper.sendError(404);
    assertEquals(404, wrapper.getResponseStatus());
Stop searching for code, let great code find you!  Add Codota to your java IDE