Comments (11)
Anything new regarding this problem?
from atmosphere-play.
Can you point me to the Play Session? I will implements that API
from atmosphere-play.
Would it be possible to parse PLAY_SESSION cookie and identify user? Logic for this is stored at https://github.com/playframework/playframework/blob/master/framework/src/play/src/main/scala/play/api/mvc/Http.scala#L710
from atmosphere-play.
Hi, is there any progress on sessions? You could access the session inside of "AtmosphereController".....session() would Provide the Play Session.
from atmosphere-play.
@vkoop Contribution welcomed!
from atmosphere-play.
I am not sure if accessing pure play session object in atmosphere would be good idea (Its http request scoped AFAIK)
Here are my changes with hook in form of AtmospherePlaySessionConverter in which anyone can translate what they want from play session into AtmopshereRequest.attributes. #19
Its pretty rough, but gives basic idea.
from atmosphere-play.
Is there any news on this? Still returns null.
from atmosphere-play.
@daut-morina Have you tested the latest version?
from atmosphere-play.
@jfarcand Thanks for your quick reply.
Yes, I'm using 2.1.0 on Play 2.3. Is session support enabled by default or do I have to enable it first like I would have to when using the generic atmosphere framework?
Update
On startup I see following log entry:
[info] o.a.c.AtmosphereFramework - HttpSession supported: false
So the session is not enabled, but i couldn't find any documentation about how to enable the session in play since there's no web.xml in play.
from atmosphere-play.
In the play chat example in Global.java
I do following:
@Override
public void onStart(Application application) {
instance().framework().getAtmosphereConfig().setSupportSession(true);
instance().discover(Chat.class).ready();
}
and now the log shows:
[info] o.a.c.AtmosphereFramework - HttpSession supported: true
The result is that following:
@Ready
public void onReady(final AtmosphereResource r) {
logger.info("Session: " + r.session());
logger.info("Session from request: " + r.getRequest().getSession());
logger.info("Cookie from request: " + r.getRequest().getCookies().length);
}
gives you this:
[info] o.a.s.play.Chat - Session: org.atmosphere.cpr.AtmosphereRequest$NoOpsRequest$1@6c7c94c3
[info] o.a.s.play.Chat - Session: org.atmosphere.cpr.AtmosphereRequest$NoOpsRequest$1@6c7c94c3
[info] o.a.s.play.Chat - Session: 0
from atmosphere-play.
@daut-morina
pull request I provided above was merged to play-atmoshpere 2+ - it introduces hook in form of AtmospherePlaySessionConverter for play session access from atmosphere parts.
It will not just give you access to full play HTTP session, but rather provides a hook where you can read some values from it and put it as attributes of Atmoshphere request.
(There is no default implementation of AtmospherePlaySessionConverter, you need to prepare any that will work for you and hook it via properties ("org.atmopshere.play.AtmospherePlaySessionConverter" property) - just watch out for problems with them under play development mode ())
See also
- https://groups.google.com/forum/#!topic/atmosphere-framework/y-IuAm7MT8M
- https://groups.google.com/forum/#!searchin/atmosphere-framework/rafalfaron/atmosphere-framework/Kkr2NjwY-uE/p43F2vMuRQQJ
I use this hook in my projects to access play-authenticate sessions and it works fine.
from atmosphere-play.
Related Issues (20)
- Play Framework Chat example: client not receiving message from server HOT 2
- JVM crash after migration to play 2.3 HOT 12
- SSE transport do not work (switched to fallbackTransport after second message)
- long-polling and jsonp transport produces duplicate messages in sample chat application HOT 1
- "streaming" support does not work (switched to pooling) HOT 1
- ajax transport does not work in sample chat application HOT 1
- Creation of several concurrent SSE connections doesn't work HOT 1
- Is the dependency on servlet-api 2.5 outdated? HOT 1
- Play Framework 2.4.0 routing, global settings and compilation error HOT 8
- @org.atmosphere.config.service.Disconnect do not detect Android Chrome close Tab HOT 6
- java.lang.ClassNotFoundException: com.ning.http.multipart.MultipartRequestEntity with Play 2.3.x in combination with wasync 2.1.2 HOT 2
- Can't get guice injection to work with atmosphere-play
- Play scala NoClassDefFoundError: play/mvc/Results$Status HOT 1
- Cannot find org.atmosphere.play.Router HOT 9
- Example on front page does not work. HOT 3
- ManagedService path ignores application.context parameter HOT 1
- Play session not available to ManagedService in development mode
- play.mvc.LegacyWebSocket removed in Play 2.6.x HOT 2
- Long polling not working in play 2.6.x with atmosphere-play 2.4.0 HOT 1
- Play 2.8.x support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atmosphere-play.