Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Shruti9520
Copy link
Contributor

Fixes #6573

Copy link
Member

@marcospereira marcospereira left a comment

Choose a reason for hiding this comment

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

@Shruti9520 see the comments.

@@ -29,6 +29,18 @@ It is often useful to mark the `request` parameter as `implicit` so it can be im

@[implicit-request-action](code/ScalaActions.scala)
Copy link
Member

Choose a reason for hiding this comment

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

Actions using implicit requests are already documented here, at this line.

Choose a reason for hiding this comment

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

Git


@[some-csrf-action-with-more-methods](../forms/code/ScalaCsrfController.scala)

The last way of creating an Action value is to specify an additional `BodyParser` argument:
Copy link
Member

Choose a reason for hiding this comment

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

The flow is now kind of weird. We have examples for:

  1. Simple actions without arguments
  2. Actions that accept the request as a parameter, but not implicitly
  3. A new section (with titles) for actions accepting an implicit request
  4. And then (here is where I think the flow is broken), under the "Passing an implicit request between methods" we have an example using a specific body parser.

It would be better to not have another section but instead just a new example in ScalaActions.scala explaining how to use the implicit request in other methods or views.

Finally, it is preferable to add the example in ScalaActions.scala file (linked above) instead of reusing the CSRF examples here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.
Thank you for reviewing. :)

@Shruti9520 Shruti9520 changed the title Fixed-issue-6573-Include examples of implicit request in Action documentation Include examples of implicit request in Action documentation Oct 2, 2017
@gmethvin
Copy link
Member

gmethvin commented Oct 3, 2017

As @wsargent mentioned on the issue we should add references to the following pages:

  • ScalaAsync
  • ScalaTemplates
  • JavaTemplates

@Shruti9520
Copy link
Contributor Author

Hi, @gmethvin

ScalaTemplates and JavaTemplates files are present in playframework/twirl repository. So, I have submitted a PR there. This is the link to my PR- playframework/twirl#15

Also, I am little confused about introducing implicit request section in ScalaAsync file. I think I should add it at the end otherwise it will break the flow.

Thanks!

}

"pass the request implicitly to the action with more methods" in {
//#implicit-request-action-with-more-methods
Copy link
Member

Choose a reason for hiding this comment

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

Pay attention to the code format/style. We use two spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am sorry for this. I'll take care of it next time onwards.

Thanks :)

@Shruti9520
Copy link
Contributor Author

@marcospereira I have made necessary changes. Thanks for the feedback. :-)

@cchantep
Copy link
Member

Hi, as indicated by @marcospereira example with implicit request are alread present in ScalaActions, so no addition there is necessary. Best regards.

@Shruti9520
Copy link
Contributor Author

Hi @cchantep,
Thanks for the feedback. :)

I documented implicit-request-action and implicit-request-action-with-more-methods at different places in order to avoid confusion. If you want me to merge them in a single documentation of implicit-request, I'll do that.

Thanks again. :)

@marcospereira marcospereira merged commit 01f8f03 into playframework:master Nov 27, 2017
@marcospereira
Copy link
Member

Backport to 2.6.x: 46372a6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants