Skip to content

Commit f49958b

Browse files
committed
chore: drop support of deprecated URLs.
BREAKING CHANGE: the following URLs aren't supported anymore: - /account/activate/key/{key} - /category/list - /category/{id}/{slug} - /country/list - /country/{id}/{slug} - /collection/{id}/{slug} - /series/add/category/{slug} - /series/add/country/{slug} They have been deprecated a long time ago and shouldn't be used. Fix #1120
1 parent 8ed92bf commit f49958b

File tree

10 files changed

+0
-162
lines changed

10 files changed

+0
-162
lines changed

src/main/java/ru/mystamps/web/feature/account/AccountController.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,15 @@
2020
import lombok.RequiredArgsConstructor;
2121
import org.apache.commons.lang3.StringUtils;
2222
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
23-
import org.springframework.http.HttpStatus;
2423
import org.springframework.stereotype.Controller;
2524
import org.springframework.validation.BindingResult;
2625
import org.springframework.validation.annotation.Validated;
2726
import org.springframework.web.bind.WebDataBinder;
2827
import org.springframework.web.bind.annotation.GetMapping;
2928
import org.springframework.web.bind.annotation.InitBinder;
30-
import org.springframework.web.bind.annotation.PathVariable;
3129
import org.springframework.web.bind.annotation.PostMapping;
3230
import org.springframework.web.bind.annotation.RequestParam;
33-
import org.springframework.web.servlet.View;
3431
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
35-
import org.springframework.web.servlet.view.RedirectView;
3632
import ru.mystamps.web.feature.account.ActivateAccountForm.ActKeyChecks;
3733
import ru.mystamps.web.feature.account.ActivateAccountForm.FormChecks;
3834
import ru.mystamps.web.feature.account.ActivateAccountForm.LoginChecks;
@@ -96,20 +92,6 @@ public ActivateAccountForm showActivationForm(
9692
return form;
9793
}
9894

