Thanks very much! And can you tell me the specfic code of registering with the HttpClient object ? I just can not find the way to do this..... Thanks!
On Fri, Nov 19, 2010 at 5:24 AM, Felix Meschberger <[email protected]>wrote: > Hi, > > If you are connecting using Java you have to provide the HTTP Basic > authentication header containing your credentials. We generally use the > Apache HttpComponents (or HttpClient) libraries to to HTTP connections. > See also the Integration tests, where we are leveraging HttpClient to > fire requests at Sling. > > In HttpClient (I assume HttpComponents is similar) you would create a > Credentials object with the user name and password and registering with > the HttpClient object so that it is transparently used as requested by > the server. > > Using the user name and password in the URL does not work. > > Hope this helps. > > Regards > Felix > > > Am Freitag, den 19.11.2010, 04:39 -0800 schrieb Zhongmiao Li: > > Hi, I have got stuck in a very strange problem and hope anycould > help > > me! > > > > The address I use to access Sling is as follows: > > > > > http://admin:[email protected]:8080/content/nemoclient?sling:authRequestLogin=1 > > > > On my own computer ( the computer running Sling, whose Ip Address > > is 141.83.80.149), I can connect to Sling properly in Java program(Using > > HttpUrlConnection). However, I can not connect to the server in my > Java > > program on another computer! The error code is 401, Unauthorized. > > But I can upload and download files on any computer by HTML form. So > can > > anyone help me to solve this problem? > > > > > -- Best regards Li Zhongmiao Digital Media, College of Computer Science, Zhejiang University
