낙타 경로에서 정적 파일을 제공하려고합니다.낙타 경로가있는 정적 파일 검색
public final void configure() throws Exception {
// declaring camel routes
// match on uri prefix must be true when parameters are passed as part of the uri
// for example, "http://localhost/hello/rick"
// http.port is in local.properties file user-api
from("jetty:http://0.0.0.0:{{http.port}}/user/dist/?matchOnUriPrefix=true")
.process(new StaticProcessor("help", "index.html", "dist"))
.routeId("static");
from("jetty:http://0.0.0.0:{{http.port}}/user?matchOnUriPrefix=true")
.to("cxfbean:userService");
}
이 잘 작동합니다
내 주요 클래스의 노선이 코드 조각이 포함되어 있습니다. URL : http://xxxx:8086/user/dist/index.html
을 누르면 내 색인 페이지가 렌더링되고 URL은 인 것으로 표시됩니다. 내가 페이지 (F5 키)를 다시로드 할 때
는하지만, URL은된다 : http://xxxx:8086/user/dist//
와 나는 같은 오류가 발생합니다 :
이 페이지는 자신감으로 대체되어 있어야합니다. swagger-maven-plugin에 대한 유일한 참조로 응용 프로그램의 pom.xml에 다음과 같은 내용이 있습니까?
<build> <plugins> <plugin> <groupId>com.github.kongchen</groupId> <artifactId>swagger-maven-plugin</artifactId> <executions> <execution> <id>swagger</id> <phase>compile</phase> </execution> </executions> </plugin> </plugins> </build>
나는 나의 효과적인 POM이 의존성을 가지고있다. 그래서 나는 무엇을 놓치고 있습니까?
나는 http://clv035sl-8947d6:8888/user/dist
을 가진 어떤 URL이라도 index.html
으로 전화를 걸어야한다는 것을 알고 싶다. 왜 내가 URL의 끝에 index.html
을 명시 적으로 작성해야합니까?
도움이나 의견을 보내 주시면 감사하겠습니다.
안녕하세요! "jetty : http : ///.0.0.0 : {{http.port}}/user/dist? matchOnUriPrefix = true"와 같이 "dist"에서 슬래시 바 "/"를 제거하려고 했습니까? 아니면 서블릿을 처리하는 중에 경로에서 허풍이 생길 수도 있습니다. 결과를 보려면 제거하려고하십시오. –
@RicardoZanini, dist 뒤에 "/"를 제거하려고했으나 작동하지 않았습니다. : –