チュートリアルの
Getting startedを行う。今回作るのは、サーバ版アドオンで言う所のサーブレットモジュールである。
なお、Windows8ですべてローカルで賄うものとする。
local開発用Confluenceを起動を以前のエントリ通り行っているものとする。
HTTPDを用意する
nginxをここからダウンロードしてインストール。
conf/nginx.confを
server { listen 8080; server_name localhost;
としてポートを変更。nginxをcygwinから起動。
ファイルを用意する
2枚だけでOK。
これをnginxのDocumentRootから/dev/helloworldのパスに置くものとする。
descriptorファイルを
{ "name": "Hello World", "description": "Atlassian Connect add-on", "key": "com.example.myaddon.helloworld", "baseUrl": "http://localhost:8080/dev/helloworld", "vendor": { "name": "Junoe, Inc.", "url": "http://www.junoe.jp" }, "authentication": { "type": "none" }, "apiVersion": 1, "modules": { "generalPages": [ { "url": "/helloworld.html", "key": "hello-world", "location": "system.content.action", "name": { "value": "Greeting" } } ] } }
baseUrlをnginxのポートと、このdescriptorファイルのある位置に合わせて変更する。
generalPagesのurlは、baseUrlからのパスを変更して使う。
- baseUrlには最後に/を付けないで、
- 他のUrlを示す箇所には、baseUrlからの・・・という意味で頭に/を付ける。
ようにする。(マイルール)
あと、generalPagesのリンク元を"location": "system.content.action"にして各ページのツールブルダウンから
表示させる内容のHTML
上述のAtlassianのページから拝借。JIRA用なので、Confluence用にちょいと変更する。
ここで重要になるのは、
http://localhost:1990/confluence/atlassian-connect/all.js。これを読み込まないとサーブレット(もどき)はrunしない。しかし、all.jsはサーバ側じゃなくてconfluence側にあるので後々これは動的に生成しなければいけないはずで・・・・それは後で何とかするんだろう・・・。
ということで、HTMLはこんな感じ。
<!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="//aui-cdn.atlassian.com/aui-adg/5.4.3/css/aui.css" media="all"> <script src="//localhost:1990/confluence/atlassian-connect/all.js" type="text/javascript"></script> </head> <body> <section id="content" class="ac-content"> <div class="aui-page-header"> <div class="aui-page-header-main"> <h1>Hello World</h1> </div> </div> </section> </body> </html>
これでおしまい。あとは、ローカルConfluenceからインストールする。
結果
これだけ。