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

Great getting started ticket: write example snippets for Akka HTTP Java DSL #20466

Closed
johanandren opened this Issue May 6, 2016 · 47 comments

Comments

Projects
None yet
@johanandren
Member

johanandren commented May 6, 2016

The last couple of months we have been hard at work with providing a DSL for Java that is (almost) as neat as the Scala DSL for Akka HTTP. We are now at the point where we have the API in place in master and basic docs but what is missing is examples for each of the directives.

Providing an example for a directive is a perfect way to start contributing to Akka, each directive is sufficiently isolated, and there is a corresponding Scala example to base the sample on.

How to do it:

  • Select a directive below, write a comment that you will be working on it
  • Read the docs, [the corresponding Scala directive docs]file(http://doc.akka.io/docs/akka/2.4.4/scala/http/routing-dsl/directives/alphabetically.html#predefined-directives) and make sure you understand what the directive does
  • Look at the Scala example in akka-docs/rst/scala/code/docs/http/scaladsl/server/directives and port it to a Java example in akka-docs/rst/java/code/docs/http/javadsl/server/directives. Look at the existing Java samples to see how the tests should be set up
  • Run the test using akka-docs/testOnly docs.http.javadsl.server.directives.YourDirective
  • Include the test in the docs by adding comments with the label from the .rst documentation of the directive.
  • Generate the docs using akka-docs/sphinx:generateHtml and see that the sample is included in the docs and looks nice (you will find the docs generated as HTML under akka-docs/target/sphinx/html/index.html` so that you can preview in your browser)
  • Make a PR to have the sample reviewed and merged into Akka HTTP

Directives to provide samples for
(all paths relative to akka-docs/rst/java/http/routing-dsl/directives)

  • basic-directives/cancelRejection.rst thanks @Hawstein!
  • basic-directives/cancelRejections.rst thanks @Hawstein!
  • basic-directives/extract.rst thanks @Hawstein!
  • basic-directives/extractExecutionContext.rst thanks @Hawstein!
  • basic-directives/extractLog.rst thanks @Hawstein!
  • basic-directives/extractMaterializer.rst thanks @Hawstein!
  • basic-directives/extractRequest.rst thanks @Hawstein!
  • basic-directives/extractRequestContext.rst thanks @Hawstein!
  • basic-directives/extractSettings.rst thanks @Hawstein!
  • basic-directives/extractUnmatchedPath.rst thanks @Hawstein!
  • basic-directives/extractUri.rst thanks @Hawstein!
  • basic-directives/mapInnerRoute.rst thanks @Hawstein!
  • basic-directives/mapRejections.rst thanks @Hawstein!
  • basic-directives/mapRequest.rst thanks @Hawstein!
  • basic-directives/mapRequestContext.rst thanks @Hawstein!
  • basic-directives/mapResponse.rst thanks @Hawstein!
  • basic-directives/mapResponseEntity.rst thanks @Hawstein!
  • basic-directives/mapResponseHeaders.rst thanks @Hawstein!
  • basic-directives/mapRouteResult.rst thanks @Hawstein!
  • basic-directives/mapRouteResultPF.rst thanks @Hawstein!
  • basic-directives/mapRouteResultStage.rst thanks @Hawstein!
  • basic-directives/mapRouteResultWith.rst thanks @Hawstein!
  • basic-directives/mapRouteResultWithPF.rst thanks @Hawstein!
  • basic-directives/mapSettings.rst thanks @Hawstein!
  • basic-directives/mapUnmatchedPath.rst thanks @Hawstein!
  • basic-directives/pass.rst thanks @Hawstein!
  • basic-directives/provide.rst thanks @Hawstein!
  • basic-directives/recoverRejections.rst thanks @Hawstein!
  • basic-directives/recoverRejectionsWith.rst thanks @Hawstein!
  • basic-directives/withExecutionContext.rst thanks @Hawstein!
  • basic-directives/withLog.rst thanks @Hawstein!
  • basic-directives/withMaterializer.rst thanks @Hawstein!
  • basic-directives/withSettings.rst thanks @Hawstein!
  • coding-directives/decodeRequest.rst thanks @Hawstein!
  • coding-directives/decodeRequestWith.rst thanks @Hawstein!
  • coding-directives/encodeResponse.rst thanks @Hawstein!
  • coding-directives/encodeResponseWith.rst thanks @Hawstein!
  • coding-directives/responseEncodingAccepted.rst thanks @Hawstein!
  • cookie-directives/cookie.rst thanks @Hawstein!
  • cookie-directives/deleteCookie.rst thanks @Hawstein!
  • cookie-directives/optionalCookie.rst thanks @Hawstein!
  • cookie-directives/setCookie.rst thanks @Hawstein!
  • debugging-directives/logRequest.rst thanks @fagossa!
  • debugging-directives/logRequestResult.rst thanks @fagossa!
  • debugging-directives/logResult.rst thanks @fagossa!
  • execution-directives/handleExceptions.rst thanks @Hawstein!
  • execution-directives/handleRejections.rst thanks @Hawstein!
  • file-and-resource-directives/getFromBrowseableDirectories.rst thanks @Hawstein!
  • file-and-resource-directives/getFromBrowseableDirectory.rst thanks @Hawstein!
  • file-and-resource-directives/getFromDirectory.rst thanks @Hawstein!
  • file-and-resource-directives/getFromFile.rst thanks @Hawstein!
  • file-and-resource-directives/getFromResource.rst thanks @Hawstein!
  • file-and-resource-directives/getFromResourceDirectory.rst thanks @Hawstein!
  • file-and-resource-directives/listDirectoryContents.rst thanks @Hawstein!
  • file-upload-directives/fileUpload.rst thanks @gosubpl!
  • file-upload-directives/uploadedFile.rst thanks @gosubpl!
  • form-field-directives/formField.rst thanks @Hawstein!
  • form-field-directives/formFieldList.rst thanks @Hawstein!
  • form-field-directives/formFieldMap.rst thanks @Hawstein!
  • form-field-directives/formFieldMultiMap.rst thanks @Hawstein!
  • future-directives/completeOrRecoverWith.rst
  • future-directives/onComplete.rst
  • future-directives/onSuccess.rst
  • header-directives/headerValue.rst thanks @zhxiaogg!
  • header-directives/headerValueByName.rst thanks @zhxiaogg!
  • header-directives/headerValueByType.rst thanks @zhxiaogg!
  • header-directives/headerValuePF.rst thanks @zhxiaogg!
  • header-directives/optionalHeaderValue.rst thanks @zhxiaogg!
  • header-directives/optionalHeaderValueByName.rst thanks @zhxiaogg!
  • header-directives/optionalHeaderValueByType.rst thanks @zhxiaogg!
  • header-directives/optionalHeaderValuePF.rst thanks @zhxiaogg!
  • marshalling-directives/completeWith.rst
  • marshalling-directives/entity.rst
  • marshalling-directives/handleWith.rst
  • misc-directives/extractClientIP.rst
  • misc-directives/rejectEmptyResponse.rst
  • misc-directives/requestEntityEmpty.rst
  • misc-directives/requestEntityPresent.rst
  • misc-directives/selectPreferredLanguage.rst
  • misc-directives/validate.rst
  • parameter-directives/parameter.rst thanks @Hawstein!
  • parameter-directives/parameterMap.rst thanks @Hawstein!
  • parameter-directives/parameterMultiMap.rst thanks @Hawstein!
  • parameter-directives/parameters.rst thanks @Hawstein!
  • parameter-directives/parameterSeq.rst thanks @Hawstein!
  • path-directives/path.rst thanks @fagossa !
  • path-directives/pathEnd.rst thanks @fagossa !
  • path-directives/pathEndOrSingleSlash.rst thanks @fagossa !
  • path-directives/pathPrefix.rst thanks @fagossa !
  • path-directives/pathPrefixTest.rst thanks @fagossa !
  • path-directives/pathSingleSlash.rst thanks @fagossa !
  • path-directives/pathSuffix.rst thanks @fagossa !
  • path-directives/pathSuffixTest.rst thanks @fagossa !
  • path-directives/rawPathPrefix.rst thanks @fagossa !
  • path-directives/rawPathPrefixTest.rst thanks @fagossa !
  • path-directives/redirectToNoTrailingSlashIfPresent.rst thanks @fagossa !
  • path-directives/redirectToTrailingSlashIfMissing.rst thanks @fagossa !
  • range-directives/withRangeSupport.rst
  • respond-with-directives/respondWithDefaultHeader.rst thanks @felipefzdz!
  • respond-with-directives/respondWithDefaultHeaders.rst thanks @felipefzdz!
  • respond-with-directives/respondWithHeader.rst thanks @felipefzdz!
  • respond-with-directives/respondWithHeaders.rst thanks @felipefzdz!
  • route-directives/complete.rst
  • route-directives/failWith.rst
  • route-directives/redirect.rst
  • route-directives/reject.rst
  • scheme-directives/extractScheme.rst thanks @fagossa !
  • scheme-directives/scheme.rst thanks @fagossa !
  • security-directives/authenticateBasic.rst
  • security-directives/authenticateBasicAsync.rst
  • security-directives/authenticateBasicPF.rst
  • security-directives/authenticateBasicPFAsync.rst
  • security-directives/authenticateOAuth2.rst
  • security-directives/authenticateOAuth2Async.rst
  • security-directives/authenticateOAuth2PF.rst
  • security-directives/authenticateOAuth2PFAsync.rst
  • security-directives/authenticateOrRejectWithChallenge.rst
  • security-directives/authorize.rst
  • security-directives/authorizeAsync.rst
  • security-directives/extractCredentials.rst
  • timeout-directives/withoutRequestTimeout.rst thanks @gosubpl!
  • timeout-directives/withRequestTimeout.rst thanks @gosubpl!
  • timeout-directives/withRequestTimeoutResponse.rst thanks @gosubpl!
  • websocket-directives/handleWebSocketMessages.rst
  • websocket-directives/handleWebSocketMessagesForProtocol.rst
@poojadshende

This comment has been minimized.

Show comment
Hide comment
@poojadshende

poojadshende May 7, 2016

Contributor

@johanandren Can I start working on one of the directory or do I have to wait till JavaDSL is merged to master?

Contributor

poojadshende commented May 7, 2016

@johanandren Can I start working on one of the directory or do I have to wait till JavaDSL is merged to master?

@johanandren

This comment has been minimized.

Show comment
Hide comment
@johanandren

johanandren May 8, 2016

Member

@poojadshende I'm afraid you will have to wait, we expected to merge the Java DSL during Friday, but things didn't go our way. :( Will update ticket as soon as we have the DSL merged.

Member

johanandren commented May 8, 2016

@poojadshende I'm afraid you will have to wait, we expected to merge the Java DSL during Friday, but things didn't go our way. :( Will update ticket as soon as we have the DSL merged.

@johanandren

This comment has been minimized.

Show comment
Hide comment
@johanandren

johanandren May 18, 2016

Member

Now this ticket is ready for some contributing!

Member

johanandren commented May 18, 2016

Now this ticket is ready for some contributing!

@Hawstein

This comment has been minimized.

Show comment
Hide comment
@Hawstein

Hawstein May 21, 2016

Contributor

I make a PR for the CookieDirectives example snippet. If that is OK, I will go on for the BasicDirectives.

Contributor

Hawstein commented May 21, 2016

I make a PR for the CookieDirectives example snippet. If that is OK, I will go on for the BasicDirectives.

@patriknw

This comment has been minimized.

Show comment
Hide comment
@patriknw

patriknw May 21, 2016

Member

Sounds great, thanks

Member

patriknw commented May 21, 2016

Sounds great, thanks

@fagossa

This comment has been minimized.

Show comment
Hide comment
@fagossa

fagossa May 22, 2016

Contributor

I made a PR for the scheme directive

Contributor

fagossa commented May 22, 2016

I made a PR for the scheme directive

@ktoso

This comment has been minimized.

Show comment
Hide comment
@ktoso

ktoso May 23, 2016

Member

Awesome, thanks @fagossa!
1 down, 124 to go...! :-)

:shipit:

Member

ktoso commented May 23, 2016

Awesome, thanks @fagossa!
1 down, 124 to go...! :-)

:shipit:

@fagossa

This comment has been minimized.

Show comment
Hide comment
@fagossa

fagossa May 23, 2016

Contributor

@ktoso The scheme-directives/extractScheme.rst directive is also shown in the example; so, I think that makes 2 down, 123 to go!!

BTW I'm working on some other directives

Contributor

fagossa commented May 23, 2016

@ktoso The scheme-directives/extractScheme.rst directive is also shown in the example; so, I think that makes 2 down, 123 to go!!

BTW I'm working on some other directives

@ktoso

This comment has been minimized.

Show comment
Hide comment
@ktoso

ktoso May 23, 2016

Member

Hah! You're right, awesome :)
Thanks a lot for your help!

Member

ktoso commented May 23, 2016

Hah! You're right, awesome :)
Thanks a lot for your help!

@felipefzdz

This comment has been minimized.

Show comment
Hide comment
@felipefzdz

felipefzdz May 23, 2016

Contributor

I'll be working on the ones contained in RespondWithDirectivesExamplesSpec. respondWithHeader, respondWithDefaultHeader...

Contributor

felipefzdz commented May 23, 2016

I'll be working on the ones contained in RespondWithDirectivesExamplesSpec. respondWithHeader, respondWithDefaultHeader...

@ktoso

This comment has been minimized.

Show comment
Hide comment
@ktoso

ktoso May 23, 2016

Member

Great, thanks @felipefzdz !

Member

ktoso commented May 23, 2016

Great, thanks @felipefzdz !

ktoso added a commit that referenced this issue May 24, 2016

=doc,htp #20466 Include Respond Directives Examples for Java. (#20595)
* Include Respond Directives Examples for Java.

* Include license on RespondWithDirectivesExamplesTest.
@Hawstein

This comment has been minimized.

Show comment
Hide comment
@Hawstein

Hawstein May 24, 2016

Contributor

Working on BasicDirectives now.

Contributor

Hawstein commented May 24, 2016

Working on BasicDirectives now.

@ktoso

This comment has been minimized.

Show comment
Hide comment
@ktoso

ktoso May 24, 2016

Member

Awesome, thank you!

Member

ktoso commented May 24, 2016

Awesome, thank you!

@Hawstein

This comment has been minimized.

Show comment
Hide comment
@Hawstein

Hawstein May 24, 2016

Contributor

Really glad to contribute to Akka. Thanks for providing such a convenient way to contribute to it.

Contributor

Hawstein commented May 24, 2016

Really glad to contribute to Akka. Thanks for providing such a convenient way to contribute to it.

@zhxiaogg

This comment has been minimized.

Show comment
Hide comment
@zhxiaogg

zhxiaogg May 25, 2016

Contributor

I would try header-directives if you don't mind.

Contributor

zhxiaogg commented May 25, 2016

I would try header-directives if you don't mind.

@ktoso

This comment has been minimized.

Show comment
Hide comment
@ktoso

ktoso May 25, 2016

Member

Great, thanks a lot :-)

-- 
Konrad ktoso Malawski
Akka @ Lightbend

On 26 May 2016 at 00:55:46, John Zhang (notifications@github.com) wrote:

I would try header-directives if you don't mind.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

Member

ktoso commented May 25, 2016

Great, thanks a lot :-)

-- 
Konrad ktoso Malawski
Akka @ Lightbend

On 26 May 2016 at 00:55:46, John Zhang (notifications@github.com) wrote:

I would try header-directives if you don't mind.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@fagossa

This comment has been minimized.

Show comment
Hide comment
@fagossa

fagossa May 29, 2016

Contributor

@ktoso I just made a PR on the debugging directives. It covers:

  • debugging-directives/logRequest.rst
  • debugging-directives/logRequestResult.rst
  • debugging-directives/logResult.rst

i'll continue with path-directives

Contributor

fagossa commented May 29, 2016

@ktoso I just made a PR on the debugging directives. It covers:

  • debugging-directives/logRequest.rst
  • debugging-directives/logRequestResult.rst
  • debugging-directives/logResult.rst

i'll continue with path-directives

ktoso added a commit that referenced this issue May 30, 2016

+doc #20466 akka http javadsl - add debugging directive test (#20651)
* akka http javadsl - add debugging directive test

* fixes line breaks
@ktoso

This comment has been minimized.

Show comment
Hide comment
@ktoso

ktoso May 30, 2016

Member

Three more down by @felipefzdz, thanks a lot!

Member

ktoso commented May 30, 2016

Three more down by @felipefzdz, thanks a lot!

patriknw added a commit that referenced this issue May 31, 2016

+doc #20466 akka http javadsl - add debugging directive test (#20651)
* akka http javadsl - add debugging directive test

* fixes line breaks
@gosubpl

This comment has been minimized.

Show comment
Hide comment
@gosubpl

gosubpl Jul 5, 2016

Contributor

Current status:

  • route-directives merged
  • security-directives merged
  • file-upload-directives merged
  • range-directives merged
  • marshalling-directives @zhxiaogg woking on it
  • misc-directives @fagossa working on it
  • websocket-directives up for grabs
Contributor

gosubpl commented Jul 5, 2016

Current status:

  • route-directives merged
  • security-directives merged
  • file-upload-directives merged
  • range-directives merged
  • marshalling-directives @zhxiaogg woking on it
  • misc-directives @fagossa working on it
  • websocket-directives up for grabs

gosubpl added a commit to gosubpl/akka that referenced this issue Jul 5, 2016

ktoso added a commit that referenced this issue Jul 6, 2016

doc #20466 Java range-directives examples added (#20892)
* #20466 Java range-directives examples added

* #20466 post-review changes

@ktoso ktoso modified the milestones: 2.4.8, 2.4.9 Jul 8, 2016

@ktoso ktoso modified the milestones: 2.4.9-RC1, 2.4.9, 2.4.9-RC2 Aug 2, 2016

@gosubpl

This comment has been minimized.

Show comment
Hide comment
@gosubpl

gosubpl Aug 17, 2016

Contributor

Is anyone working on websocket-directives ? I'd be happy to take this on.

Contributor

gosubpl commented Aug 17, 2016

Is anyone working on websocket-directives ? I'd be happy to take this on.

@Hawstein

This comment has been minimized.

Show comment
Hide comment
@Hawstein

Hawstein Aug 18, 2016

Contributor

I am afraid you have to wait for issue #21184 to be resolved since there is no java api for ws testkit now.

Contributor

Hawstein commented Aug 18, 2016

I am afraid you have to wait for issue #21184 to be resolved since there is no java api for ws testkit now.

@johanandren johanandren modified the milestones: 2.4.9, 2.4.10 Aug 19, 2016

Hawstein added a commit to Hawstein/akka that referenced this issue Aug 21, 2016

add java api for websocket testkit
* add java api for websocket testkit (#21184)
* add unit test for WebSocketDirectives (#20466)
* change the signatures of methods in WebSocketDirectives javadsl (#21239)

Hawstein added a commit to Hawstein/akka that referenced this issue Aug 23, 2016

add java api for websocket testkit
* add java api for websocket testkit (#21184)
* add unit test for WebSocketDirectives (#20466)
* change the signatures of methods in WebSocketDirectives javadsl (#21239)

Hawstein added a commit to Hawstein/akka that referenced this issue Aug 30, 2016

add java api for websocket testkit
* add java api for websocket testkit (#21184)
* add unit test for WebSocketDirectives (#20466)
* change the signatures of methods in WebSocketDirectives javadsl (#21239)
@gosubpl

This comment has been minimized.

Show comment
Hide comment
@gosubpl

gosubpl Sep 1, 2016

Contributor

@Hawstein I see you have already covered websocket-directives Java test in #21238 😃

Contributor

gosubpl commented Sep 1, 2016

@Hawstein I see you have already covered websocket-directives Java test in #21238 😃

@Hawstein

This comment has been minimized.

Show comment
Hide comment
@Hawstein

Hawstein Sep 2, 2016

Contributor

@gosubpl yup, I wrote the test for java ws testkit to verify its correctness after implementing it . Hope you don't mind 😄

Contributor

Hawstein commented Sep 2, 2016

@gosubpl yup, I wrote the test for java ws testkit to verify its correctness after implementing it . Hope you don't mind 😄

Hawstein added a commit to Hawstein/akka that referenced this issue Sep 2, 2016

add java api for websocket testkit
* add java api for websocket testkit (#21184)
* add unit test for WebSocketDirectives (#20466)
* change the signatures of methods in WebSocketDirectives javadsl (#21239)
@gosubpl

This comment has been minimized.

Show comment
Hide comment
@gosubpl

gosubpl Sep 2, 2016

Contributor

@Hawstein no, absolutely not 😃
So the current status would be:

  • marshalling-directives @zhxiaogg woking on it
  • misc-directives @fagossa working on it
  • websocket-directives @Hawstein working on it
Contributor

gosubpl commented Sep 2, 2016

@Hawstein no, absolutely not 😃
So the current status would be:

  • marshalling-directives @zhxiaogg woking on it
  • misc-directives @fagossa working on it
  • websocket-directives @Hawstein working on it

johanandren added a commit that referenced this issue Sep 2, 2016

add java api for websocket testkit #21184
And additionally adds unit test for WebSocketDirectives #20466

@2m 2m modified the milestones: 2.4.10, 2.4.11 Sep 7, 2016

@ktoso ktoso removed the 1 - triaged label Sep 8, 2016

@ktoso

This comment has been minimized.

Show comment
Hide comment
@ktoso

ktoso Sep 9, 2016

Member

Ticket moved to github.com/akka/akka-http
Rationale for the move discussed here: akka/akka-meta#27

If you are interested in contributing or tracking this issue, please comment in akka-http instead from now on :-)

Member

ktoso commented Sep 9, 2016

Ticket moved to github.com/akka/akka-http
Rationale for the move discussed here: akka/akka-meta#27

If you are interested in contributing or tracking this issue, please comment in akka-http instead from now on :-)

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