最近、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 サーブレット (HttpServlet などを拡張) を作成しました。「doGet()」メソッドには、「IN THE FILTER」と書かれた System.out.println() 行があるだけです。ただし、次の 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
最初に言ったように、私はここで行き詰まりに陥っており、これを機能させる方法がわかりません。これを機能させる方法の提案やサンプルコードを誰かが提供できますか?