-
Notifications
You must be signed in to change notification settings - Fork 38.4k
Add QUERY
HTTP method
#33430
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
Open
desiderantes
wants to merge
7
commits into
spring-projects:main
Choose a base branch
from
desiderantes:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add QUERY
HTTP method
#33430
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a6703ac
Add QUERY HTTP method
desiderantes c234895
Revert changes to RestTemplate
desiderantes 5875661
Add more test scaffolding
desiderantes 9dc89dd
Merge branch 'spring-projects:main' into main
desiderantes ccf505a
Add Accept-Query handling and remove versions from since
desiderantes 75f16b4
Small case fix
desiderantes b4e1325
Merge remote-tracking branch 'upstream/main'
desiderantes 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 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 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 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 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 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 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 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 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 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
98 changes: 98 additions & 0 deletions
98
spring-web/src/main/java/org/springframework/web/bind/annotation/QueryMapping.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* Copyright 2002-2024 the original author or authors. | ||
* | ||
* 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 | ||
* | ||
* https://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.springframework.web.bind.annotation; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import org.springframework.core.annotation.AliasFor; | ||
|
||
/** | ||
* Annotation for mapping HTTP {@code QUERY} requests onto specific handler | ||
* methods. | ||
* | ||
* <p>Specifically, {@code @QueryMapping} is a <em>composed annotation</em> that | ||
* acts as a shortcut for {@code @RequestMapping(method = RequestMethod.QUERY)}. | ||
* | ||
* <p><strong>NOTE:</strong> This annotation cannot be used in conjunction with | ||
* other {@code @RequestMapping} annotations that are declared on the same method. | ||
* If multiple {@code @RequestMapping} annotations are detected on the same method, | ||
* a warning will be logged, and only the first mapping will be used. This applies | ||
* to {@code @RequestMapping} as well as composed {@code @RequestMapping} annotations | ||
* such as {@code @GetMapping}, {@code @PutMapping}, etc. | ||
* | ||
* @author Mario Ruiz | ||
* @since 6.2 | ||
* @see GetMapping | ||
* @see PutMapping | ||
* @see PostMapping | ||
* @see DeleteMapping | ||
* @see PatchMapping | ||
* @see RequestMapping | ||
*/ | ||
@Target(ElementType.METHOD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Documented | ||
@RequestMapping(method = RequestMethod.QUERY) | ||
public @interface QueryMapping { | ||
|
||
/** | ||
* Alias for {@link RequestMapping#name}. | ||
*/ | ||
@AliasFor(annotation = RequestMapping.class) | ||
String name() default ""; | ||
|
||
/** | ||
* Alias for {@link RequestMapping#value}. | ||
*/ | ||
@AliasFor(annotation = RequestMapping.class) | ||
String[] value() default {}; | ||
|
||
/** | ||
* Alias for {@link RequestMapping#path}. | ||
*/ | ||
@AliasFor(annotation = RequestMapping.class) | ||
String[] path() default {}; | ||
|
||
/** | ||
* Alias for {@link RequestMapping#params}. | ||
*/ | ||
@AliasFor(annotation = RequestMapping.class) | ||
String[] params() default {}; | ||
|
||
/** | ||
* Alias for {@link RequestMapping#headers}. | ||
*/ | ||
@AliasFor(annotation = RequestMapping.class) | ||
String[] headers() default {}; | ||
|
||
/** | ||
* Alias for {@link RequestMapping#consumes}. | ||
*/ | ||
@AliasFor(annotation = RequestMapping.class) | ||
String[] consumes() default {}; | ||
|
||
/** | ||
* Alias for {@link RequestMapping#produces}. | ||
*/ | ||
@AliasFor(annotation = RequestMapping.class) | ||
String[] produces() default {}; | ||
|
||
} |
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
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
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
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
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.
Could it be better to use parametrized tests?