PrettyFaces将友好的URL重定向到不友好的URL,我想保留友好的URL

时间:2016-04-04 12:50:17

标签: jsf url-rewriting spring-webflow prettyfaces

我必须为我的网站添加一些SEO功能。 Site基于带有JSF,PrettyFaces和Promefaces的Spring Webflow。

我制作了像/Hanover/100+300这样的网址。一切正常。 Prettyfaces从此URL重定向到/app/tyres,查询参数为bean中的参数。

但我需要保留并查看第一个状态的网址。像/Hanover/100+300...一样没有重定向它。

最好的方法是什么?

谢谢!

漂亮-faces.xml

<url-mapping id="search">
    <pattern value="/search/#{searchtype}/#{city}/#{dimens}" />

    <view-id value="/app/tyres" />
</url-mapping>

webflow.xml

<flow-executor id="flowExecutor">
    <flow-execution-listeners>
        <listener ref="facesContextListener"/>
    </flow-execution-listeners>
</flow-executor>

<flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/flows">
    <flow-location-pattern value="/**/flow.xml" />
</flow-registry>

<faces:flow-builder-services id="flowBuilderServices"/>  

<beans:bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener"/>

的web.xml

<servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
        <multipart-config>
            <max-file-size>5000000</max-file-size>
        </multipart-config>
    </servlet>

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/app/*</url-pattern>
        <url-pattern>/admin/*</url-pattern>
        <url-pattern>/search/*</url-pattern>
        <url-pattern>/main/*</url-pattern>
    </servlet-mapping>

servlet-context.xml的一部分

<beans:bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
    <beans:property name="flowRegistry" ref="flowRegistry"/>
</beans:bean>

<beans:bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
    <beans:property name="flowExecutor" ref="flowExecutor"/>
    <beans:property name="flowUrlHandler" ref="customDefaultUrlhandler"/>
</beans:bean>

<beans:bean id="customDefaultUrlhandler" class="de.tyresnow.web.utils.CustomDefaultFlowUrlHandler"/>

<flow:flow-executor id="flowExecutor" flow-registry="flowRegistry"/>

0 个答案:

没有答案