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.
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.
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.