Custom Content Module with Spring Boot

I manged to create a simple spring-boot-example with a staticContentMacro for confluence cloud with

  • Atlassian-Connect-Spring-Boot: link://bitbucket.org/atlassian/atlassian-connect-spring-boot/src/master/
  • Development-Confluence-Cloud: link://developer.atlassian.com/cloud/confluence/getting-started/

But for that i need ngrok which is shown me with the example of link://blog.seibert-media.net/blog/2017/11/23/hands-on-confluence-cloud-apps-mit-spring-boot-und-atlassian-connect-teil-1/.

Also i found the documentation for

  • Modules: link://developer.atlassian.com/cloud/confluence/modules/custom-content/
  • App-Connect-Descriptor: link://developer.atlassian.com/cloud/jira/platform/app-descriptor/
    modules

But beside link://developer.atlassian.com/cloud/confluence/custom-content-with-confluence-connect/ i found no example for a custom content example in the spring-boot framework.

Could you give me a hint where i find a working example?

For me it seems difficult to understood the parametrization of the atlassian-connect.json and the Annotation- and Request-Settings of the Spring-Boot AddonApplication, because i have no base reference for getting into the atlassian-framework (i.e. receiving, sending data vice versa).

Regards,
Matthias

@MatthiasWegner, I see you posted a follow-up thread Static Content Macro with Spring Boot, so I’m not sure if you still need any input here. I have a couple of comments though.

Avoid the Static Content Macro module if you can. It has major drawbacks compared to Dynamic Content Macros. Where the former require page-blocking server-to-server requests to obtain Confluence storage format from an app endpoint you provide, the latter simply render an iframe and a request is made from the user’s browser.

The Custom Content module mostly consists of configuration. There are a few references to UI extension points, but they are typically to the Page module.

For getting started with atlassian-connect-spring-boot and Cacheable app iframes, the approach we recommend for serving static HTML/CSS/JS as your modules, using the Spring Boot app as your backing API, have a look at [atlassian-connect-spring-boot-sample-cacheable-macro/](https://bitbucket.org/atlassian/atlassian-connect-spring-boot-samples/src/master/atlassian-connect-spring-boot-sample-cacheable-macro.

Thank you for your answer. I get the static content macro working and In my mind i though this was the best solution. I tell you my requirements.

I want to “upload” some hundred datatables which all have a key and a value string representation of strings, lists and maps. In my first atlassian-rest-solution i created them inside a page-properties-macro and the rendered them by my own and pushed them rendered in the page.

Now i want to build a more intelligent solution and want to store somehow each data-maps inside a page and then render them inside the page.

I thought to use a static content macro where the rich-text-content inside the macro is the datatable and i render the content of the table via spring boot.

I want to avoid “traffic” and only want to update the pages if they are added or changed. So wat is a good module to render trafficless data in a page.

@MatthiasWegner, I see. Well, if Static Content Macros had supported evaluation only at insertion-time, it seems like they would have been a good fit.

But as it is, the best way to reduce traffic is to use a Dynamic Content Macro backed by a static HTML file. Use the cacheable flag to avoid receiving query parameters on the iframe request URL, and thereby being able to use cache headers.

From the static HTML file, you can use AP.context to retrieve the identifier of the current page, and AP.request to fetch page properties you have previously stored against that page.

I got your point for dynamic content macro’s, even if i don’t understood why static content macro’s are provided when you not recommend their functionality.

I found a example at https://bitbucket.org/atlassian/atlassian-connect-spring-boot-samples/src/399d08a7c5bea4c283fea1f0da3d5b1dd7112e44/atlassian-connect-spring-boot-sample-cacheable-macro/

It would be nice if you link to working examples, because it took me a while to find an example. Thank you. Now i have something to work with.

@MatthiasWegner I linked to that example in my post above.

Regarding Static Content Macros, I honestly don’t know why they were added in the first place either. I assume it was for unblocking the migration of specific Server plugins to Cloud. If Static Content Macro were evaluated only at insertion-time, they would make sense. But evaluating them at render-time makes for a poor experience.

1 Like