I want to implement some form of (GWT 2.1 MVP) pre-Activity checking that ensures the user has complied with various things before an Activity can be presented (e.g. logged in, agreed to t&c's, read the description, etc.) These checks would take the form of Activities also.
Regardless of the specifics, I'm looking to 开发者_JAVA技巧keep my Activity's clean and not implement this checking in each one. So far, the best place I've seen this is ActivityMapper, where I can perform the checks based on the requested place, and return a different Place than requested. Perhaps FilteredActivityMapper might be a better way even.
Ideally, I'd like to preserve the originally requested Place, either by not updating history when showing these intermediate (checking) Activities, or caching the original Place object inside the intermediate Place object, and if the user accepts the agreement, then lauching the original Place.
Has anyone done something similar, or has a cleaner approach to this?
If you don't insist on having login, t&c and description inside GWT module, and can use jsps for these three things I'd suggest to: * Create security constraint in web.xml and protect whole GWT module via standard web container features. Each access to unprotected resource will be redirected to login form. * Use servlet filter to check whether user has agreed to t&c and read description and store information about it in http session.
By the way it'd be quite elegant to use ActivityMapper for second thing, but for login I'd definitely use server-side, proven mechanisms.
Hope it helps.
精彩评论