Привет, проблема, с которой я столкнулся, связана с отображением URL, что довольно смущает меня.
Проект "Интеграция Jboss-Spring".Проект запущен без ошибок, но я продолжаю получать эти сообщения:
8: 53: 58,959 WARN [PageNotFound] Не найдено сопоставление для HTTP-запроса с URI [/ frontend / portal / afasfas / asdsad] вDispatcherServlet с именем 'NUSLibraries'
18: 54: 08,992 WARN [PageNotFound] Не найдено сопоставление для HTTP-запроса с URI [/ frontend / portal / afasfas] в DispatcherServlet с именем «NUSLibraries»
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>frontend</display-name>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
<filter>
<filter-name>Seam Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Seam Resource Servlet</servlet-name>
<servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Seam Resource Servlet</servlet-name>
<url-pattern>/seam/resource/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<security-constraint>
<display-name>Restrict raw XHTML Documents</display-name>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
<servlet>
<servlet-name>NUSLibraries</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>NUSLibraries</servlet-name>
<url-pattern>/portal/*</url-pattern>
</servlet-mapping>
</web-app>
servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:seam="http://jboss.com/products/seam/spring-seam"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://jboss.com/products/seam/spring-seam
http://jboss.com/products/seam/spring-seam-2.2.xsd">
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name="suffix">
<value>.xhtml</value>
</property>
</bean>
<!-- Controller -->
<bean id="SpringController" class="org.domain.frontend.controller.SpringController" scope="prototype">
<property name="portalStaticPage" ref="ActionPortalStaticPage">
</property>
</bean>
<seam:instance name="ActionPortalStaticPage" id="ActionPortalStaticPage" create="false"/>
<bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
/*/*/*=SpringController
</value>
</property>
</bean>
</beans>
SpringController
package org.domain.frontend.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.StringTokenizer;
import javax.persistence.NoResultException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.domain.frontend.session.ActionPortalStaticPage;
import org.jboss.seam.annotations.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.support.RequestContextUtils;
@Controller
@Transactional
public class SpringController{
static Logger log = Logger.getLogger("SpringController");
public ActionPortalStaticPage portalStaticPage;
public void setPortalStaticPage(ActionPortalStaticPage portalStaticPage) {
this.portalStaticPage = portalStaticPage;
}
@RequestMapping("/*/*/{param}")
public ModelAndView langzh(HttpServletRequest request, HttpServletResponse response, @PathVariable("param") String param) throws Exception {
List<String> params = new ArrayList<String>();
try{
log.info("param("+param+")");
StringTokenizer st = new StringTokenizer(param,"-");
while (st.hasMoreTokens()) {
params.add(st.nextToken());
}
portalStaticPage.setTitle(params.toString());
log.info("portalStaticPage("+portalStaticPage.getTitle()+")");
return new ModelAndView("index");
}
catch(Exception ex){
ex.printStackTrace();
return new ModelAndView(params.get(0));
}
}
}