emoji langue
This commit is contained in:
@@ -6,6 +6,7 @@ import org.springframework.web.servlet.LocaleResolver;
|
||||
import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.support.ResourceBundleMessageSource;
|
||||
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -14,15 +15,15 @@ public class WebConfig {
|
||||
|
||||
@Bean
|
||||
public LocaleResolver localeResolver() {
|
||||
AcceptHeaderLocaleResolver localeResolver = new AcceptHeaderLocaleResolver();
|
||||
localeResolver.setDefaultLocale(Locale.FRENCH);
|
||||
return localeResolver;
|
||||
SessionLocaleResolver resolver = new SessionLocaleResolver();
|
||||
resolver.setDefaultLocale(Locale.FRENCH); // Définit la locale par défaut
|
||||
return resolver;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ResourceBundleMessageSource messageSource() {
|
||||
ResourceBundleMessageSource source = new ResourceBundleMessageSource();
|
||||
source.setBasenames("messages");
|
||||
source.setBasenames("i18n/messages");
|
||||
source.setDefaultEncoding("UTF-8");
|
||||
source.setUseCodeAsDefaultMessage(true);
|
||||
return source;
|
||||
|
||||
@@ -4,6 +4,8 @@ import fr.eni.enchere.bll.ArticleService;
|
||||
import fr.eni.enchere.bll.CategorieService;
|
||||
import fr.eni.enchere.bo.Article;
|
||||
import fr.eni.enchere.bo.SearchArticleCritere;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -12,9 +14,11 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
@Controller
|
||||
@@ -24,6 +28,7 @@ public class AccueilController {
|
||||
private ArticleService articleService;
|
||||
private CategorieService categorieService;
|
||||
|
||||
|
||||
public AccueilController(ArticleService articleService, CategorieService categorieService) {
|
||||
super();
|
||||
this.categorieService = categorieService;
|
||||
@@ -48,4 +53,5 @@ public class AccueilController {
|
||||
return viewAccueil(searchTitle, searchCategory, model);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class WebSecurityConfig{
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
http.authorizeHttpRequests((requests) -> requests
|
||||
.requestMatchers("/", "/accueil").permitAll()
|
||||
.requestMatchers("/accueil", "/login", "/inscription/**", "/searchArticle", "/profile/**").permitAll()
|
||||
.requestMatchers("/accueil", "/login", "/inscription/**", "/searchArticle", "/profile/**", "/change-language").permitAll()
|
||||
.requestMatchers("/css/**", "/images/**", "/assets/**", "/img/**", "/js/**").permitAll()
|
||||
.requestMatchers("/article/**").authenticated()
|
||||
.requestMatchers("/admin").hasRole("ADMIN")
|
||||
|
||||
Reference in New Issue
Block a user