Java Code Examples for com.sun.jersey.api.client.Client#setFollowRedirects()
The following examples show how to use
com.sun.jersey.api.client.Client#setFollowRedirects() .
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: ChannelFinderClientImpl.java From phoebus with Eclipse Public License 1.0 | 5 votes |
ChannelFinderClientImpl(URI uri, ClientConfig config, HTTPBasicAuthFilter httpBasicAuthFilter, ExecutorService executor) { Client client = Client.create(config); if (httpBasicAuthFilter != null) { client.addFilter(httpBasicAuthFilter); } // client.addFilter(new RawLoggingFilter(Logger.getLogger(RawLoggingFilter.class.getName()))); client.setFollowRedirects(true); service = client.resource(uri.toString()); this.executor = executor; }
Example 2
Source File: OlogClient.java From phoebus with Eclipse Public License 1.0 | 5 votes |
private OlogClient(URI ologURI, ClientConfig config, boolean withHTTPBasicAuthFilter, String username, String password) { config.getClasses().add(MultiPartWriter.class); Client client = Client.create(config); if (withHTTPBasicAuthFilter) { client.addFilter(new HTTPBasicAuthFilter(username, password)); } if (Logger.getLogger(OlogClient.class.getName()).isLoggable(Level.ALL)) { client.addFilter(new RawLoggingFilter(Logger.getLogger(OlogClient.class.getName()))); } client.setFollowRedirects(true); client.setConnectTimeout(3000); this.service = client.resource(UriBuilder.fromUri(ologURI).build()); }
Example 3
Source File: OlogClient.java From phoebus with Eclipse Public License 1.0 | 5 votes |
private OlogClient(URI ologURI, ClientConfig config, boolean withHTTPBasicAuthFilter, String username, String password, ExecutorService executor, boolean withRawFilter) { this.executor = executor; config.getClasses().add(MultiPartWriter.class); Client client = Client.create(config); if (withHTTPBasicAuthFilter) { client.addFilter(new HTTPBasicAuthFilter(username, password)); } if (withRawFilter) { client.addFilter(new RawLoggingFilter(Logger.getLogger(OlogClient.class.getName()))); } client.setFollowRedirects(true); service = client.resource(UriBuilder.fromUri(ologURI).build()); }
Example 4
Source File: NexusConnector.java From jenkins-deployment-dashboard-plugin with MIT License | 5 votes |
private Client buildClient() { DefaultApacheHttpClientConfig config = new DefaultApacheHttpClientConfig(); config.getState().setCredentials(null, null, -1, username, password); config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); Client restClient = ApacheHttpClient.create(config); restClient.setFollowRedirects(true); return restClient; }
Example 5
Source File: ArtifactoryConnector.java From jenkins-deployment-dashboard-plugin with MIT License | 5 votes |
private Client buildClient() { DefaultApacheHttpClientConfig config = new DefaultApacheHttpClientConfig(); config.getState().setCredentials(null, null, -1, username, password); config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); Client restClient = ApacheHttpClient.create(config); restClient.setFollowRedirects(true); return restClient; }
Example 6
Source File: AbstractJettyTest.java From attic-aurora with Apache License 2.0 | 5 votes |
protected WebResource.Builder getRequestBuilder(String path) { assertNotNull("HTTP server must be started first", httpServer); ClientConfig config = new DefaultClientConfig(); config.getClasses().add(GsonMessageBodyHandler.class); Client client = Client.create(config); // Disable redirects so we can unit test them. client.setFollowRedirects(false); return client.resource(makeUrl(path)).getRequestBuilder().accept(MediaType.APPLICATION_JSON); }
Example 7
Source File: PerformanceTest.java From jerseyoauth2 with MIT License | 5 votes |
@BeforeClass public static void classSetup() { ClientConfig cc = new DefaultClientConfig(); Client restClient = Client.create(cc); ClientManagerClient authClient = new ClientManagerClient(restClient); clientEntity = authClient.createClient("confidential"); String code = authClient.authorizeClient(clientEntity, "test1 test2").getCode(); assertNotNull(code); restClient.setFollowRedirects(false); client = new ResourceClient(clientEntity); token = client.getAccessToken(code); }
Example 8
Source File: StramMiniClusterTest.java From attic-apex-core with Apache License 2.0 | 4 votes |
/** * Verify the web service deployment and lifecycle functionality * * @throws Exception */ @Ignore //disabled due to web service init delay issue @Test public void testWebService() throws Exception { // single container topology of inline input and module Properties props = new Properties(); props.put(StreamingApplication.APEX_PREFIX + "stream.input.classname", TestGeneratorInputOperator.class.getName()); props.put(StreamingApplication.APEX_PREFIX + "stream.input.outputNode", "module1"); props.put(StreamingApplication.APEX_PREFIX + "module.module1.classname", GenericTestOperator.class.getName()); LOG.info("Initializing Client"); LogicalPlanConfiguration tb = new LogicalPlanConfiguration(new Configuration(false)); tb.addFromProperties(props, null); StramClient client = new StramClient(new Configuration(yarnCluster.getConfig()), createDAG(tb)); try { client.start(); client.startApplication(); // attempt web service connection ApplicationReport appReport = client.getApplicationReport(); Thread.sleep(5000); // delay to give web service time to fully initialize Client wsClient = Client.create(); wsClient.setFollowRedirects(true); WebResource r = wsClient.resource("http://" + appReport.getTrackingUrl()).path(StramWebServices.PATH).path(StramWebServices.PATH_INFO); LOG.info("Requesting: " + r.getURI()); ClientResponse response = r.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); JSONObject json = response.getEntity(JSONObject.class); LOG.info("Got response: " + json.toString()); assertEquals("incorrect number of elements", 1, json.length()); assertEquals("appId", appReport.getApplicationId().toString(), json.get("id")); r = wsClient.resource("http://" + appReport.getTrackingUrl()).path(StramWebServices.PATH).path(StramWebServices.PATH_PHYSICAL_PLAN_OPERATORS); LOG.info("Requesting: " + r.getURI()); response = r.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); json = response.getEntity(JSONObject.class); LOG.info("Got response: " + json.toString()); } finally { //LOG.info("waiting..."); //synchronized (this) { // this.wait(); //} //boolean result = client.monitorApplication(); client.killApplication(); client.stop(); } }