use of org.glassfish.jersey.apache.connector.ApacheConnectorProvider in project jersey by jersey.
the class RestrictedHeaderTest method testForbiddenHeadersWithApacheConnector.
/**
* Same as {@link #testForbiddenHeadersAllowed()} ()} but uses {@link org.glassfish.jersey.apache.connector
* .ApacheConnector} connector
* which allows modification of these headers.
*/
@Test
public void testForbiddenHeadersWithApacheConnector() {
ClientConfig clientConfig = new ClientConfig();
clientConfig.connectorProvider(new ApacheConnectorProvider());
Client client = ClientBuilder.newClient(clientConfig);
testHeaders(client);
}
use of org.glassfish.jersey.apache.connector.ApacheConnectorProvider in project jersey by jersey.
the class AbortingFilterTest method testAbortingFilterWithApacheConnector.
/**
* The original reproted scenario with a different Connector.
*/
@Test
public void testAbortingFilterWithApacheConnector() {
ClientConfig clientConfig = new ClientConfig();
clientConfig.connectorProvider(new ApacheConnectorProvider());
Client client = ClientBuilder.newClient(clientConfig);
final Response response = client.target(getBaseUri()).path("/simple").request().get();
int status = response.getStatus();
logger.info("Response status is: " + status);
assertEquals(status, Response.Status.UNAUTHORIZED.getStatusCode());
}
use of org.glassfish.jersey.apache.connector.ApacheConnectorProvider in project jersey by jersey.
the class SslConnectorConfigurationTest method testHTTPBasicAuth1.
/**
* Test to see that HTTP 401 is returned when client tries to GET without
* proper credentials.
*
* @throws Exception in case of a test failure.
*/
@Test
public void testHTTPBasicAuth1() throws Exception {
final SSLContext sslContext = getSslContext();
final ClientConfig cc = new ClientConfig().connectorProvider(new ApacheConnectorProvider());
final Client client = ClientBuilder.newBuilder().withConfig(cc).sslContext(sslContext).build();
final WebTarget target = client.target(Server.BASE_URI).register(LoggingFeature.class);
final Response response = target.path("/").request().get(Response.class);
assertEquals(401, response.getStatus());
}
use of org.glassfish.jersey.apache.connector.ApacheConnectorProvider in project jersey by jersey.
the class ApacheOsgiIntegrationTest method testSimpleResource.
@Test
public void testSimpleResource() throws Exception {
final ResourceConfig resourceConfig = new ResourceConfig(ApacheOsgiTestResource.class);
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig);
final ClientConfig clientConfig = new ClientConfig();
clientConfig.connectorProvider(new ApacheConnectorProvider());
final Client c = ClientBuilder.newClient(clientConfig);
final Response response = c.target(baseUri).path("/apacheOsgiTest").request().buildGet().invoke();
final String result = response.readEntity(String.class);
assertEquals("OK", result);
server.shutdownNow();
}
Aggregations