Skip to content

Commit d3d3175

Browse files
committed
Replace @RequestMapping by @GetMapping/@PostMapping.
No functional changes.
1 parent cde2613 commit d3d3175

9 files changed

+44
-52
lines changed

src/main/java/ru/mystamps/web/controller/AccountController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
import org.springframework.validation.BindingResult;
2828
import org.springframework.validation.annotation.Validated;
2929
import org.springframework.web.bind.WebDataBinder;
30+
import org.springframework.web.bind.annotation.GetMapping;
3031
import org.springframework.web.bind.annotation.InitBinder;
3132
import org.springframework.web.bind.annotation.PathVariable;
32-
import org.springframework.web.bind.annotation.RequestMapping;
33-
import org.springframework.web.bind.annotation.RequestMethod;
33+
import org.springframework.web.bind.annotation.PostMapping;
3434
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
3535

3636
import lombok.RequiredArgsConstructor;
@@ -65,12 +65,12 @@ protected void activationInitBinder(WebDataBinder binder) {
6565
binder.registerCustomEditor(String.class, "name", new StringTrimmerEditor(true));
6666
}
6767

68-
@RequestMapping(Url.REGISTRATION_PAGE)
68+
@GetMapping(Url.REGISTRATION_PAGE)
6969
public RegisterAccountForm showRegistrationForm() {
7070
return new RegisterAccountForm();
7171
}
7272

