Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a pre get content resource handler? #140

Closed
lmtoo opened this issue Feb 25, 2020 · 5 comments
Closed

Is there a pre get content resource handler? #140

lmtoo opened this issue Feb 25, 2020 · 5 comments

Comments

@lmtoo
Copy link

lmtoo commented Feb 25, 2020

before user access content resource , I have to append the resource (PDF file) with a watermark , using current username, is there have any way to do that?

@lmtoo
Copy link
Author

lmtoo commented Feb 25, 2020

Or custom the resource's link ,to add a watermark link, and disable the default link?

@paulcwarren
Copy link
Owner

What is the content-type of the original content @lmtoo ?

If it isn't already PDF then you could register a renderer that converts content to "application/pdf" - the content type of your watermarked content.

In this renderer, you can get the current thread's security context and from that the principal (i.e. username) and then do your watermarking logic to generate the content with the watermark.

On the client, if you then make a GET request to the original content's URI but specify an accept header with content-type "application/pdf" the store rest controller will invoke your renderer and return the content it generates

@lmtoo lmtoo closed this as completed Mar 7, 2020
@lmtoo lmtoo reopened this Mar 11, 2020
@lmtoo
Copy link
Author

lmtoo commented Mar 11, 2020

The original content is already PDF ,I implement a renderer from "application/pdf" to "application/pdf", but it's not work correctly

@paulcwarren
Copy link
Owner

I see. Let me take a look at that for you. Thanks @lmtoo

@paulcwarren
Copy link
Owner

paulcwarren commented Mar 13, 2020

When there are renderers that produce content matching the original content-type, the StoreRestController gave precedence to the original content over the renderers. This commit fixes that and was green in this build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants