32
32
import org .springframework .web .servlet .view .RedirectView ;
33
33
import ru .mystamps .web .common .LinkEntityDto ;
34
34
import ru .mystamps .web .common .LocaleUtils ;
35
- import ru .mystamps .web .feature .series .SeriesInfoDto ;
36
- import ru .mystamps .web .feature .series .SeriesService ;
35
+ import ru .mystamps .web .feature .series .SeriesUrl ;
37
36
import ru .mystamps .web .support .spring .mvc .ReplaceRepeatingSpacesEditor ;
38
37
import ru .mystamps .web .support .spring .security .CurrentUser ;
39
38
50
49
public class CategoryController {
51
50
52
51
private final CategoryService categoryService ;
53
- private final SeriesService seriesService ;
54
52
55
53
@ InitBinder ("addCategoryForm" )
56
54
protected void initBinder (WebDataBinder binder ) {
@@ -81,35 +79,7 @@ public String processInput(
81
79
82
80
redirectAttributes .addFlashAttribute ("justAddedCategory" , true );
83
81
84
- return redirectTo (CategoryUrl .INFO_CATEGORY_PAGE , slug );
85
- }
86
-
87
- // CheckStyle: ignore LineLength for next 1 line
88
- // @todo #927 CategoryController: remove dependency on SeriesService by moving showInfoBySlug() method
89
- @ GetMapping (CategoryUrl .INFO_CATEGORY_PAGE )
90
- public String showInfoBySlug (
91
- @ Category @ PathVariable ("slug" ) LinkEntityDto category ,
92
- Model model ,
93
- Locale userLocale ,
94
- HttpServletResponse response )
95
- throws IOException {
96
-
97
- if (category == null ) {
98
- response .sendError (HttpServletResponse .SC_NOT_FOUND );
99
- return null ;
100
- }
101
-
102
- String slug = category .getSlug ();
103
- String name = category .getName ();
104
-
105
- String lang = LocaleUtils .getLanguageOrNull (userLocale );
106
- List <SeriesInfoDto > series = seriesService .findByCategorySlug (slug , lang );
107
-
108
- model .addAttribute ("categorySlug" , slug );
109
- model .addAttribute ("categoryName" , name );
110
- model .addAttribute ("seriesOfCategory" , series );
111
-
112
- return "category/info" ;
82
+ return redirectTo (SeriesUrl .INFO_CATEGORY_PAGE , slug );
113
83
}
114
84
115
85
@ GetMapping (CategoryUrl .INFO_CATEGORY_BY_ID_PAGE )
@@ -125,7 +95,7 @@ public View showInfoById(
125
95
126
96
RedirectView view = new RedirectView ();
127
97
view .setStatusCode (HttpStatus .MOVED_PERMANENTLY );
128
- view .setUrl (CategoryUrl .INFO_CATEGORY_PAGE );
98
+ view .setUrl (SeriesUrl .INFO_CATEGORY_PAGE );
129
99
130
100
return view ;
131
101
}
0 commit comments