Hi Alvaro,
For my Play application I created a filter for the controllers that I
didn't want serving cookies:
package controllers;
import java.util.HashMap;
import java.util.Map;
import play.Play;
import play.mvc.*;
/**
* Removes cookies from all responses.
*
* This is because cookies are not required in stateless webservice
and
* we don't want to send any unnecessary information to the client.
*
* @author Alex Jarvis
*/
public class NoCookieFilter extends Controller {
/** An empty cookie map to replace any cookies in the response. */
private static final Map<String, Http.Cookie> cookies = new
HashMap<String, Http.Cookie>(0);
/**
* When the configuration property 'cookies.enabled' equals false,
* this Finally filter will replace the cookies in the response with
an empty Map.
*/
@Finally
protected static void removeCookies() {
boolean cookiesEnabled =
Boolean.parseBoolean(Play.configuration.getProperty("cookies.enabled"));
if (!cookiesEnabled) {
response.cookies = cookies;
}
}
}
You add it to your Controller using the With annotation e.g.
@With(NoCookieFilter.class)
And specify 'cookies.enabled=false' in your application.conf
I hope this helps,
Alex
On Apr 1, 4:51 pm, Alvaro Carrasco <
simple...@gmail.com> wrote:
> Thanks Erwan, I'll give play 1.2 a try.
>
> Alvaro
> --
http://www.alvarocarrasco.com/
>
>
>
>
>
>
>
> On Fri, Apr 1, 2011 at 2:10 AM, Erwan Loisant <
elois...@gmail.com> wrote:
> > Hi,
>
> > If you don't want session cookies at all: there's a fix in 1.2, so
> > starting at this version session cookies will only be created if you
> > explicitly add stuff to the session. Until then you'll have to live
> > with it.
>
> > If you only want some ressources to be served without cookies, you'll
> > have to serve them from a different domain (and from a different
> > application too):
> >
http://code.google.com/speed/page-speed/docs/request.html#ServeFromCo...
>
> > On Thu, Mar 31, 2011 at 17:39, Alvaro Carrasco <
simple...@gmail.com> wrote:
> >> Hi friends,
>
> >> Is there a way to disable session tracking for parts (or all) of a
> >> site? I don't need to remove cookies or anything like that, I just
> >> need to set some routes/actions that do not use the session to NOT set
> >> session cookies. I couldn't find anything using google.
>
> >> Thanks.
> >> Alvaro
> >> --
> >>
http://www.alvarocarrasco.com/
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "play-framework" group.
> >> To post to this group, send email to
play-fr...@googlegroups.com.
> >> To unsubscribe from this group, send email to
play-framewor...@googlegroups.com.
> >> For more options, visit this group athttp://
groups.google.com/group/play-framework?hl=en.