httpclient: HTTP/1.1 501 Not Implemented

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

httpclient: HTTP/1.1 501 Not Implemented

Pedro Salgado

When executing this:

            int statusCode = httpClient.executeMethod(method);

            if (statusCode != HttpStatus.SC_OK) {
                System.err.println("Method failed: " +
method.getStatusLine());
            }


I am getting this message:

Method failed: HTTP/1.1 501 Not Implemented

Is there any workaround?

Pedro Salgado


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: httpclient: HTTP/1.1 501 Not Implemented

Ronald Klop-2
On Sun, 05 Jun 2005 12:25:24 +0200, Pedro Salgado <[hidden email]>  
wrote:

>
> When executing this:
>
>             int statusCode = httpClient.executeMethod(method);
>
>             if (statusCode != HttpStatus.SC_OK) {
>                 System.err.println("Method failed: " +
> method.getStatusLine());
>             }
>
>
> I am getting this message:
>
> Method failed: HTTP/1.1 501 Not Implemented
>
> Is there any workaround?

This is the reply of the server. What method are you executing?

Ronald.


--
  Ronald Klop
  Amsterdam, The Netherlands

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: httpclient: HTTP/1.1 501 Not Implemented

Pedro Salgado
I am executing a GET method.
If it is on the server side... That means I should be setting my request on
HTTP1.0?

        retryhandler = new DefaultMethodRetryHandler();
        retryhandler.setRequestSentRetryEnabled(true);
        retryhandler.setRetryCount(5);

        client = new HttpClient();
        client.getState().setAuthenticationPreemptive(true);

        Credentials defaultcreds = new UsernamePasswordCredentials("user",
"pass");
        client.getState().setCredentials(null, URL_X, defaultcreds);

        GetMethod method = createMethod(URL_Y);
        get(client, method);


    /**
     * @param httpClient
     * @param method
     */
    private static final byte[] get(final HttpClient httpClient, final
HttpMethod method) {

        byte[] responseBody = null;

        try {
            // Execute the method.
            int statusCode = httpClient.executeMethod(method);

            if (statusCode != HttpStatus.SC_OK) {
                System.err.println("Method failed: " +
method.getStatusLine());
            }

            // Read the response body.
            responseBody = method.getResponseBody();

        } catch (final HttpException e) {
            System.err.println("Fatal protocol violation: " +
e.getMessage());
            e.printStackTrace();
        } catch (final IOException e) {
            System.err.println("Fatal transport error: " + e.getMessage());
            e.printStackTrace();
        } finally {
            // Release the connection.
            method.releaseConnection();
        }

        return responseBody;
    }


Pedro Salgado

On 05/06/2005 12:52, "Ronald Klop" <[hidden email]> wrote:

> On Sun, 05 Jun 2005 12:25:24 +0200, Pedro Salgado <[hidden email]>
> wrote:
>
>>
>> When executing this:
>>
>>             int statusCode = httpClient.executeMethod(method);
>>
>>             if (statusCode != HttpStatus.SC_OK) {
>>                 System.err.println("Method failed: " +
>> method.getStatusLine());
>>             }
>>
>>
>> I am getting this message:
>>
>> Method failed: HTTP/1.1 501 Not Implemented
>>
>> Is there any workaround?
>
> This is the reply of the server. What method are you executing?
>
> Ronald.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]