The Jetty virtual directory needs to be configured in the project to place some pictures. The code is as follows:
<plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jetty.version}</version> <configuration> <encoding>UTF-8</encoding> <scanIntervalSeconds>10</scanIntervalSeconds> <contextXml>${project.basedir}/src/test/resources/jetty-context.xml</contextXml> <!-- <jettyXml>${project.basedir}/src/test/resources/jetty.xml</jettyXml> --> <webAppConfig> <defaultsDescriptor>${project.basedir}/src/test/resources/webdefault.xml</defaultsDescriptor> </webAppConfig> <stopKey> foo </stopKey> <stopPort>9999</stopPort> <webApp> <contextPath>/</contextPath> </webApp> <!-- Additional listening directories --> <contextHandlers> <!-- Attachment Directory Service--> <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext"> <contextPath>/upload</contextPath> <resourceBase>/home/baseos/upload/</resourceBase> </contextHandler> </contextHandlers> </configuration> <executions> <execution> <id>start-jetty</id> <phase>pre-integration-test</phase> <goals> <goal>run</goal> </goals> <configuration> <scanIntervalSeconds>0</scanIntervalSeconds> <daemon>true</daemon> </configuration> </execution> <execution> <id>stop-jetty</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin>
When accessing the service /upload, it is equivalent to accessing the /home/baseos/upload/ file path
The weblogic.xml code reference is as follows:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd"> <wls:weblogic-web-app xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"> <wls:virtual-directory-mapping> <wls:local-path>/weblogic/</wls:local-path> <wls:url-pattern>/myimages/*</wls:url-pattern> </wls:virtual-directory-mapping> </wls:weblogic-web-app>
Accessing the service /myimages is equivalent to accessing the / weblogic / myimages file path