Redirect context root in Weblogic

懵懂的女人 提交于 2019-12-14 03:01:45

问题


I have Spring Boot application which I deploy to Weblogic container.

After it is deployed, I can access it using http://localhost:7001/my-application/

When I use http://localhost:7001/my-application - without trailing slash at the end, I'd like to redirect it to http://localhost:7001/my-application/

I know that Tomcat already has such feature as there is a flag you can change:

/**
* Whether requests to the context root should be redirected by appending a / to
* the path.
*/
private Boolean redirectContextRoot;

Is there any similar setting in Weblogic?

EDIT: Adding weblogic.xml:

<?xml version='1.0' encoding='UTF-8'?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
        http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">

    <container-descriptor>
        <prefer-web-inf-classes>false</prefer-web-inf-classes>
        <prefer-application-packages>
            <package-name>com.google.*</package-name>
            <package-name>javax.persistence.*</package-name>
            <package-name>javax.persistence.spi*</package-name>
            <package-name>org.apache.commons.*</package-name>
            <package-name>org.hibernate.*</package-name>
            <package-name>org.hibernate.validator.*</package-name>
            <package-name>org.joda.*</package-name>
            <package-name>org.springframework.*</package-name>
            <package-name>org.slf4j.*</package-name>
            <package-name>ch.qos.logback.*</package-name>
            <package-name>org.objectweb.asm.*</package-name>
            <package-name>antlr.*</package-name>
            <package-name>javax.validation.*</package-name>
            <package-name>javax.validation.spi*</package-name>
            <package-name>javassist.*</package-name>
        </prefer-application-packages>
    </container-descriptor>

    <context-root>/my-application</context-root>

    <charset-params>
        <input-charset>
            <resource-path>*</resource-path>
            <java-charset-name>UTF-8</java-charset-name>
        </input-charset>
    </charset-params>

</weblogic-web-app>

来源:https://stackoverflow.com/questions/47312119/redirect-context-root-in-weblogic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!