Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLAYP-3 #28

Merged
merged 1 commit into from
May 5, 2014
Merged

PLAYP-3 #28

merged 1 commit into from
May 5, 2014

Conversation

miremond
Copy link
Contributor

make callback method from CallbackController asynchronous

final String content = context.getResponseContent();
logger.debug("render : {}", content);
return ok(content).as(Constants.HTML_CONTENT_TYPE);
Promise<Result> promise = Promise.promise(new Function0<Result>() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have Promise<SimpleResult> promiseOfResult = Akka.future(new Callable<SimpleResult>() in the RequiresAuthenticationAction class...

Is it the same here or something different?

Definitely a change that's worth being done on 1.1.x as well...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's the preferred way to implement asynchronous computation. The Akka.future is deprecated in Play 2.2.0.
By the way, I was not sure it is the implementation you had in mind. it would be probably interesting that the getCredentials and getUserProfile return Futures and we compose / chain them together with map, recover... functions. But this is probably too early because we are not effectively asynchronous.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Le'ts go that way, so I think it's worth changing the way it is implemented in the RequiresAuthenticationAction at the same time...

You're right, we could have two Futures instead of just one. But I don't think it would be a great benefit (generally there is just one HTTP call for both methods). And it's still blocking HTTP calls...

I think we'll come finally to the same conclusion as for Vertx: we would need to use the non blocking HTTP client to perform these HTTP calls: https://www.playframework.com/documentation/2.0/JavaWS...

I created this JIRA: https://pac4jos.atlassian.net/browse/PACJ-9. A big change.

make callback method from CallbackController asynchronous
@miremond
Copy link
Contributor Author

miremond commented May 5, 2014

PR updated
Please merge me

@miremond miremond closed this May 5, 2014
@miremond miremond reopened this May 5, 2014
leleuj added a commit that referenced this pull request May 5, 2014
@leleuj leleuj merged commit 2eb2624 into pac4j:master May 5, 2014
@miremond miremond deleted the playp-3 branch May 6, 2014 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants