Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
539 views
in Technique[技术] by (71.8m points)

servlets - Redirect context root in Weblogic

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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...