The thing that doesn't make sense for me is that it works for my unit
tests (in which I don't use tapestry) and it doesn't work with the web
interface (which uses tapestry)... Could you, or someone else, explain
me what I improve if I use a proxy or how to use valid credentials?
When I wrote the unit tests I didn't need to use credentials, but
since I started using that use case with the web interface,
OpenStreetMap started asking me for credentials, and when I added the
code below now it prompts the error I put in the other message.

HttpClient client = new HttpClient();
                        client.getState().setCredentials(
                                        AuthScope.ANY,
                                        new UsernamePasswordCredentials(
                                                        
cuentaOsm.getOsmLoginMail(), cuentaOsm
                                                                        
.getOsmClearPassword()));

Thank you in advance,
Alberto

2011/1/20 Josh Canfield <joshcanfi...@gmail.com>:
>> I'm developing an application that needs to connect to OpenStreetMap API
>> with Http basic authentication.
>
> It doesn't seem to make sense that Tapestry would have anything to do with 
> this.
>
> You are getting a 401 Unauthorized error, are you sure you are
> providing valid credentials outside of your unit tests? Consider
> setting up a logging proxy (I like the charles proxy, it's not free
> and I'm not associated with the company but it's been really easy and
> effective to use) and configure your http client to use the proxy.
>
> Josh
>
>
> On Wed, Jan 19, 2011 at 2:27 PM, AlbertoAlmagro
> <albertoalma...@gmail.com> wrote:
>>
>> Hello,
>>
>> I'm developing an application that needs to connect to OpenStreetMap API
>> with Http basic authentication.
>>
>> I use Hibernate, Spring, Tapestry and maven. When I run the maven tests it
>> uses the Spring test support and it does the authentication successfully via
>> HttpClient. The problem is when I call the same use case from Tapestry: I
>> get the following error from OpenStreetMap:
>>
>> 19-ene-2011 23:26:27
>> org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
>> INFO: basic authentication scheme selected
>> 19-ene-2011 23:26:27 org.apache.commons.httpclient.HttpMethodDirector
>> processWWWAuthChallenge
>> INFO: Failure authenticating with BASIC 'Web
>> Password'@api06.dev.openstreetmap.org:80
>> 50446 [1481353080@qtp-730403186-0] ERROR
>> org.apache.tapestry5.services.TapestryModule.RequestExceptionHandler -
>> Processing of request failed with uncaught exception:
>> es.udc.gisapp.model.util.exceptions.ServiceException: HTTP error; status
>> code = 401
>> org.apache.tapestry5.runtime.ComponentEventException:
>> es.udc.gisapp.model.util.exceptions.ServiceException: HTTP error; status
>> code = 401 [at
>> classpath:es/udc/gisapp/web/pages/applicationservice/MigrarBdOsm.tml, line
>> 17]
>>
>> ¿How can I make the basic http authentication with tapestry without loosing
>> anything important?
>>
>> Thank you in advance
>>
>> I also attach the code that I use to make the authentication use case:
>>
>> public HttpMethod prepareMethodForBasicHttpAuthentication(
>>                        CuentaOsm cuentaOsm, HttpMethod method)
>>                        throws InstanceNotFoundException {
>>
>>                String usernamePassword = cuentaOsm.getOsmLoginMail() + ":"
>>                                + cuentaOsm.getOsmClearPassword();
>>                String basicAuthorizationString = EncodingUtil
>>                                .encodeBase64(usernamePassword);
>>
>>                method.addRequestHeader("Authorization", "Basic "
>>                                + basicAuthorizationString);
>>
>>                return method;
>>        }
>> --
>> View this message in context: 
>> http://tapestry.1045711.n5.nabble.com/Http-Basic-authentication-with-Tapestry-tp3348700p3348700.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to