1

I've seen the term "context" used in a few web application frameworks but I'm not sure what it's actually about. It seems pretty important and seems to be related to holding session information, but I've also seen it used for URL related things.

Is there a clear, concise and agreed upon definition of the term when used in web application programming? It seems like something I would need to make use of but I can't find anything explaining what it should (and shouldn't) be.

1 Answer 1

2

An application context object usually allows access to the configuration of the application instance, things like:

  • What is the application's hostname and path?
  • How is dependency injection configured, i.e. what implementation is to be used for a given interface?
  • OS environment variables

In a properly designed OO system, the access will be via methods of the context object that do things like convert relative URLs to absolute ones or return fully configured implementation objects for a given interface or name, and that can involve session information since DI configuration may define objects to be session-scoped (i.e. there is one implementation object per user session).

This description may be colored by my experience on the Java platform, but the concept as such is not platform-specific.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.