The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get attachment information in Confluence

sola0722
December 21, 2023

I would like to get information about the uploaded file when uploading an attachment in Confluence.

In version 7.X, the information was received as follows, but in version 8.X, the information cannot be received.

<atlassian-plugin.xml>

<servlet-filter name="File Upload AIP Filter" key="aip-file-filter"
class="com.plateer.sinc.drm.confluence.filter.upload.AIPUploadFilter" location="before-decoration"
weight="100">
<description>Filter for check AIP file upload</description>
<url-pattern>/pages/attachfile.action</url-pattern>
<url-pattern>/pages/doattachfile.action*</url-pattern>
<url-pattern>/plugins/drag-and-drop/upload.action*</url-pattern>
<url-pattern>/pages/plugins/attachments/doattachfile.action*</url-pattern>
<url-pattern>/pages/worddav/</url-pattern>
<url-pattern>/plugins/servlet/confluence/editinword//attachments/ocauth</url-pattern>
<dispatcher>REQUEST</dispatcher>
</servlet-filter>

<Filter Module>
@Scanned
public class AIPUploadFilter implements Filter {
private static final Logger logger = Logger.getLogger(AIPUploadFilter.class);
private String processUUID;

@Override
public void init(FilterConfig filterConfig) throws ServletException {

}

@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws ServletException, IOException {
this.processUUID = "[" + randomUUID() + "]";
if ((servletRequest instanceof HttpServletRequest)) {
logger.info(formatLogger(this.processUUID, "Start AIP Upload Filter"));
HttpServletRequest request = (HttpServletRequest) servletRequest;

InputStream is = req.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder stringBuilder = new StringBuilder();
String line;

while ((line = reader.readLine()) != null) {
stringBuilder.append(line);
}

logger.warn("requestData : " + stringBuilder.toString());

}

.

.

.

}

When the source code is as above, blank data is received from "logger.warn("requestData : " + stringBuilder.toString());".

In this case, how can I receive data?

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events