我最近开始了解 Confluence 的 servlet-filter 模块。然而,在试图让它工作之后,我遇到了死胡同。我在这里获取我的信息:
这是我尝试过的。我像这样注释了我的 atlassian-plugin.xml 文件:
<servlet-filter name="My Test Filter" key="OURAPP" class="com.test.filters.HelloWorldFilter" location="after-encoding" weight="100">
<description>Forwards you to a test "Hello, world!" page.</description>
<url-pattern>/helloworld</url-pattern>
<dispatcher>REQUEST</dispatcher>
</servlet-filter>
然后,我在 com/test/filters 创建了一个名为 HelloWorldFilter.java 的标准 Java servlet(扩展 HttpServlet 等)。在“doGet()”方法中,我只有一个 System.out.println() 行,上面写着“IN THE FILTER”。但是,当我转到以下 URL 时,总是会收到“找不到页面”错误页面:
http://127.0.0.1:8090/helloworld
http://127.0.0.1:8090/OURAPP/helloworld
http://127.0.0.1:8090/plugins/OURAPP/helloworld
http://127.0.0.1:8090/rest/helloworld
http://127.0.0.1:8090/rest/OURAPP/helloworld
http://127.0.0.1:8090/OURAPP/rest/helloworld
我们有一个自定义的 Confluence 插件,我们称之为 OURAPP,它不仅通过浏览器 GUI 提供数据,还通过 Confluence 的 REST 功能提供数据。我正在尝试创建一个管理有效和无效请求的过滤器。我们可以通过以下方式访问 REST:
http://127.0.0.1:8090/rest/reststuff/v1/some_function_here
就像我一开始说的那样,我在这里遇到了死胡同,无法弄清楚如何让它发挥作用。任何人都可以提供有关如何使其正常工作的任何建议或示例代码吗?