Free Support Forum - groupdocs.com

Integration issue - AnnotationHandler per user


#1

Hi,


we’ve found another integration issue. With 1.8.2 version we’re finally able to create a CustomInputHandler that works with our backend. But we found another issue.

AnnotationHandler in your sample is creates once per web application. That causes many issues, as we need to maintain a different credentials per user, that means, we need to store the AnnotationHandler instance per HttpSession.

We modified HomeController sample, and added HttpSession as a parameter to the annotationHandler() method. Unfortunately just after that I realized that some of the methods doesn’t have HttpServletRequest as a parameter and thus I cannot grab the HttpSession from it to get the appropriate AnnotationHandler instance.

So my question is how can I achieve that? Can I e.g. annotate the Controller with @Scope(“session”) or will it cause any other issues?

Can you add HttpServletRequest as a parameter to all the Viewer and Annotation class methods?
Right now I can access only HttpServletResponse in all methods.

Thank you,
Mariusz

#2
Hello Mariusz,

There is no problem to add HttpServletRequest to all controller methods. You do not necessary should implement the IGroupDocsAnnotation and the IGroupDocsViewer interfaces, you can use all the implementations from the Spring sample but remove the “implements” part of the HomeControllerBase and then extend methods with the HttpServletRequest argument, so you’ll have access to the session scope in every request.

If you already modified the sample to handle many AnnotationHandler objects (each per session) I think you can try to use the @Scope("session"), theoretically it should work, taking into account that you also disabled the Atmosphere. Unfortunately we have not tested this scenario yet.


#3

I have not disabled Atmosphere as I’m still waiting for your reply about the impact. Plus I’m afraid that with further version something may stop working since there is interface to validate against.


Mariusz

#4
Hello Mariusz,

There is already info how to use InputDataHandler with differentiation per HTTP session. You can read about it in another thread (http://groupdocs.com/Community/forums/showthread.aspx?PostID=4953#5379).

We started to add valuable API changes with the release notes, so now you will have a clearer picture of how to make a better transition.