99-
@GetMapping(AccountUrl.ACTIVATE_ACCOUNT_PAGE_WITH_KEY)
100-
public View showActivationFormWithKey(
101-
@PathVariable("key") String activationKey,
102-
RedirectAttributes redirectAttributes) {
103-
104-
redirectAttributes.addAttribute("key", activationKey);
105-
106-
RedirectView view = new RedirectView();
107-
view.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
108-
view.setUrl(AccountUrl.ACTIVATE_ACCOUNT_PAGE);
109-
110-
return view;
111-
}
112-
11395
@PostMapping(AccountUrl.ACTIVATE_ACCOUNT_PAGE)
11496
public String processActivationForm(
11597
@Validated({

src/main/java/ru/mystamps/web/feature/account/AccountUrl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public final class AccountUrl {
3535
public static final String LOGOUT_PAGE = "/account/logout";
3636
public static final String ACTIVATE_ACCOUNT_PAGE = "/account/activate";
3737

38-
// For backward compatibility
39-
static final String ACTIVATE_ACCOUNT_PAGE_WITH_KEY = "/account/activate/key/{key}";
40-
4138
private AccountUrl() {
4239
}
4340

src/main/java/ru/mystamps/web/feature/category/CategoryController.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,21 @@
1818
package ru.mystamps.web.feature.category;
1919

2020
import lombok.RequiredArgsConstructor;
21-
import org.springframework.http.HttpStatus;
2221
import org.springframework.stereotype.Controller;
2322
import org.springframework.ui.Model;
2423
import org.springframework.validation.BindingResult;
2524
import org.springframework.web.bind.WebDataBinder;
2625
import org.springframework.web.bind.annotation.GetMapping;
2726
import org.springframework.web.bind.annotation.InitBinder;
28-
import org.springframework.web.bind.annotation.PathVariable;
2927
import org.springframework.web.bind.annotation.PostMapping;
30-
import org.springframework.web.servlet.View;
3128
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
32-
import org.springframework.web.servlet.view.RedirectView;
3329
import ru.mystamps.web.common.LinkEntityDto;
3430
import ru.mystamps.web.common.LocaleUtils;
3531
import ru.mystamps.web.feature.series.SeriesUrl;
3632
import ru.mystamps.web.support.spring.mvc.ReplaceRepeatingSpacesEditor;
3733
import ru.mystamps.web.support.spring.security.CurrentUser;
3834

39-
import javax.servlet.http.HttpServletResponse;
4035
import javax.validation.Valid;
41-
import java.io.IOException;
4236
import java.util.List;
4337
import java.util.Locale;
4438

@@ -82,24 +76,6 @@ public String processInput(
8276
return redirectTo(SeriesUrl.INFO_CATEGORY_PAGE, slug);
8377
}
8478

85-
@GetMapping(CategoryUrl.INFO_CATEGORY_BY_ID_PAGE)
86-
public View showInfoById(
87-
@Category @PathVariable("slug") LinkEntityDto country,
88-
HttpServletResponse response)
89-
throws IOException {
90-
91-
if (country == null) {
92-
response.sendError(HttpServletResponse.SC_NOT_FOUND);
93-
return null;
94-
}
95-
96-
RedirectView view = new RedirectView();
97-
view.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
98-
view.setUrl(SeriesUrl.INFO_CATEGORY_PAGE);
99-
100-
return view;
101-
}
102-
10379
@GetMapping(CategoryUrl.GET_CATEGORIES_PAGE)
10480
public String showCategories(Model model, Locale userLocale) {
10581
String lang = LocaleUtils.getLanguageOrNull(userLocale);
@@ -110,13 +86,5 @@ public String showCategories(Model model, Locale userLocale) {
11086
return "category/list";
11187
}
11288

113-
@GetMapping(CategoryUrl.LIST_CATEGORIES_PAGE)
114-
public View list() {
115-
RedirectView view = new RedirectView();
116-
view.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
117-
view.setUrl(CategoryUrl.GET_CATEGORIES_PAGE);
118-
return view;
119-
}
120-
12189
}
12290

src/main/java/ru/mystamps/web/feature/category/CategoryUrl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ public final class CategoryUrl {
3333
public static final String ADD_CATEGORY_PAGE = "/category/add";
3434
static final String GET_CATEGORIES_PAGE = "/categories";
3535

36-
// For backward compatibility
37-
static final String LIST_CATEGORIES_PAGE = "/category/list";
38-
static final String INFO_CATEGORY_BY_ID_PAGE = "/category/{id}/{slug}";
39-
4036
private CategoryUrl() {
4137
}
4238

src/main/java/ru/mystamps/web/feature/collection/CollectionController.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@
1919

2020
import lombok.RequiredArgsConstructor;
2121
import org.springframework.context.MessageSource;
22-
import org.springframework.http.HttpStatus;
2322
import org.springframework.stereotype.Controller;
2423
import org.springframework.ui.Model;
2524
import org.springframework.web.bind.annotation.GetMapping;
2625
import org.springframework.web.bind.annotation.PathVariable;
27-
import org.springframework.web.servlet.View;
28-
import org.springframework.web.servlet.view.RedirectView;
2926
import ru.mystamps.web.common.LocaleUtils;
3027
import ru.mystamps.web.feature.category.CategoryService;
3128
import ru.mystamps.web.feature.country.CountryService;
@@ -123,30 +120,6 @@ public String showPrices(
123120

124121
return "collection/estimation";
125122
}
126-
127-
@GetMapping(CollectionUrl.INFO_COLLECTION_BY_ID_PAGE)
128-
public View showInfoById(
129-
@PathVariable("slug") String slug,
130-
HttpServletResponse response)
131-
throws IOException {
132-
133-
if (slug == null) {
134-
response.sendError(HttpServletResponse.SC_NOT_FOUND);
135-
return null;
136-
}
137-
138-
CollectionInfoDto collection = collectionService.findBySlug(slug);
139-
if (collection == null) {
140-
response.sendError(HttpServletResponse.SC_NOT_FOUND);
141-
return null;
142-
}
143-
144-
RedirectView view = new RedirectView();
145-
view.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
146-
view.setUrl(CollectionUrl.INFO_COLLECTION_PAGE);
147-
148-
return view;
149-
}
150123

151124
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
152125
private List<Object[]> getCountriesStatistics(Integer collectionId, String lang) {

src/main/java/ru/mystamps/web/feature/collection/CollectionUrl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@
2626
*
2727
* @author Slava Semushin
2828
*/
29-
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
3029
public final class CollectionUrl {
3130

3231
public static final String INFO_COLLECTION_PAGE = "/collection/{slug}";
3332
public static final String ESTIMATION_COLLECTION_PAGE = "/collection/{slug}/estimation";
3433

35-
// For backward compatibility
36-
static final String INFO_COLLECTION_BY_ID_PAGE = "/collection/{id}/{slug}";
37-
3834
private CollectionUrl() {
3935
}
4036

src/main/java/ru/mystamps/web/feature/country/CountryController.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,21 @@
1818
package ru.mystamps.web.feature.country;
1919

2020
import lombok.RequiredArgsConstructor;
21-
import org.springframework.http.HttpStatus;
2221
import org.springframework.stereotype.Controller;
2322
import org.springframework.ui.Model;
2423
import org.springframework.validation.BindingResult;
2524
import org.springframework.web.bind.WebDataBinder;
2625
import org.springframework.web.bind.annotation.GetMapping;
2726
import org.springframework.web.bind.annotation.InitBinder;
28-
import org.springframework.web.bind.annotation.PathVariable;
2927
import org.springframework.web.bind.annotation.PostMapping;
30-
import org.springframework.web.servlet.View;
3128
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
32-
import org.springframework.web.servlet.view.RedirectView;
3329
import ru.mystamps.web.common.LinkEntityDto;
3430
import ru.mystamps.web.common.LocaleUtils;
3531
import ru.mystamps.web.feature.series.SeriesUrl;
3632
import ru.mystamps.web.support.spring.mvc.ReplaceRepeatingSpacesEditor;
3733
import ru.mystamps.web.support.spring.security.CurrentUser;
3834

39-
import javax.servlet.http.HttpServletResponse;
4035
import javax.validation.Valid;
41-
import java.io.IOException;
4236
import java.util.List;
4337
import java.util.Locale;
4438

@@ -82,27 +76,6 @@ public String processInput(
8276
return redirectTo(SeriesUrl.INFO_COUNTRY_PAGE, slug);
8377
}
8478

85-
/**
86-
* @author Aleksander Parkhomenko
87-
*/
88-
@GetMapping(CountryUrl.INFO_COUNTRY_BY_ID_PAGE)
89-
public View showInfoById(
90-
@Country @PathVariable("slug") LinkEntityDto country,
91-
HttpServletResponse response)
92-
throws IOException {
93-
94-
if (country == null) {
95-
response.sendError(HttpServletResponse.SC_NOT_FOUND);
96-
return null;
97-
}
98-
99-
RedirectView view = new RedirectView();
100-
view.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
101-
view.setUrl(SeriesUrl.INFO_COUNTRY_PAGE);
102-
103-
return view;
104-
}
105-
10679
@GetMapping(CountryUrl.GET_COUNTRIES_PAGE)
10780
public String showCountries(Model model, Locale userLocale) {
10881
String lang = LocaleUtils.getLanguageOrNull(userLocale);
@@ -113,13 +86,5 @@ public String showCountries(Model model, Locale userLocale) {
11386
return "country/list";
11487
}
11588

116-
@GetMapping(CountryUrl.LIST_COUNTRIES_PAGE)
117-
public View list() {
118-
RedirectView view = new RedirectView();
119-
view.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
120-
view.setUrl(CountryUrl.GET_COUNTRIES_PAGE);
121-
return view;
122-
}
123-
12489
}
12590

src/main/java/ru/mystamps/web/feature/country/CountryUrl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ public final class CountryUrl {
3333
public static final String ADD_COUNTRY_PAGE = "/country/add";
3434
static final String GET_COUNTRIES_PAGE = "/countries";
3535

36-
// For backward compatibility
37-
static final String LIST_COUNTRIES_PAGE = "/country/list";
38-
static final String INFO_COUNTRY_BY_ID_PAGE = "/country/{id}/{slug}";
39-
4036
private CountryUrl() {
4137
}
4238

src/main/java/ru/mystamps/web/feature/series/SeriesController.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import lombok.RequiredArgsConstructor;
2121
import org.apache.commons.lang3.StringUtils;
2222
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
23-
import org.springframework.http.HttpStatus;
2423
import org.springframework.security.core.annotation.AuthenticationPrincipal;
2524
import org.springframework.stereotype.Controller;
2625
import org.springframework.ui.Model;
@@ -32,9 +31,7 @@
3231
import org.springframework.web.bind.annotation.PathVariable;
3332
import org.springframework.web.bind.annotation.PostMapping;
3433
import org.springframework.web.bind.annotation.RequestParam;
35-
import org.springframework.web.servlet.View;
3634
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
37-
import org.springframework.web.servlet.view.RedirectView;
3835
import ru.mystamps.web.common.EntityWithParentDto;
3936
import ru.mystamps.web.common.LinkEntityDto;
4037
import ru.mystamps.web.common.LocaleUtils;
@@ -144,34 +141,6 @@ public void showForm(
144141
model.addAttribute("addSeriesForm", addSeriesForm);
145142
}
146143

147-
@GetMapping(SeriesUrl.ADD_SERIES_WITH_CATEGORY_PAGE)
148-
public View showFormWithCategory(
149-
@PathVariable("slug") String category,
150-
RedirectAttributes redirectAttributes) {
151-
152-
redirectAttributes.addAttribute("category", category);
153-
154-
RedirectView view = new RedirectView();
155-
view.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
156-
view.setUrl(SeriesUrl.ADD_SERIES_PAGE);
157-
158-
return view;
159-
}
160-
161-
@GetMapping(SeriesUrl.ADD_SERIES_WITH_COUNTRY_PAGE)
162-
public View showFormWithCountry(
163-
@PathVariable("slug") String country,
164-
RedirectAttributes redirectAttributes) {
165-
166-
redirectAttributes.addAttribute("country", country);
167-
168-
RedirectView view = new RedirectView();
169-
view.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
170-
view.setUrl(SeriesUrl.ADD_SERIES_PAGE);
171-
172-
return view;
173-
}
174-
175144
@PostMapping(path = SeriesUrl.ADD_SERIES_PAGE, params = "imageUrl")
176145
public String processInputWithImageUrl(
177146
@Validated({ Default.class,

src/main/java/ru/mystamps/web/feature/series/SeriesUrl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ public final class SeriesUrl {
3838
public static final String SERIES_INFO_PAGE_REGEXP = "/series/(\\d+|\\d+/(ask|image))";
3939
static final String SEARCH_SERIES_BY_CATALOG = "/series/search/by_catalog";
4040

41-
// For backward compatibility
42-
static final String ADD_SERIES_WITH_CATEGORY_PAGE = "/series/add/category/{slug}";
43-
static final String ADD_SERIES_WITH_COUNTRY_PAGE = "/series/add/country/{slug}";
44-
4541
private SeriesUrl() {
4642
}
4743

0 commit comments

Comments
 (0)