{"id":860,"date":"2018-02-24T20:44:57","date_gmt":"2018-02-24T17:44:57","guid":{"rendered":"http:\/\/leodev.ru\/blog\/?p=860"},"modified":"2018-02-24T21:00:17","modified_gmt":"2018-02-24T18:00:17","slug":"spring-pathvariable-%d0%b8%d0%b3%d0%bd%d0%be%d1%80%d0%b8%d1%80%d1%83%d0%b5%d1%82-%d1%81%d0%b8%d0%bc%d0%b2%d0%be%d0%bb%d1%8b","status":"publish","type":"post","link":"https:\/\/leodev.ru\/blog\/spring\/spring-pathvariable-%d0%b8%d0%b3%d0%bd%d0%be%d1%80%d0%b8%d1%80%d1%83%d0%b5%d1%82-%d1%81%d0%b8%d0%bc%d0%b2%d0%be%d0%bb%d1%8b\/","title":{"rendered":"Spring MVC \u2013 @PathVariable \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0447\u043a\u0438"},"content":{"rendered":"<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h2>\n<p>\u0421\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u043e\u0431\u0440\u0435\u0437\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u00a0<strong>fileName.XLS<\/strong> \u0438\u043b\u0438 <strong>fileName.XLSX\u00a0<\/strong>\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043f\u0440\u0438\u043b\u0435\u0442\u0430\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e\u00a0<strong>fileName.<\/strong><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"lang:java decode:true\">@RequestMapping(value = \"\/files\/{fileName}\", method = RequestMethod.GET)\r\n    public void getFile(@PathVariable(\"fileName\") String fileName) {\r\n...\r\n}<\/pre>\n<p><!--more--><\/p>\n<p>\u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b :<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0432\u0435\u0441\u0442\u0438 <strong>\/files\/leodev<\/strong>, &#171;fileName&#187; \u0432\u044b\u0432\u0435\u0434\u0435\u0442\u00a0<strong>leodev<\/strong><br \/>\n\u0415\u0441\u043b\u0438 \u0432\u0432\u0435\u0441\u0442\u0438 <strong>\/files\/leodev.ru<\/strong>, &#171;fileName&#187; \u0432\u044b\u0432\u0435\u0434\u0435\u0442 <strong>leodev<\/strong>, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0442\u043e\u0447\u043a\u0430(.) \u043e\u0442\u0441\u0435\u043a\u0430\u0435\u0442\u0441\u044f!?!?<br \/>\n\u0415\u0441\u043b\u0438 \u0432\u0432\u0435\u0441\u0442\u0438 <strong>\/files\/leodev.ru.com<\/strong>, &#171;fileName&#187; \u0432\u044b\u0432\u0435\u0434\u0435\u0442 <strong>leodev.ru<\/strong>, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0442\u043e\u0447\u043a\u0430(.) \u043e\u0442\u0441\u0435\u043a\u0430\u0435\u0442\u0441\u044f!<br \/>\n\u0415\u0441\u043b\u0438 \u0432\u0432\u0435\u0441\u0442\u0438<strong> \/files\/leodev.ru.com<\/strong>.<strong>abc<\/strong>, &#171;fileName&#187;\u00a0\u0432\u044b\u0432\u0435\u0434\u0435\u0442 <strong>leodev.ru.com<\/strong><br \/>\n\u0415\u0441\u043b\u0438 \u0432\u0432\u0435\u0441\u0442\u0438 <strong>\/files\/blog.leodev.ru<\/strong>, &#171;fileName&#187; \u0432\u044b\u0432\u0435\u0434\u0435\u0442 <strong>blog.leodev<\/strong><br \/>\n<em>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0442\u043e\u0447\u043a\u0430 (.) \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0441\u0435\u043a\u0430\u0442\u044c\u0441\u044f<\/em><\/p>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0427\u0442\u043e \u0431\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u00a0\u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0443 <strong>\/files\/{file_name:.+}<\/strong> \u0432 <strong>@RequestMapping<\/strong><\/p>\n<p><em>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438\u00a0\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0448\u0430\u0431\u043b\u043e\u043d <strong>URI<\/strong> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u043c\u0443 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044e <strong>[^ \\.] *<\/strong> (\u0422.\u0435. \u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043e\u0442 \u043f\u0435\u0440\u0438\u043e\u0434\u0430), \u043d\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043a\u0430\u0437\u0430\u0432 \u0434\u0440\u0443\u0433\u043e\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/em><\/p>\n<pre class=\"lang:java decode:true\">@RequestMapping(value = \"\/files\/{file_name:.+}\", method = RequestMethod.GET)\r\n    public void getFile(@PathVariable(\"file_name\") String fileName, HttpServletResponse response) {\r\n\/\/...\r\n}<\/pre>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e Regular expression<\/h2>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u043d\u0438\u0436\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043d\u0430\u0448\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435:<\/p>\n<p><strong>. <\/strong>(\u0442\u043e\u0447\u043a\u0430)\u00a0&#8212; \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0448\u0435\u0433\u043e file_name \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d \u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b<\/p>\n<p><strong>+<\/strong>(\u043f\u043b\u044e\u0441) &#8212; \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0447\u043a\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0447\u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435<\/p>\n<blockquote><p>========== \u041c\u0415\u0422\u0410\u0421\u0418\u041c\u0412\u041e\u041b\u042b ============<br \/>\n^ (\u0446\u0438\u0440\u043a\u0443\u043c\u0444\u043b\u0435\u043a\u0441) &#8212; \u043d\u0430\u0447\u0430\u043b\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<br \/>\n$ (\u0434\u043e\u043b\u043b\u0430\u0440) &#8212; \u043a\u043e\u043d\u0435\u0446 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<br \/>\n. (\u0442\u043e\u0447\u043a\u0430) &#8212; \u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b<br \/>\n| &#8212; \u0418\u041b\u0418<br \/>\n? &#8212; \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u0441\u0438\u043c\u0432\u043e\u043b \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439<br \/>\n+ &#8212; \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<br \/>\n* &#8212; \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b-\u0432\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430(\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0435)<br \/>\n\\\\d &#8212; \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0441\u0438\u0432\u043e\u043b<br \/>\n\\\\D &#8212; \u041d\u0415 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0441\u0438\u0432\u043e\u043b<br \/>\n\\\\s &#8212; \u043f\u0440\u043e\u0431\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b<br \/>\n\\\\S &#8212; \u041d\u0415 \u043f\u0440\u043e\u0431\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b<br \/>\n\\\\w &#8212; \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u043b\u0438 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0438\u043b\u0438 \u0437\u043d\u0430\u043a \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u044f<br \/>\n\\\\W &#8212; \u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043a\u0440\u043e\u043c\u0435 \u0431\u0443\u043a\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u0438\u043b\u0438 \u0437\u043d\u0430\u043a\u0430 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u044f<\/p>\n<p><span style=\"color: #1a1a1a; font-size: 16px;\">========== \u041a\u0412\u0410\u041d\u0422\u0418\u0424\u0418\u041a\u0410\u0422\u041e\u0420\u042b ============<\/span><\/p>\n<p><span style=\"color: #1a1a1a;\"><span style=\"font-size: 16px;\">+(\u043f\u043b\u044e\u0441\/\u0437\u043d\u0430\u043a \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u0438) &#8212; \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u0438\u043c\u0432\u043e\u043b<\/span><\/span><\/p><\/blockquote>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p><a href=\"https:\/\/ru.wikipedia.org\/wiki\/\u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435_\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e Regular expression<\/a><\/p>\n<p><a href=\"https:\/\/docs.spring.io\/spring\/docs\/current\/spring-framework-reference\/web.html#mvc\">Spring WebMVC<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0421\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u043e\u0431\u0440\u0435\u0437\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u00a0fileName.XLS \u0438\u043b\u0438 fileName.XLSX\u00a0\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043f\u0440\u0438\u043b\u0435\u0442\u0430\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e\u00a0fileName. &nbsp; @RequestMapping(value = &#171;\/files\/{fileName}&#187;, method = RequestMethod.GET) public void getFile(@PathVariable(&#171;fileName&#187;) String fileName) { &#8230; }<\/p>\n","protected":false},"author":1,"featured_media":704,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93,228],"tags":[231,230,229,232,227,146],"class_list":["post-860","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring","category-spring-mvc","tag-pathvariable","tag-regexp","tag-regular-expression","tag-requestmapping","tag-soring-mvc","tag-spring"],"_links":{"self":[{"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/posts\/860","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/comments?post=860"}],"version-history":[{"count":5,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/posts\/860\/revisions"}],"predecessor-version":[{"id":865,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/posts\/860\/revisions\/865"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/media\/704"}],"wp:attachment":[{"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/media?parent=860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/categories?post=860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/tags?post=860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}