Package org.springframework.http.client

Examples of org.springframework.http.client.SimpleClientHttpRequestFactory


public class ClientHttpRequestMessageSender extends AbstractHttpWebServiceMessageSender {

  private ClientHttpRequestFactory requestFactory;

  public ClientHttpRequestMessageSender() {
    this(new SimpleClientHttpRequestFactory());
  }
View Full Code Here


  @Autowired
  private ComponentA component;

  @Test
  public void testAbc() {
    SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();

    Proxy proxy = new Proxy(java.net.Proxy.Type.HTTP,
      new InetSocketAddress("devproxy.rz.is24.loc", 3128));
    requestFactory.setProxy(proxy);

    RestTemplate template = new RestTemplate(requestFactory);
    //template = new RestTemplate();

View Full Code Here

    private RestTemplate rt;
    private String url;
    public RaceServiceImpl(String url)
    {
        this.url = url;
        SimpleClientHttpRequestFactory s = new SimpleClientHttpRequestFactory() {
        @Override
        protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException {
        super.prepareConnection(connection, httpMethod);

        //Basic Authentication for Police API
View Full Code Here

    private RestTemplate rt;
    private String url;
    public SkillServiceImpl(String url)
    {
        this.url = url;
        SimpleClientHttpRequestFactory s = new SimpleClientHttpRequestFactory() {
        @Override
        protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException {
        super.prepareConnection(connection, httpMethod);

        //Basic Authentication for Police API
View Full Code Here

  public Replicon(final String company, final String username,
      final String password) {

    this.company = company.toLowerCase();
    this.clientHttpRequestFactory = new SimpleClientHttpRequestFactory() {
      @Override
      protected void prepareConnection(HttpURLConnection connection,
          String httpMethod) throws IOException {
        super.prepareConnection(connection, httpMethod);
View Full Code Here

        }
    }

    @Test
    public void testConnectionFactory() throws Exception {
        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        factory.setBufferRequestBody(false);
        factory.setConnectTimeout(15 * 1000);
        factory.setReadTimeout(15 * 1000);

        URI uri = new URI("http://localhost:" + TEST_PORT + "/testConnectionFactory");
        HttpMethod method = HttpMethod.GET;
        ClientHttpRequest request = factory.createRequest(uri, method);
        ClientHttpResponse response = request.execute();
        assertEquals("Mismatched response code", HttpStatus.OK.value(), response.getRawStatusCode());

        BufferedReader rdr = new BufferedReader(new InputStreamReader(response.getBody()));
        try {
View Full Code Here

    RestTemplate restTemplate = new RestTemplate();

    // When called directly without a proxy, expect an exception to be thrown due to byteman rules
    assertNetworkCallFails(restTemplate, new HttpComponentsClientHttpRequestFactory());
    // Repeat that with different request factory used in the code as this exercises different byteman rules
    assertNetworkCallFails(restTemplate, new SimpleClientHttpRequestFactory());
    // And with the actual one used by RestUtil, without a proxy configured
    assertNetworkCallFails(restTemplate, new RestUtil().createRequestFactory(null, false));

    // Test with the in-JVM proxy configured
    HttpProxyConfiguration localProxy = new HttpProxyConfiguration("127.0.0.1", inJvmProxyPort);
View Full Code Here

  }

  private OAuth2RestTemplate createRestTemplate(OAuth2ProtectedResourceDetails resource, AccessTokenRequest request) {
    OAuth2ClientContext context = new DefaultOAuth2ClientContext(request);
    OAuth2RestTemplate client = new OAuth2RestTemplate(resource, context);
    client.setRequestFactory(new SimpleClientHttpRequestFactory() {
      @Override
      protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException {
        super.prepareConnection(connection, httpMethod);
        connection.setInstanceFollowRedirects(false);
      }
View Full Code Here

  private final ProtectedResourceDetails resource;
  private OAuthConsumerSupport support = new CoreOAuthConsumerSupport();

  public OAuthRestTemplate(ProtectedResourceDetails resource) {
    this(new SimpleClientHttpRequestFactory(), resource);
  }
View Full Code Here

    return getStatusCode(getUrl(path), null);
  }

  public RestTemplate getRestTemplate() {
    RestTemplate client = new RestTemplate();
    client.setRequestFactory(new SimpleClientHttpRequestFactory() {
      @Override
      protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException {
        super.prepareConnection(connection, httpMethod);
        connection.setInstanceFollowRedirects(false);
      }
View Full Code Here

TOP

Related Classes of org.springframework.http.client.SimpleClientHttpRequestFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.