Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [servlet-dev] Standardise servlet/application context Id?

Hi,

On Sat, Sep 28, 2019 at 11:44 PM Stuart Douglas <sdouglas@xxxxxxxxxx> wrote:
This is not something that the majority of end users will need to interact with as far as I can tell, so I don't think it is appropriate to add a method to the Servlet API that can be easily replicated via a single line static utility method when it will likely only be used by a small number of frameworks. 

Not really sure about that, logging the name of the application is fairly common. People would now mostly (from own experience at least), log just the servletContextPath, and even this is not super trivial to come up with when you are essentially thinking about logging the unique name/id of the application.


As said, there's getServletContextName now that's most intuitive, but it has to be set explicitly. Having this one return the aforementioned Id could have been an option, but is unwise now wrt backwards compatibility.

Kind regards,
Arjan





 

Stuart

On Sat, 28 Sep 2019 at 01:47, arjan tijms <arjan.tijms@xxxxxxxxx> wrote:
Hi,

Quite a number of Servlet containers use some way to identify a particular application (war) running on it. This id is used internally, but also externally, for instance to authentication and authorization modules to keep track of which application they are installed for.

For authentication for instance we defined this Id for an application:

String getAppContextID(ServletContext context)
 return context.getVirtualServerName() + " " + context.getContextPath();
}

While this is simple enough to create, it's somewhat tedious, but also something that differs between containers and libraries that want such an Id.

Would it be an idea to standardise this in Servlet, to exist next to getServletName?

E.g.

/**
     * Returns the unique Id of this web application corresponding to this
     * ServletContext.
     *
*/
String ServletContext#getServletContextId();

Thoughts?

Kind regards,
Arjan Tijms


_______________________________________________
servlet-dev mailing list
servlet-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/servlet-dev
_______________________________________________
servlet-dev mailing list
servlet-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/servlet-dev

Back to the top