DataDownload.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:openregister-java 作者:
@GET
@Path("/download-rsf/{start-entry-number}")
@Produces({ExtraMediaType.APPLICATION_RSF, ExtraMediaType.TEXT_HTML})
@DownloadNotAvailable
@Timed
public Response downloadPartialRSF(@PathParam("start-entry-number") int startEntryNumber) {
    if (startEntryNumber < 0) {
        throw new BadRequestException("start-entry-number must be 0 or greater");
    }

    int totalEntriesInRegister = register.getTotalEntries(EntryType.user);

    if (startEntryNumber > totalEntriesInRegister) {
        throw new BadRequestException("start-entry-number must not exceed number of total entries in the register");
    }

    String rsfFileName = String.format("attachment; filename=rsf-%d.%s", System.currentTimeMillis(), rsfFormatter.getFileExtension());
    return Response
            .ok((StreamingOutput) output -> rsfService.writeTo(output, rsfFormatter, startEntryNumber, totalEntriesInRegister))
            .header("Content-Disposition", rsfFileName).build();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号