73-
@RequestMapping(value = Url.REGISTRATION_PAGE, method = RequestMethod.POST)
73+
@PostMapping(Url.REGISTRATION_PAGE)
7474
public String processRegistrationForm(
7575
@Valid RegisterAccountForm form,
7676
BindingResult result,
@@ -88,12 +88,12 @@ public String processRegistrationForm(
8888
return "redirect:" + Url.ACTIVATE_ACCOUNT_PAGE;
8989
}
9090

91-
@RequestMapping(Url.ACTIVATE_ACCOUNT_PAGE)
91+
@GetMapping(Url.ACTIVATE_ACCOUNT_PAGE)
9292
public ActivateAccountForm showActivationForm() {
9393
return new ActivateAccountForm();
9494
}
9595

96-
@RequestMapping(Url.ACTIVATE_ACCOUNT_PAGE_WITH_KEY)
96+
@GetMapping(Url.ACTIVATE_ACCOUNT_PAGE_WITH_KEY)
9797
public String showActivationFormWithKey(
9898
@PathVariable("key") String activationKey,
9999
Model model) {
@@ -105,7 +105,7 @@ public String showActivationFormWithKey(
105105
return "account/activate";
106106
}
107107

108-
@RequestMapping(value = Url.ACTIVATE_ACCOUNT_PAGE, method = RequestMethod.POST)
108+
@PostMapping(Url.ACTIVATE_ACCOUNT_PAGE)
109109
public String processActivationForm(
110110
@Validated({
111111
LoginChecks.class, NameChecks.class, PasswordChecks.class,

src/main/java/ru/mystamps/web/controller/CategoryController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
import org.springframework.ui.Model;
3030
import org.springframework.validation.BindingResult;
3131
import org.springframework.web.bind.WebDataBinder;
32+
import org.springframework.web.bind.annotation.GetMapping;
3233
import org.springframework.web.bind.annotation.InitBinder;
3334
import org.springframework.web.bind.annotation.PathVariable;
34-
import org.springframework.web.bind.annotation.RequestMapping;
35-
import org.springframework.web.bind.annotation.RequestMethod;
35+
import org.springframework.web.bind.annotation.PostMapping;
3636
import org.springframework.web.servlet.View;
3737
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
3838
import org.springframework.web.servlet.view.RedirectView;
@@ -68,12 +68,12 @@ protected void initBinder(WebDataBinder binder) {
6868
binder.registerCustomEditor(String.class, "nameRu", editor);
6969
}
7070

71-
@RequestMapping(Url.ADD_CATEGORY_PAGE)
71+
@GetMapping(Url.ADD_CATEGORY_PAGE)
7272
public AddCategoryForm showForm() {
7373
return new AddCategoryForm();
7474
}
7575

76-
@RequestMapping(value = Url.ADD_CATEGORY_PAGE, method = RequestMethod.POST)
76+
@PostMapping(Url.ADD_CATEGORY_PAGE)
7777
public String processInput(
7878
@Valid AddCategoryForm form,
7979
BindingResult result,
@@ -91,7 +91,7 @@ public String processInput(
9191
return redirectTo(Url.INFO_CATEGORY_PAGE, slug);
9292
}
9393

94-
@RequestMapping(Url.INFO_CATEGORY_PAGE)
94+
@GetMapping(Url.INFO_CATEGORY_PAGE)
9595
public String showInfoBySlug(
9696
@Category @PathVariable("slug") LinkEntityDto category,
9797
Model model,
@@ -117,7 +117,7 @@ public String showInfoBySlug(
117117
return "category/info";
118118
}
119119

120-
@RequestMapping(Url.INFO_CATEGORY_BY_ID_PAGE)
120+
@GetMapping(Url.INFO_CATEGORY_BY_ID_PAGE)
121121
public View showInfoById(
122122
@Category @PathVariable("slug") LinkEntityDto country,
123123
HttpServletResponse response)
@@ -135,7 +135,7 @@ public View showInfoById(
135135
return view;
136136
}
137137

138-
@RequestMapping(Url.LIST_CATEGORIES_PAGE)
138+
@GetMapping(Url.LIST_CATEGORIES_PAGE)
139139
public void list(Model model, Locale userLocale) {
140140
String lang = LocaleUtils.getLanguageOrNull(userLocale);
141141
List<LinkEntityDto> categories = categoryService.findAllAsLinkEntities(lang);

src/main/java/ru/mystamps/web/controller/CollectionController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
import org.springframework.http.HttpStatus;
2828
import org.springframework.stereotype.Controller;
2929
import org.springframework.ui.Model;
30+
import org.springframework.web.bind.annotation.GetMapping;
3031
import org.springframework.web.bind.annotation.PathVariable;
31-
import org.springframework.web.bind.annotation.RequestMapping;
3232
import org.springframework.web.servlet.View;
3333
import org.springframework.web.servlet.view.RedirectView;
3434

@@ -53,7 +53,7 @@ public class CollectionController {
5353
private final SeriesService seriesService;
5454
private final MessageSource messageSource;
5555

56-
@RequestMapping(Url.INFO_COLLECTION_PAGE)
56+
@GetMapping(Url.INFO_COLLECTION_PAGE)
5757
public String showInfoBySlug(
5858
@PathVariable("slug") String slug,
5959
Model model,
@@ -102,7 +102,7 @@ public String showInfoBySlug(
102102
return "collection/info";
103103
}
104104

105-
@RequestMapping(Url.INFO_COLLECTION_BY_ID_PAGE)
105+
@GetMapping(Url.INFO_COLLECTION_BY_ID_PAGE)
106106
public View showInfoById(
107107
@PathVariable("slug") String slug,
108108
HttpServletResponse response)

src/main/java/ru/mystamps/web/controller/CountryController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
import org.springframework.ui.Model;
3030
import org.springframework.validation.BindingResult;
3131
import org.springframework.web.bind.WebDataBinder;
32+
import org.springframework.web.bind.annotation.GetMapping;
3233
import org.springframework.web.bind.annotation.InitBinder;
3334
import org.springframework.web.bind.annotation.PathVariable;
34-
import org.springframework.web.bind.annotation.RequestMapping;
35-
import org.springframework.web.bind.annotation.RequestMethod;
35+
import org.springframework.web.bind.annotation.PostMapping;
3636
import org.springframework.web.servlet.View;
3737
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
3838
import org.springframework.web.servlet.view.RedirectView;
@@ -66,12 +66,12 @@ protected void initBinder(WebDataBinder binder) {
6666
binder.registerCustomEditor(String.class, "nameRu", editor);
6767
}
6868

69-
@RequestMapping(Url.ADD_COUNTRY_PAGE)
69+
@GetMapping(Url.ADD_COUNTRY_PAGE)
7070
public AddCountryForm showForm() {
7171
return new AddCountryForm();
7272
}
7373

74-
@RequestMapping(value = Url.ADD_COUNTRY_PAGE, method = RequestMethod.POST)
74+
@PostMapping(Url.ADD_COUNTRY_PAGE)
7575
public String processInput(
7676
@Valid AddCountryForm form,
7777
BindingResult result,
@@ -89,7 +89,7 @@ public String processInput(
8989
return redirectTo(Url.INFO_COUNTRY_PAGE, slug);
9090
}
9191

92-
@RequestMapping(Url.INFO_COUNTRY_PAGE)
92+
@GetMapping(Url.INFO_COUNTRY_PAGE)
9393
public String showInfoBySlug(
9494
@Country @PathVariable("slug") LinkEntityDto country,
9595
Model model,
@@ -118,7 +118,7 @@ public String showInfoBySlug(
118118
/**
119119
* @author Aleksander Parkhomenko
120120
*/
121-
@RequestMapping(Url.INFO_COUNTRY_BY_ID_PAGE)
121+
@GetMapping(Url.INFO_COUNTRY_BY_ID_PAGE)
122122
public View showInfoById(
123123
@Country @PathVariable("slug") LinkEntityDto country,
124124
HttpServletResponse response)
@@ -136,7 +136,7 @@ public View showInfoById(
136136
return view;
137137
}
138138

139-
@RequestMapping(Url.LIST_COUNTRIES_PAGE)
139+
@GetMapping(Url.LIST_COUNTRIES_PAGE)
140140
public void list(Model model, Locale userLocale) {
141141
String lang = LocaleUtils.getLanguageOrNull(userLocale);
142142
List<LinkEntityDto> countries = countryService.findAllAsLinkEntities(lang);

src/main/java/ru/mystamps/web/controller/ImageController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import javax.servlet.http.HttpServletResponse;
2323

2424
import org.springframework.stereotype.Controller;
25+
import org.springframework.web.bind.annotation.GetMapping;
2526
import org.springframework.web.bind.annotation.PathVariable;
26-
import org.springframework.web.bind.annotation.RequestMapping;
2727

2828
import lombok.RequiredArgsConstructor;
2929

@@ -37,7 +37,7 @@ public class ImageController {
3737

3838
private final ImageService imageService;
3939

40-
@RequestMapping(Url.GET_IMAGE_PAGE)
40+
@GetMapping(Url.GET_IMAGE_PAGE)
4141
public void getImage(@PathVariable("id") Integer imageId, HttpServletResponse response)
4242
throws IOException {
4343

src/main/java/ru/mystamps/web/controller/RobotsTxtController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
import org.slf4j.LoggerFactory;
2727

2828
import org.springframework.stereotype.Controller;
29-
import org.springframework.web.bind.annotation.RequestMapping;
29+
import org.springframework.web.bind.annotation.GetMapping;
3030

3131
import ru.mystamps.web.Url;
3232

3333
@Controller
3434
public class RobotsTxtController {
3535
private static final Logger LOG = LoggerFactory.getLogger(RobotsTxtController.class);
3636

37-
@RequestMapping(Url.ROBOTS_TXT)
37+
@GetMapping(Url.ROBOTS_TXT)
3838
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
3939
public void getRobotsText(HttpServletResponse response) {
4040
response.setContentType("text/plain");

src/main/java/ru/mystamps/web/controller/SeriesController.java

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
import org.springframework.validation.BindingResult;
4141
import org.springframework.validation.annotation.Validated;
4242
import org.springframework.web.bind.WebDataBinder;
43+
import org.springframework.web.bind.annotation.GetMapping;
4344
import org.springframework.web.bind.annotation.InitBinder;
4445
import org.springframework.web.bind.annotation.ModelAttribute;
4546
import org.springframework.web.bind.annotation.PathVariable;
46-
import org.springframework.web.bind.annotation.RequestMapping;
47-
import org.springframework.web.bind.annotation.RequestMethod;
47+
import org.springframework.web.bind.annotation.PostMapping;
4848
import org.springframework.web.bind.annotation.RequestParam;
4949
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
5050

@@ -124,7 +124,7 @@ public List<LinkEntityDto> getCountries(Locale userLocale) {
124124
return countryService.findAllAsLinkEntities(lang);
125125
}
126126

127-
@RequestMapping(Url.ADD_SERIES_PAGE)
127+
@GetMapping(Url.ADD_SERIES_PAGE)
128128
public AddSeriesForm showForm() {
129129

130130
AddSeriesForm addSeriesForm = new AddSeriesForm();
@@ -133,7 +133,7 @@ public AddSeriesForm showForm() {
133133
return addSeriesForm;
134134
}
135135

136-
@RequestMapping(Url.ADD_SERIES_WITH_CATEGORY_PAGE)
136+
@GetMapping(Url.ADD_SERIES_WITH_CATEGORY_PAGE)
137137
public String showFormWithCategory(
138138
@Category @PathVariable("slug") LinkEntityDto category,
139139
Model model) {
@@ -147,7 +147,7 @@ public String showFormWithCategory(
147147
return "series/add";
148148
}
149149

150-
@RequestMapping(Url.ADD_SERIES_WITH_COUNTRY_PAGE)
150+
@GetMapping(Url.ADD_SERIES_WITH_COUNTRY_PAGE)
151151
public String showFormWithCountry(
152152
@Country @PathVariable("slug") LinkEntityDto country,
153153
Model model) {
@@ -161,7 +161,7 @@ public String showFormWithCountry(
161161
return "series/add";
162162
}
163163

164-
@RequestMapping(value = Url.ADD_SERIES_PAGE, method = RequestMethod.POST)
164+
@PostMapping(Url.ADD_SERIES_PAGE)
165165
public String processInput(
166166
@Validated({ Default.class,
167167
AddSeriesForm.ReleaseDateChecks.class,
@@ -183,7 +183,7 @@ public String processInput(
183183
return redirectTo(Url.INFO_SERIES_PAGE, seriesId);
184184
}
185185

186-
@RequestMapping(Url.INFO_SERIES_PAGE)
186+
@GetMapping(Url.INFO_SERIES_PAGE)
187187
public String showInfo(
188188
@PathVariable("id") Integer seriesId,
189189
Model model,
@@ -215,7 +215,7 @@ public String showInfo(
215215
return "series/info";
216216
}
217217

218-
@RequestMapping(value = Url.ADD_IMAGE_SERIES_PAGE, method = RequestMethod.POST)
218+
@PostMapping(Url.ADD_IMAGE_SERIES_PAGE)
219219
public String processImage(
220220
@Valid AddImageForm form,
221221
BindingResult result,
@@ -256,11 +256,7 @@ public String processImage(
256256
return redirectTo(Url.INFO_SERIES_PAGE, series.getId());
257257
}
258258

259-
@RequestMapping(
260-
value = Url.INFO_SERIES_PAGE,
261-
method = RequestMethod.POST,
262-
params = "action=ADD"
263-
)
259+
@PostMapping(value = Url.INFO_SERIES_PAGE, params = "action=ADD")
264260
public String addToCollection(
265261
@PathVariable("id") Integer seriesId,
266262
@AuthenticationPrincipal CustomUserDetails currentUserDetails,
@@ -289,11 +285,7 @@ public String addToCollection(
289285
return redirectTo(Url.INFO_COLLECTION_PAGE, collectionSlug);
290286
}
291287

292-
@RequestMapping(
293-
value = Url.INFO_SERIES_PAGE,
294-
method = RequestMethod.POST,
295-
params = "action=REMOVE"
296-
)
288+
@PostMapping(value = Url.INFO_SERIES_PAGE, params = "action=REMOVE")
297289
public String removeFromCollection(
298290
@PathVariable("id") Integer seriesId,
299291
@CurrentUser Integer currentUserId,
@@ -319,7 +311,7 @@ public String removeFromCollection(
319311
return redirectTo(Url.INFO_COLLECTION_PAGE, collection.getSlug());
320312
}
321313

322-
@RequestMapping(value = Url.SEARCH_SERIES_BY_CATALOG, method = RequestMethod.POST)
314+
@PostMapping(Url.SEARCH_SERIES_BY_CATALOG)
323315
public String searchSeriesByCatalog(
324316
@RequestParam("catalogNumber") String catalogNumber,
325317
@RequestParam("catalogName") String catalogName,

src/main/java/ru/mystamps/web/controller/SiteController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import org.springframework.stereotype.Controller;
2424
import org.springframework.ui.Model;
25-
import org.springframework.web.bind.annotation.RequestMapping;
25+
import org.springframework.web.bind.annotation.GetMapping;
2626
import org.springframework.web.bind.annotation.RequestParam;
2727

2828
import lombok.RequiredArgsConstructor;
@@ -57,7 +57,7 @@ public class SiteController {
5757
private final SeriesService seriesService;
5858
private final SuspiciousActivityService suspiciousActivityService;
5959

60-
@RequestMapping(Url.INDEX_PAGE)
60+
@GetMapping(Url.INDEX_PAGE)
6161
public String showIndexPage(Model model, Locale userLocale) {
6262
long categoryCounter = categoryService.countAll();
6363
long countryCounter = countryService.countAll();
@@ -87,7 +87,7 @@ public String showIndexPage(Model model, Locale userLocale) {
8787
* @author Sergey Chechenev
8888
* @author Slava Semushin
8989
*/
90-
@RequestMapping(Url.SITE_EVENTS_PAGE)
90+
@GetMapping(Url.SITE_EVENTS_PAGE)
9191
public void viewSiteEvents(
9292
@RequestParam(value = "page", defaultValue = "1") int pageNum,
9393
Model model) {

src/main/java/ru/mystamps/web/controller/SitemapController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.slf4j.LoggerFactory;
3030

3131
import org.springframework.stereotype.Controller;
32-
import org.springframework.web.bind.annotation.RequestMapping;
32+
import org.springframework.web.bind.annotation.GetMapping;
3333

3434
import lombok.RequiredArgsConstructor;
3535

@@ -48,7 +48,7 @@ public class SitemapController {
4848

4949
private final SeriesService seriesService;
5050

51-
@RequestMapping(Url.SITEMAP_XML)
51+
@GetMapping(Url.SITEMAP_XML)
5252
public void getSitemapXml(HttpServletResponse response) {
5353
response.setContentType("application/xml");
5454
response.setCharacterEncoding("UTF-8");

0 commit comments

Comments
 (0)