-
Notifications
You must be signed in to change notification settings - Fork 217
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
Feature/conditional headers #226
Merged
danielFesenmeyer
merged 83 commits into
eclipse-ditto:master
from
bosch-io:feature/conditional-headers
Sep 6, 2018
Merged
Feature/conditional headers #226
danielFesenmeyer
merged 83 commits into
eclipse-ditto:master
from
bosch-io:feature/conditional-headers
Sep 6, 2018
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…o DittoHeaderDefinition Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
- add interface CustomApiRoutesProvider (with default implementation NoopCustomApiRoutesProvider) and inject/use it in RootRoute - add interface CustomHeadersHandler (with default implementation NoopCustomHeadersHandler) and inject/use it in RootRoute - extract interface GatewayAuthenticationDirectiveBuilder (with default implementation DittoGatewayAuthenticationDirectiveBuilder) and inject/use it in RootRoute - several improvements -- use StatusRoute for providing the gateway's own status -- support Ditto Protocol "compatibility mode" for old "ThingsClients" -- allow custom-headers not only on MessageRoute, but for all ditto routes -> move the usage of HeaderTranslator from MessageRoute to RootRoute Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…ditional-headers Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…ditional-headers Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…e missing Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
* Adds an ETagValueGenerator to generate the value of the ETag header for the entities carried by the command. * Adds a new abstract base class that adds this value as ETag header to thing commands (policy commands will follow) * Extracts two new base classes Entity and Revision Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…le for all websocket-messages Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…y have been moved to Entity/Revision, according to semantic versioning nothing has changed Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…-plugin (binary-compatibility-check) to parent pom Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…l-headers by using a mock-entity instead of concrete Thing- and Policy-Entity Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
* This is already specified by AllParametersAndReturnValuesAreNonnullByDefault Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
* Adds unit tests for known headers Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
* GatewayAuthenticationDirectiveBuilder is now GatewayAuthenticationDirectiveFactory Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
…endingReceiveStrategy Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…sed on the existing data instead of the command Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…ementations; don't generate an ETag if an entity is deleted Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
… analysis (e.g. in unit tests) Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
- add assertion helper methods in AbstractCommandStrategyTest which check whether the CommandStrategy.Result is correctly executed - adjust the (Thing)CommandStrategy-Unit-Tests to use these helper methods - simplify CommandStrategy.Result interface Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…tend (and thus reuse) AbstractConditionalHeadersCheckingCommandStrategy - make CreateThingStrategy a singleton - reference it in ThingPersistenceActor - move becomeDeleteRunnable to CommandStrategy.Context, add another property becomeCreatedRunnable which is used to switch to the created-state from CreateThingStrategy - caveat: the modified-date in the response is not exact, but this is not critical atm Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…Tag always based on the existing data instead of the command - move AbstractETagAppendingReceiveStrategy to PolicyPersistenceActor, rename it to AbstractConditionalHeadersCheckingReceiveStrategy - make AbstractConditionalHeadersCheckingReceiveStrategy extend WithIdReceiveStrategy instead the other way round (because WithIdReceiveStrategy is the more general abstraction) - rename method AbstractConditionalHeadersCheckingReceiveStrategy#determineETagValue() to #determineETagEntity() and just return the object to be used for ETag-calculation instead of already calculating the ETag (same as in Things-Service) - introduce method AbstractConditionalHeadersCheckingReceiveStrategy#sendSuccessResponse() which allows to enrich successful responses with the ETag, use it where appropriate Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
* responses.notModified * responses.preconditionFailed * parameters.ifMatchHeaderParam * parameters.ifNoneMatchHeaderParam Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
* Using those headers for a post to /things doesn't make sense since if-none-match=* would always be successful and if-match=* would always result in 412. Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
…ll "Thing" uppercase Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…dersValidator in module utils-conditional-headers (to allow reuse for policies); move instantiation for the things-service to class ThingsConditionalHeadersValidatorProvider Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…esources; reuse ConditionalHeadersValidator from module utils-conditional-headers Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
- document ETag - conditional-headers If-Match and If-None-Match - status codes 304 and 412 Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…logging in WebsocketRoute (by using this method) Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…mand-string Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…se ditto clients won't work as expected) - TODO: consider to add a third flag like "writeToResponses" to allow exclusion of certain headers in responses/events Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…ment Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
…xternal headers); this issue can be solved on client-side by using DittoProtocolAdapter with HeaderTranslator#empty() Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
…ails for a policy-command Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
* Duplicates the description now instead of referencing it. Signed-off-by: Klem Yannic (INST/ECS1) <Yannic.Klem@bosch-si.com>
Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
03fa92a
to
cea26ec
Compare
…tions to make decisions based on it (TODO: CustomHeadersHandler should better be renamed to sth like RequestInterceptor) Signed-off-by: Daniel Fesenmeyer <daniel.fesenmeyer@bosch-si.com>
PR looks good. The commits have all already been reviewed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for the following precondition headers:
For things and policies including all their subresources.
When requesting those resources there will now be an ETag-Header in the response.