I'm reading
https://jersey.github.io/documentation/latest/filters-and-interceptors.html
and http://www.dropwizard.io/1.1.4/docs/manual/core.html#jersey-filters to
try and make this:
@CookieParam("User-Data") userData: String,@HeaderParam("User-Agent")
userAgent: String,
Not needed in each and every resource GET method of my web app. userData is
json data from a cookie with fields like "name" and "id" and userAgent is
the full User-Agent string from the header. For each view I pass in:
AppUser.getName(userData), AppUser.isMobile(userAgent)
The getName function parses the json and returns just the name field and
the isMobile function returns a true boolean if the string "mobile" is
found.
I use this in each view of the app in FreeMarker to display the user's name
and to change some layout stuff if mobile is true.
Is there a way to make this less repetitive? I'd rather use a BeforeFilter
to just set this automatically each time.
--
You received this message because you are subscribed to the Google Groups
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.