Ask Your Question

Unable to access Swift storage usibg java socket programming

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

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 = ""; 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


Thanks I solved the problem myself

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

1 answer

Sort by ยป oldest newest most voted

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

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

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


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

Seen: 164 times

Last updated: Mar 05 '17