Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,780
Community Members
 
Community Events
184
Community Groups

Migrating a plugin from AttachmentManager API to AttachmentService API

Hi.

I wrote a plugin which manages page attachments via the AttachmentManager API . After upgrading to Confluence version 7.15, I do have various problems with that including large a amount of accumulating open file handles during the day. I suspect this API being deprecated/legacy now might be related to this.

So I would like to migrate the plugin to API version 7.15 and use the AttachmentService API  instead. But I cannot find examples of how to use this API and perform basic tasks like read the attachment data as string, setting the attachment creator, ... except from some githib projects addressing parts to these topics only.

Is there a practical guide of how to use the AttachmentService API or even a document describing the migration process ?

Alternatively, an example of how to read the attachment content data into a byte array or a string via JAVA using this new API would be of great benefit for me.

Thank you very much.

1 answer

Ok, some corrections: The error described above has not been caused by the deprecated AttachmentManager API. Instead, some InputStream objects had not been closed after use and some behavior behind the scenes changed so that this led to accumulating handles after the update to 7.15 only. Maybe some internal caching or changes in the garbage collection, but ultimately my fault here (always close your streams).

Nevertheless, having a hint to some AttachmentService API documentation would be helpful.

WW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2023

Agreed:

some AttachmentService API documentation would be helpful

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events