标签:覆盖 syn 访客 tor operator trade ext you ide
https://github.com/171437912/shiro_ssm_Demo.git
import com.jagregory.shiro.freemarker.ShiroTags;
import freemarker.template.TemplateException;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import java.io.IOException;
/**
* 继承FreeMarkerConfigurer类,重写afterPropertiesSet()方法;
* 集成shiroTags标签
* Created by zsc on 2016/1/5.
*/
public class ShiroTagFreeMarkerConfigurer extends FreeMarkerConfigurer {
@Override
public void afterPropertiesSet() throws IOException, TemplateException {
super.afterPropertiesSet();
this.getConfiguration().setSharedVariable("shiro", new ShiroTags());
}
}
<!--<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">-->
<bean id="freemarkerConfig" class="com.***.shiro.tag.ShiroTagFreeMarkerConfigurer">
<!--shiro标签仅限用在该路径下的ftl页面,不能使用include引入-->
<property name="templateLoaderPath" value="/WEB-INF/viewftl/" />
<property name="freemarkerSettings">
<props>
<prop key="template_update_delay">0</prop>
<prop key="default_encoding">utf-8</prop>
<prop key="number_format">\#0.\#\#\#\#\#</prop>
<prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
<prop key="classic_compatible">true</prop>
<prop key="template_exception_handler">ignore</prop>
<!--<prop key="auto_import">/common/page.ftl as p</prop>-->
<!--<prop key="auto_include">/common/page.ftl</prop>-->
</props>
</property>
</bean>
<!-- shiro 安全过滤器 -->
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<async-supported>true</async-supported>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>*.htm</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<!-- sitemesh 装饰配置 -->
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
标签:覆盖 syn 访客 tor operator trade ext you ide
原文地址:http://www.cnblogs.com/liuyingke/p/7723238.html