This is my client call using Apache HttpClient Library

public static void addAttachment(String pageId) throws Exception {

                HttpClient client = new HttpClient();
                MultipartPostMethod mPost = new 
MultipartPostMethod(getPageUri(pageId));
                client.setConnectionTimeout(8000);
                File f = new File("C:\\input.txt");
                System.out.println("File Length" + f.length());
                mPost.addParameter(f.getName(), f);

                Credentials defaultcreds = new 
UsernamePasswordCredentials("xxx",
                                "xxx");
                client.getState().setCredentials(
                                new AuthScope("host", port, 
AuthScope.ANY_REALM),
                                defaultcreds);
                mPost.setDoAuthentication(true);
                client.executeMethod(mPost);
                String response = mPost.getResponseBodyAsString();
                System.out.println(response);
                mPost.releaseConnection();

        }

In the server the following lines give null:

String identifier = request.getChallengeResponse().getIdentifier();
                String credentials = 
request.getChallengeResponse().getCredentials();

Why is this so? Why no identifier and credentials.

Reply via email to