Basic Authentication with RestTemplate (3.1)

后端 未结 4 770
野性不改
野性不改 2020-12-15 12:18

I am trying to reproduce the following curl command using Java:

curl -v -u user:pass http://myapp.com/api

This command returns some JSON da

4条回答
  •  一个人的身影
    2020-12-15 13:01

    httpclient v4.0 not Support Preemptive authentication

    Look this : http://forum.springsource.org/showthread.php?123385-Preemptive-Basic-Authentication-with-RestTemplate

    In spring Source found this solution.

    It works for me.

    Look this : RestTemplate with Basic Auth in Spring 3.1

提交回复
热议问题