Sorry if this is double post, I had some problems with signup. Here goes again:

I'm trying to do a file upload to Restlet-based server, and there seem to be 
problems with authentication when setting
multipart data. Here's the code I use for upload:

                File file = new File("/path/to/file");
                PutMethod method = new PutMethod("http://localhost:8182/file";);
                
                Part[] parts = {new FilePart(file.getName(),file)};
                method.setRequestEntity(new 
MultipartRequestEntity(parts,method.getParams()));
                HttpClient client = new HttpClient();
                client.getState().setCredentials(AuthScope.ANY, new 
UsernamePasswordCredentials("user","pass"));
                method.setDoAuthentication(true);
                
                int status = client.executeMethod(method);
                System.out.println("status: " + status);

When I execute this, server log shows status 401 returned, but client still 
runs and never reaches the last statement.
When I remove the line where setting request entity, authentication works OK.
Authentication is done by extending Guard class and overrinding checkSecret() 
method. Even when I set this to always
return true, I still get the issue as described above. For other request types, 
authentication works fine.
--
Regards,
Vladimr Djurovic
mail: [EMAIL PROTECTED]
Yahoo Messenger ID: vladadjurovic

Reply via email to