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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…