我正在尝试将正则表达式添加到骆驼路线中。但是我真的没有任何暗示。我正在使用此路由来服务器静态资源(index.html):

from("pjetty:http://0.0.0.0:{{http.port}}/user/?matchOnUriPrefix=true")
    .process( new StaticProcessor( "/dist/", "index.html", "dist"))
    .routeId( "static");


我可以通过以下网址访问index.html:

http://loccalhost:8080/user/index.html
http://localhost:8080/user/


现在,我希望任何以http://loccalhost:8080/user开头的URL呈现索引页。喜欢:

http://loccalhost:8080/user/abc/index.html
http://localhost:8080/user/test/
http://localhost:8080/user/anyting


我该如何实现?

最佳答案

骆驼不是Web服务器,所以无论您要呈现还是作为Web响应返回,它都是您在自己编写的StaticProcessor中所做的任何事情。

您可以从Camel Message标头中获得所请求的实际URL,然后从该信息中确定要呈现的内容。

07-28 01:52
查看更多