显示页面时图像不呈现。但是,如果我打开图像并修改URL(请参见下文),它将显示出来。我不确定这是Spring的安全配置还是项目中刚错过的某些东西。
有效的修改后的网址:
http://localhost:8080/myproject/javax.faces.resources/images/logo.png.xhtml
项目结构:
webapp
--> resources
--> css
--> images
--> logo.png
--> js
我的查看代码段:
<p:graphicImage styleClass="siteLogo" alt="site_logo" value="images/logo.png" rendered="#{business rule to render it}"/>
安全配置:
http
.authorizeRequests()
.antMatchers("/login.xhtml").permitAll() // All everyone to see login page
.antMatchers("/login").permitAll() // All everyone to see login page
.antMatchers("/views/**").hasAnyAuthority("ROLE_AUTH")
.antMatchers("/javax.faces.resource/**").permitAll().anyRequest().permitAll() // All everyone to see resources
.antMatchers("/resources/**").permitAll().anyRequest().permitAll() // All everyone to see resources
.anyRequest().authenticated(); // Ensure any request to application is authenticated