This repository was archived by the owner on Feb 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Added @Body #1615
Merged
WonderCsabo
merged 18 commits into
androidannotations:develop
from
shiraji:1602_add_body
Nov 16, 2015
Merged
Added @Body #1615
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c08cab9
Added Body annotation
shiraji 7dd7c81
Created BodyHandler for validating @Body annotation
shiraji dfab395
Created methods that count number of annotated/non-annotated parameters
shiraji 63933b4
Refactored REST releated Handlers since adding @Body annotation chang…
shiraji ad46c03
Added and Fixed REST parameter annotations tests because @Body is added
shiraji a267189
Removed unnecessary white spaces changes
shiraji d84b8e3
Removed url variables name check from `hasAnnotatedAllParameters`
shiraji f17bf75
Revert changing the parameter type
shiraji 56b7f0c
Revert changing a test case for Field annotation
shiraji ac0ba56
Extract all request entities validations to a method
shiraji 4c3657c
Removed hasAnnotatedAllParameters call since it is called in the supe…
shiraji ee03bad
Validated urlVariableNamesExistInParameters directly in handler
shiraji cc6dd2f
Renamed hasValidBodyParameter to hasOneOrZeroBodyParameter
shiraji 28a213e
Renamed local variable name to avoid confusion
shiraji e4ac33c
Added duplicated field/part name check
shiraji 0a3ef6f
Added fail case for RequiresCookieInUrl
shiraji ec36380
Added validation that check all request parameters are annotated
shiraji 3222cfd
Changed Javadoc for Body annotation
shiraji File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
47 changes: 47 additions & 0 deletions
47
...ng/rest-spring-api/src/main/java/org/androidannotations/rest/spring/annotations/Body.java
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /** | ||
| * Copyright (C) 2010-2015 eBusiness Information, Excilys Group | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| * use this file except in compliance with the License. You may obtain a copy of | ||
| * the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed To in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations under | ||
| * the License. | ||
| */ | ||
| package org.androidannotations.rest.spring.annotations; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * This annotation can be used to add a method body to the POST, PUT, or | ||
| * PATCH request from a method parameter. | ||
| * | ||
| * <b>Example :</b> | ||
| * | ||
| * <pre> | ||
| * @Rest(rootUrl = "http://myserver", converters = FormHttpMessageConverter.class) | ||
| * public interface RestClient { | ||
| * | ||
| * @Post("/events/{id}") | ||
| * EventList addEvent(String id, <b>@Body</b> Event event); | ||
| * } | ||
| * </pre> | ||
| * | ||
| * @see Rest | ||
| * @see Post | ||
| * @see Put | ||
| * @see Patch | ||
| * @see Field | ||
| */ | ||
| @Retention(RetentionPolicy.CLASS) | ||
| @Target(ElementType.PARAMETER) | ||
| public @interface Body { | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am little bit confused here. Why this was working before the cookie url variable in the url?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was really surprised when I notice this, too. This is why I asked you before. There was no validation that checks if
@RequiresCookieInUrlparameter is in url or not. I had to fix these test cases because I addedhasAnnotatedAllParametersmethod that validates the number of url variables in url is equals with the sum of non-annotated parameters, parameters with@Pathand@RequiresCookieInUrl...ok I felt I have to add more validations on
hasAnnotatedAllParameters.Do you want to remove current
hasAnnotatedAllParametersvalidation and send me another pull request for validating@RequiresCookieInUrl? which will block this pull request. It won't take that long.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but we validate the sum, or we also validate that the actually declared url variable exists in the url now with
@RequiresCookieInUrl?So does this invalidate now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only validate the sum, not actual name. You are right. AA has to handle that. I will add the validation in this pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!