Ask Your Question
0

Unable to access Swift storage usibg java socket programming

asked 2015-12-07 22:46:36 -0600

durga gravatar image

Hi , I have one swift setup with keystone. Iam trying to access swift using java socket programming by http methods. I created socket using, SocketFactory factory = (SocketFactory) SocketFactory.getDefault(); Socket socket = (Socket) factory.createSocket(Swift_ip,8080); I sent a http request to get an object that already existed in swift by using, String path = "http://192.168.2.118:8080/v1/AUTH_a8f8d182190b43f092f8d8ee03fdc770/suresh/harish.txt"; BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "UTF8")); wr.write("GET "+path+" HTTP/1.0\r\n"); wr.write("X-Auth-Token: " + mAuthToken +"\r\n"); wr.write("\r\n"); wr.flush(); but Iam getting the following error

HTTP/1.1 404 Not Found Date: Tue, 08 Dec 2015 04:25:41 GMT Server: Apache/2.4.7 (Ubuntu) Vary: X-Auth-Token X-Distribution: Ubuntu x-openstack-request-id: req-dcab4f91-ec76-4ef9-8ef4-ef563a06b9ce Content-Length: 93 Connection: close Content-Type: application/json

{"error": {"message": "The resource could not be found.", "code": 404, "title": "Not Found"}}

edit retag flag offensive close merge delete

Comments

Thanks I solved the problem myself

durga gravatar imagedurga ( 2015-12-08 03:10:20 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-03-05 02:46:56 -0600

benhart gravatar image

Socket factory isn't the right one to use in here. Not sure which one you should but as this one causes error you should replace it. Those kind of errors should be detected early or they will influence you development badly with errors. If you are having troubles doing it you can use a program to help you, I know one called Checkmarx that you can try. Good luck. Ben.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-12-07 22:46:36 -0600

Seen: 128 times

Last updated: Mar 05 '17