Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[servlet-dev] ServletContext.getContext seems to be optional, but some TCK tests require it

Hi,

ServletContext getContext(String uripath) in the type ServletContext has the following note in its javadoc:

"In a security conscious environment, the servlet container may return null for a given URL."

However, the TCK has a number of tests where the ServletContext can definitely not be null:

response.getWriter()
        .println("Before dispatch=" + System.currentTimeMillis());

ac.dispatch(
        request.getServletContext().getContext("/servlet_js_dispatchtest1_web"),
        "/DispatchTests10?testname=dispatchTest10");


Interestingly, some other tests in the TCK do explicitly take the null into account, like here:

// we expect ServletContext object that corresponds to the named URL or Null
    ServletContext context2 = context.getContext(alternateServlet);

    if ((context2 == context) || (context2 == null)) {
      passed = true;


Thoughts?

Kind regards,
Arjan

Back to the top