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

Implement ability to access AppContext from any ActiveWeb location #1234

Closed
ipolevoy opened this issue Sep 27, 2022 · 0 comments
Closed

Implement ability to access AppContext from any ActiveWeb location #1234

ipolevoy opened this issue Sep 27, 2022 · 0 comments

Comments

@ipolevoy
Copy link
Member

sometimes there is a need to access Injector and other objects from other servlet classes, such as SessionListner, in order to cleanup resources when a session ends (just one example). In a situation like that, it is useful to get access to an instance of an Injector and its services.

Proposal:
Make AppContext static and available anywhere in the application without to have to pass it around.

Example:

AppContect.set("xxx"); 
AppContect.get("xxx"); 

In the AppBootstrap:

public void init(AppContext context){
    context.set("injector", getInjector());
}

In the SessionListener:

@Override
public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
   Injector injector = AppContext.get("injector");
}
@ipolevoy ipolevoy self-assigned this Sep 27, 2022
ipolevoy added a commit that referenced this issue Sep 27, 2022
#1234 - Implement ability to access AppContext from any ActiveWeb loc…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant