From c8db7fb9bc930f2a133773d9b5ec1c5e06f7926a Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Wed, 21 Sep 2022 17:44:07 +0400 Subject: [PATCH] add resources example --- .../email/configuration/MvcConfiguration.java | 49 ++++++++++++++++++ src/main/resources/public/img/logo.png | Bin 0 -> 5181 bytes src/main/resources/templates/list.html | 1 + 3 files changed, 50 insertions(+) create mode 100644 src/main/java/email/configuration/MvcConfiguration.java create mode 100644 src/main/resources/public/img/logo.png diff --git a/src/main/java/email/configuration/MvcConfiguration.java b/src/main/java/email/configuration/MvcConfiguration.java new file mode 100644 index 0000000..6f12a16 --- /dev/null +++ b/src/main/java/email/configuration/MvcConfiguration.java @@ -0,0 +1,49 @@ +package email.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.LocaleResolver; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.i18n.CookieLocaleResolver; +import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; + +@Configuration +public class MvcConfiguration implements WebMvcConfigurer { + @Override + public void addViewControllers(ViewControllerRegistry registry) { + registry.addViewController("/{articlename:\\w+}"); + } + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry + .addResourceHandler("/webjars/**") + .addResourceLocations("/webjars/"); + } + + @Bean + public LocaleResolver localeResolver() { + return new CookieLocaleResolver(); + } + + @Bean + public LocaleChangeInterceptor localeInterceptor() { + LocaleChangeInterceptor localeInterceptor = new LocaleChangeInterceptor(); + localeInterceptor.setParamName("lang"); + return localeInterceptor; + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(localeInterceptor()); + } + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**"); + } +} diff --git a/src/main/resources/public/img/logo.png b/src/main/resources/public/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..da902fab7848130da4fb496f5d158a4509dd67a6 GIT binary patch literal 5181 zcmV-D6vFF?P)+0$%DJl5)_#-1DxU{n%ARw2NlNc8k?(OXw8XEQV^e84J6B850#l_^} z;fjZct*NJ8US4o;aNF3|84?k{y}Stk0Mg3H)X>i$8yPk-F)u4BOiN3op`d7FV>~)J zMnFDRQc-<*c)G5t2@4F$z`d%RnZmcTosEeS3I}&(U}#uXEF&O!ZEB5rbyh(5RKjvURj1Rb|4*nQNgqtrFEkQv_S31pGNRQAtZDP%&l(gu#@UwOqOEH3_zEfP^S2yFXx zfstU*faOY35oPA9Q~S$uOmd5hxvD9}I5z#N93$zECafRI0R?c(S5@~*ntSkD?g5s) zZY>TAJyiP(8jrTgaMxKI0T>V9*w^!8ZEm^8#*cXG{nv{XF?edgS}8rV_exO3uf;J? z!eMUJ2RZ1+z7oe;+)~{k5;2Z_p&*z9tEPb;4lEeQrgr%?fRS{iH@LNMPR!cFl+6AT zD>jN-^}&o|Um*x?#e~SMGlw&def||2&8_+b2RSxqTRw>Zx6HBJlBa0vPtUP#@H8rz z`22p1)iMsS#@cTZvYN-IU9pZ5j-My1myW*=e_7fl!(H~pghQul=*K>%@gV8qa&FZp zd(4lmJ|D0Stn!TCIyzn1>^~#NI^4Rv*z`F$*2%Y)BmCCU5G)A(T=^I=-aFjVt{BAI zxS)zZJ`b=qx313ZImbSagTC5t9S!uUIM#vn;|gxoL-9?CPvOUi(NeF!h2NBh!SL3l6ZHS-Sx8w?#8Wp$YZ&~L@%5}+i&fZ zo47TRpft^M97Rz=5Jhnu$J4aGiSSN-OALnMgjrw|R#eSq_+EDOjU1Yd0zG_nItog%h%6*Hy0E3AjUE%6ILk)){B z%SX2X2c`-O@sO`)^Qx*Ml&YFd#-B;TVzb=i*)GsNGO|#+#u+gq9|E||QY<`> zjc%*hxdGYL+yYdaE$~5Q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@&7G^uei{!KprMKd&;@eE6|In)aa~60vpXS60E?^ z_#>Xux~Gtc?{S;mhd$1o_cW4YoLl>9WU=K=LgbS!>LrGQotZUz?gx80NdGpsCOkTqV$UzXtzC|_VnyVZs@s2^ zTPVe$dS+hpQ(h-H##hTedc5LqNZp}@lUkim){cb)?Iy7r82T+R@PFTApm=3Njjk&R zb~vWXXK&a-egwBrltp7s<16|tX>&|Gs|?&?!PAGJ!Y6eaS&@IX=G!m0G-4+aLTJXZ znp=0C?^wy2xLTdvmk0@1LaUk&bBcZ6h6tWMhFd5`Yr}4PE~gn19B9)!?=Yay7z@VUjJJzz%lN-Gz>W5W-ULATPTs= z#6>TT5D!99@wlPJ9=V|($1Rk|Z&ry$?5PaP;R!e37_IIyy{l#J-VN75i1q%F+(Oy7 z)BEF^clWa8LO^l?r)NfD-vH00000NkvXXu0mjf;tw*N literal 0 HcmV?d00001 diff --git a/src/main/resources/templates/list.html b/src/main/resources/templates/list.html index 3364366..219643d 100644 --- a/src/main/resources/templates/list.html +++ b/src/main/resources/templates/list.html @@ -89,6 +89,7 @@ --> Отправить другое сообщение +