Fixed #1856 ResourceService without context

This commit is contained in:
Greg Wilkins 2017-10-03 11:34:00 +11:00
parent 7b93c3c1e7
commit 1a7ff6854d
1 changed files with 5 additions and 2 deletions

View File

@ -35,6 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.AsyncContext;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -402,7 +403,9 @@ public class ResourceService
if (LOG.isDebugEnabled())
LOG.debug("welcome={}",welcome);
if (_redirectWelcome)
ServletContext context = request.getServletContext();
if (_redirectWelcome || context==null)
{
// Redirect to the index
response.setContentLength(0);
@ -416,7 +419,7 @@ public class ResourceService
return;
}
RequestDispatcher dispatcher=request.getServletContext().getRequestDispatcher(welcome);
RequestDispatcher dispatcher=context.getRequestDispatcher(welcome);
if (dispatcher!=null)
{
// Forward to the index