Hi Patson, did you try with several clients such as IE, FireFox?
best regards, Thierry Boileau On 10/10/07, Patson <[EMAIL PROTECTED]> wrote: > > Patson <patson.luk <at> timesearchinc.com> writes: > > > > > Hi all. I have started using restlet since last month and am impressed > with > the > > simplicity it offers. > > > > However, I bumped into a problem with using Guards earlier and could not > figure > > out a good way to get around it. > > > > Basically I have one Restlet "TestRestlet" that handles both GET and > POST > > requests. However, they have different URI patterns. > > > > For example, GET request would have pattern of /testGet/user/{userId} > > and POST request would have pattern of /testPost > > > > Hence if I type http://localhost:8080/testGet/user/ABC, the request > would be > > mapped to the GET handling of the TestRestlet and it would return, say a > form in > > html format and the use can click submit on that form which points to > > http://localhost:8080/testPost > > > > I have one single Guard: > > > > Guard testGuard= new TestGuard(getContext() > > , ChallengeScheme.HTTP_BASIC > > , "test Access Control"; //my TestGuard class, same as > Guard... > > Restlet testRestlet = new TestRestlet(getContext()); > > testGuard.setNext(testRestlet); > > router.attach("/testGet/user/{userId}", testGuard); > > router.attach("/testPost", testGuard); > > > > Now, if I access /testGet/user/ABC, it would ask me for authentication > (401 > > response), which is fine. After I input the user name and password, it > would > > then return the html form which points to /testPost (which is fine too). > Now, if > > I submit that form, I would get 401 response again...and the web browser > > obviously was confused (keep saying loading) and its stuck. > > > > My expectation is that the server should not give 401 status code the > 2nd > time > > (since it has already authenticated on the GET request and they are > sharing > the > > same Guard). The funny part is that if I change the pattern > > "/testGet/user/{userId}" into just "/testGet" then all goes fine... > > > > I am not sure if its a bug or if its some stupid problem that I > made...can > > anyone plz gimme some pointers plz? > > > > The Restlet jar I am using is the version 3.1 one. The server is the > Simple > > server and Simple Framework. > > > > Many thanks in advance!!! > > > > > > Jerome Louvel <contact <at> noelios.com> writes: > Hi Jerome, > > Many thanks for the reply! I have tried to removed the spaces in the > authentication realm name but still no luck. Anyway, I sent you the zipped > project in an e-mail. In order to test it: > > 1. Unzip and import the project (I am using eclipse) > 2. Run the main class RestServer that starts the server > 3. Open your browser, key in url http://localhost:8080/testGet/user/123 > 4. It would prompt u for authentication, simply enter something (doesnt > check > anything) > 5. enter something in the box and click "submit Query" > 6. you will see in ur console log that another 401 response was issued by > the > server, however, the broswer is unable to handle it (keeps loading) > > Again, Many thanks for your help!! > > > >