users@grizzly.java.net

Re: basic authentication and grizzly

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Wed, 19 Nov 2008 14:37:04 -0500

Salut,

Carla Mott wrote:
> Hi,
>
> I have a web app that I want to write that is using only html, css and
> javascript (no servlet or jsp) and I want to implement some basic
> authentication mechanism for login. Can I easily pass a url to post
> with a credential and get a cookie back to track the session if I only
> have grizzly on the backend?

Yes you can. You just need to extends the GrizzlyAdapter

[Doc]
https://grizzly.dev.java.net/nonav/apidocs/com/sun/grizzly/tcp/http11/GrizzlyAdapter.html

[Code]
https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/tcp/http11/GrizzlyAdapter.html

and manipulate the GrizzlyRequest/GrizzlyResponse objects.

[Doc]
https://grizzly.dev.java.net/nonav/apidocs/com/sun/grizzly/tcp/http11/GrizzlyRequest.html
https://grizzly.dev.java.net/nonav/apidocs/com/sun/grizzly/tcp/http11/GrizzlyResponse.html

[Code]
https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/tcp/http11/GrizzlyRequest.html
https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/tcp/http11/GrizzlyResponse.html

The cookie is reachable via the GrizzlyRequest.getCookie()


As a starter, just take a look at the ServletAdapter, on which we build
the Grizzly Servlet Container:

[Code]
https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/http/servlet/ServletAdapter.html

A simple tutorial about how to embed Grizzly can be found here:

http://weblogs.java.net/blog/jfarcand/archive/2008/07/extending_the_g.html

Hope that help.

A+

-- Jeanfrancois



  I'm not to sure what I really need to do
> other than have a way of tracking the session.
>
> Suggestions? Is this currently possible? What would it take to do
> something like this if not?
>
> Thanks,
> Carla
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>