javaee / grizzly

Writing scalable server applications in the Java™ programming language has always been difficult. Before the advent of the Java New I/O API (NIO), thread management issues made it impossible for a server to scale to thousands of users. The Grizzly NIO framework has been designed to help developers to take advantage of the Java™ NIO API.
https://javaee.github.io/grizzly/
Other
222 stars 60 forks source link

Fix NPE when accessing a registered resource #1965

Closed cm-perrs closed 7 years ago

cm-perrs commented 7 years ago

When registering a resource, OSGiMainHandler.registerResourceHandler may pass a null servletContext to the OSGiResourceHandler constructor. This causes a NPE when accessing the resource, thrown by OSGiResourceHandler.service. The fix is to use the same solution as in OSGiMainHandler.registerFilter, which first checks if the servletContext obtained from the mapper is null. If so, use the mapper to create a new servletContext based on the HttpContext and add it to the mapper.