![]() |
|
[Java] Should Spring Boot Mapping be letter for letter when referencing a file to return? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] Should Spring Boot Mapping be letter for letter when referencing a file to return? (/showthread.php?tid=6110115) |
Should Spring Boot Mapping be letter for letter when referencing a file to return? - Chukozy - Sep 18, 2020 Hi guys, Using Spring Boot, I was wondering when using the @GetMapping() method, is it a good practice to do letter-for-letter reference when returning a particular file such an HTML, or have more practical text in the URL? Example: Code @GetMapping("/favourite-apps")or should it be strictly what the file name is? RE: Should Spring Boot Mapping be letter for letter when referencing a file to return? - knox - Sep 21, 2020 I would say prefer easy to read, but still relatively short URLs. "/favourite-apps" is good. The main reason I say that is that it's a better user experience for whoever is visiting your site, and it can improve search engine rankings. For internal file names (e.g. "favapps.html"), it's purely up to your preference. Whatever style you pick for that, just stay consistent. RE: Should Spring Boot Mapping be letter for letter when referencing a file to return? - G.P.D. - Oct 2, 2020 If you want to do a redirection, it's not done properly. You can use ModelAndView Object to redirect : Code @GetMapping("/favourite-apps")Or HttpServletResponse : Code @GetMapping("/favourite-apps")302 is the HTTP redirection code. Hmu if you need help RE: Should Spring Boot Mapping be letter for letter when referencing a file to return? - Chukozy - Oct 2, 2020 (Oct 2, 2020 12:10 AM)Whait Wrote: If you want to do a redirection, it's not done properly. Taking note, thank you! I'm learning all this now. I tip my hat to you! RE: Should Spring Boot Mapping be letter for letter when referencing a file to return? - G.P.D. - Oct 2, 2020 (Oct 2, 2020 10:56 AM)Chukozy Wrote: Taking note, thank you! I'm learning all this now. I tip my hat to you! There is no problem bro. PM me in case you're stuck while programming ! |