url - No mapping found for HTTP request with URI in Jboss-Spring integration web project -
hi problem encountered related url mapping quite confusing me.
the project "jboss-spring integration". project started without error, keep getting these msg:
8:53:58,959 warn [pagenotfound] no mapping found http request uri [/frontend/portal/afasfas/asdsad] in dispatcherservlet name 'nuslibraries'
18:54:08,992 warn [pagenotfound] no mapping found http request uri [/frontend/portal/afasfas] in dispatcherservlet name '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)); } } }
your handlermapping
seems unnecessarily complex. if want map requests single controller, mark default mapping:
<bean id="handlermapping" class="org.springframework.web.servlet.handler.simpleurlhandlermapping"> <property name="defaulthandler" value="springcontroller"/> </bean>
Comments
Post a Comment