Java Code Examples for org.apache.catalina.connector.Response#setConnector()
The following examples show how to use
org.apache.catalina.connector.Response#setConnector() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebappAuthenticationValveTest.java From carbon-device-mgt with Apache License 2.0 | 6 votes |
@Test(description = "This method tests the behaviour of the invoke method of WebAuthenticationValve when " + "secured endpoints are invoked.") public void testInvokeSecuredEndpoints() throws NoSuchFieldException, IllegalAccessException { String encodedString = new String(Base64.getEncoder().encode((ADMIN_USER + ":" + ADMIN_USER).getBytes())); Request request = createRequest("basic " + encodedString); webappAuthenticationValve.invoke(request, null, compositeValve); encodedString = new String(Base64.getEncoder().encode((ADMIN_USER + ":" + ADMIN_USER + "test").getBytes())); request = createRequest("basic " + encodedString); Response response = new Response(); org.apache.coyote.Response coyoteResponse = new org.apache.coyote.Response(); Connector connector = new Connector(); response.setConnector(connector); response.setCoyoteResponse(coyoteResponse); webappAuthenticationValve.invoke(request, response, compositeValve); Assert.assertEquals(response.getStatus(), HttpServletResponse.SC_UNAUTHORIZED, "Response of un-authorized request is not updated"); }
Example 2
Source File: WebappAuthenticationValveTest.java From carbon-device-mgt with Apache License 2.0 | 5 votes |
@Test(description = "This method tests the behaviour of invoke method when the request does not satisfy any " + "authenticator requirements") public void testInvokeWithoutProperAuthenticator() throws NoSuchFieldException, IllegalAccessException { Request request = createRequest("basic"); Response response = new Response(); org.apache.coyote.Response coyoteResponse = new org.apache.coyote.Response(); Connector connector = new Connector(); response.setConnector(connector); response.setCoyoteResponse(coyoteResponse); webappAuthenticationValve.invoke(request, response, compositeValve); Assert.assertEquals(response.getStatus(), HttpServletResponse.SC_UNAUTHORIZED, "Response of un-authorized request is not updated"); }