Просмотр исходного кода

网站路径优化(除掉新闻详情链接)

anderx лет назад: 4
Родитель
Сommit
f97ce66ad0

+ 6 - 0
src/main/java/com/kede/common/controller/WebpageController.java

@@ -8,6 +8,7 @@ import java.util.regex.Pattern;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -324,6 +325,11 @@ public class WebpageController extends BaseController {
 	public ModelAndView home(HttpServletRequest request, ModelAndView modelview) {
 		return protalIndex(request, modelview);
 	}
+
+	@RequestMapping(value = "/portal/index", method = RequestMethod.GET)
+	public String  portalIndex(HttpServletRequest request, ModelAndView modelview) {
+		return "redirect:/";
+	}
 	@SuppressWarnings("unchecked")
 	@RequestMapping(value = "/index", method = RequestMethod.GET)
 	public ModelAndView protalIndex(HttpServletRequest request, ModelAndView modelview) {

+ 0 - 1
src/main/resources/shiro_base_auth.ini

@@ -1,6 +1,5 @@
 [base_auth]
 /=device
-/portal/index=anon
 /login=anon
 /user/login.html=anon
 /user/login=anon

+ 23 - 23
src/main/resources/spring/spring-mvc.xml

@@ -3,27 +3,27 @@
 	xmlns:task="http://www.springframework.org/schema/task" xmlns:mvc="http://www.springframework.org/schema/mvc"
 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
 	xmlns:context="http://www.springframework.org/schema/context"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans 
-	http://www.springframework.org/schema/beans/spring-beans.xsd 
-	http://www.springframework.org/schema/context 
-	http://www.springframework.org/schema/context/spring-context-4.0.xsd 
+	xsi:schemaLocation="http://www.springframework.org/schema/beans
+	http://www.springframework.org/schema/beans/spring-beans.xsd
+	http://www.springframework.org/schema/context
+	http://www.springframework.org/schema/context/spring-context-4.0.xsd
 	http://www.springframework.org/schema/task
 	http://www.springframework.org/schema/task/spring-task-4.0.xsd
-	http://www.springframework.org/schema/mvc 
+	http://www.springframework.org/schema/mvc
 	http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
 
 	<!-- Scan controller -->
-		
+
 	<context:component-scan
 		base-package="com.kede.*.controller;com.kede.*.*.controller;com.kede.common.task;com.kede.core.websocket" />
 
 	<bean name="springContextUtils" class="com.kede.common.utils.SpringContextUtils" scope="singleton"></bean>
-	
+
 	<bean id="passwordUtil" class="com.kede.common.utils.PasswordUtil">
-		<property name="algorithmName" value="${pwd.hash_algorithm_name}"/>  
-	    <property name="hashIterations" value="${pwd.hash_iterations}"/> 
+		<property name="algorithmName" value="${pwd.hash_algorithm_name}"/>
+	    <property name="hashIterations" value="${pwd.hash_iterations}"/>
 	</bean>
-	
+
 	<!-- spring bean validator -->
 	<bean id="validator"
 		class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
@@ -50,15 +50,15 @@
 	</bean>
 
 
-	<!-- Handles HTTP GET requests for /assets/** by efficiently serving up 
+	<!-- Handles HTTP GET requests for /assets/** by efficiently serving up
 		static resources in the ${webappRoot}/assets directory -->
-	<mvc:resources mapping="/static/images/**" location="/WEB-INF/images/" />
-	<mvc:resources mapping="/static/html/**" location="/WEB-INF/html/" />
-	<mvc:resources mapping="/static/**" location="/WEB-INF/build/" />
-	<mvc:resources mapping="/favicon.ico" location="/WEB-INF/assets/favicon.ico" />
-	<mvc:resources mapping="/robots.txt" location="/WEB-INF/assets/robots.txt" />
-	
-	<bean id="templateResolver" 
+<!--	<mvc:resources mapping="/static/images/**" location="/WEB-INF/images/" />-->
+<!--	<mvc:resources mapping="/static/html/**" location="/WEB-INF/html/" />-->
+<!--	<mvc:resources mapping="/static/**" location="/WEB-INF/build/" />-->
+<!--	<mvc:resources mapping="/favicon.ico" location="/WEB-INF/assets/favicon.ico" />-->
+<!--	<mvc:resources mapping="/robots.txt" location="/WEB-INF/assets/robots.txt" />-->
+
+	<bean id="templateResolver"
         class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
         <property name="prefix" value="/WEB-INF/views/" />
         <property name="suffix" value=".html" />
@@ -71,13 +71,13 @@
     <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
         <property name="templateResolver" ref="templateResolver" />
     </bean>
-    
+
     <!-- Simple strategy: only path extension is taken into account -->
     <bean id="cnManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
         <property name="favorPathExtension" value="true"/>
         <property name="ignoreAcceptHeader" value="true"/>
         <property name="defaultContentType" value="text/html"/>
-        
+
         <property name="mediaTypes">
             <map>
                 <entry key="html" value="text/html" />
@@ -86,7 +86,7 @@
             </map>
         </property>
     </bean>
-    
+
     <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
         <property name="contentNegotiationManager" ref="cnManager"/>
         <property name="viewResolvers">
@@ -143,5 +143,5 @@
 		<property name="appName" value="${app.name}" />
 	</bean>
 	<bean id="systemWebSocketHandler" class="com.kede.core.websocket.SystemWebSocketHandler" scope="singleton"></bean>
-	
-</beans>
+
+</beans>

+ 9 - 9
src/main/resources/spring/spring-shiro.xml

@@ -32,17 +32,17 @@
 	<bean id="sessionRedisTemplate" class="com.kede.core.shiro.cache.template.SessionRedisTemplate">
 		<constructor-arg index="0" ref="redisConnectionFactory" />
 	</bean>
-	
+
 	<bean id="cacheManager" class="org.springframework.data.redis.cache.RedisCacheManager">
 		<constructor-arg index="0" ref="redisTemplate" />
-		<property name="defaultExpiration" value="86400" />		
+		<property name="defaultExpiration" value="86400" />
 	</bean>
-	
+
 	<bean id="shrioRedisCacheManager" class="com.kede.core.shiro.cache.ShiroRedisCacheManager">
 		<property name="redisTemplate" ref="sessionRedisTemplate" />
 		<property name="expire" value="2592000" />
 	</bean>
-     
+
 
 	<bean id="sessionIdGenerator"
 		class="org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator" />
@@ -124,9 +124,9 @@
 
 	<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
 		<property name="securityManager" ref="securityManager" />
-		<property name="loginUrl" value="/portal/index" />
+		<property name="loginUrl" value="/" />
 		<property name="successUrl" value="/" />
-		<property name="unauthorizedUrl" value="/portal/index" />
+		<property name="unauthorizedUrl" value="/" />
 		<property name="filterChainDefinitions" value="#{shiroManager.loadFilterChainDefinitions()}" />
 		<property name="filters">
 			<util:map>
@@ -135,12 +135,12 @@
 				</entry>
 				<entry key="permission">
 					<bean id="permission" class="com.kede.core.shiro.filter.PermissionFilter">
-						<property name="loginUrl" value="/portal/index" />
+						<property name="loginUrl" value="/" />
 					</bean>
 				</entry>
 				<entry key="admin">
 					<bean id="admin" class="com.kede.core.shiro.filter.AdminFilter">
-						<property name="loginUrl" value="/portal/index" />
+						<property name="loginUrl" value="/" />
 					</bean>
 				</entry>
 				<entry key="user">
@@ -156,4 +156,4 @@
 	</bean>
 	<!-- -->
 	<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />
-</beans>
+</beans>