diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/VitroHttpServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/VitroHttpServlet.java index 411600548..7590dc4f8 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/VitroHttpServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/VitroHttpServlet.java @@ -44,26 +44,31 @@ public class VitroHttpServlet extends HttpServlet protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { - if (request.getSession() != null) { - Object webappDaoFactoryAttr = request.getSession().getAttribute("webappDaoFactory"); - if (webappDaoFactoryAttr != null && webappDaoFactoryAttr instanceof WebappDaoFactory) { - myWebappDaoFactory = (WebappDaoFactory) webappDaoFactoryAttr; - } - webappDaoFactoryAttr = request.getSession().getAttribute("assertionsWebappDaoFactory"); - if (webappDaoFactoryAttr != null && webappDaoFactoryAttr instanceof WebappDaoFactory) { - myAssertionsWebappDaoFactory = (WebappDaoFactory) webappDaoFactoryAttr; - } - webappDaoFactoryAttr = request.getSession().getAttribute("deductionsWebappDaoFactory"); - if (webappDaoFactoryAttr != null && webappDaoFactoryAttr instanceof WebappDaoFactory) { - myDeductionsWebappDaoFactory = (WebappDaoFactory) webappDaoFactoryAttr; - } - } - + setup(request); + } + + protected final void setup(HttpServletRequest request) { + + if (request.getSession() != null) { + Object webappDaoFactoryAttr = request.getSession().getAttribute("webappDaoFactory"); + if (webappDaoFactoryAttr != null && webappDaoFactoryAttr instanceof WebappDaoFactory) { + myWebappDaoFactory = (WebappDaoFactory) webappDaoFactoryAttr; + } + webappDaoFactoryAttr = request.getSession().getAttribute("assertionsWebappDaoFactory"); + if (webappDaoFactoryAttr != null && webappDaoFactoryAttr instanceof WebappDaoFactory) { + myAssertionsWebappDaoFactory = (WebappDaoFactory) webappDaoFactoryAttr; + } + webappDaoFactoryAttr = request.getSession().getAttribute("deductionsWebappDaoFactory"); + if (webappDaoFactoryAttr != null && webappDaoFactoryAttr instanceof WebappDaoFactory) { + myDeductionsWebappDaoFactory = (WebappDaoFactory) webappDaoFactoryAttr; + } + } + //check to see if VitroRequestPrep filter was run if( request.getAttribute("appBean") == null || request.getAttribute("webappDaoFactory") == null ){ log.warn("request scope was not prepared by VitroRequestPrep"); - } + } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerHttpServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerHttpServlet.java index f04f4e172..f2d754e43 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerHttpServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerHttpServlet.java @@ -50,16 +50,6 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet { private static final long serialVersionUID = 1L; private static final Log log = LogFactory.getLog(FreeMarkerHttpServlet.class.getName()); private static final int FILTER_SECURITY_LEVEL = LoginFormBean.EDITOR; - - /** - * If a subclass doesn't want to call super.doGet(req, resp), - * it can call this method instead, to run - * VitroHttpServlet.doGet(req, resp). - */ - protected final void vitroHttpServletDoGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - super.doGet(request, response); - } public void doGet( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java index 052e8bb2f..4bdbe0506 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java @@ -142,8 +142,8 @@ public class ImageUploadController extends FreeMarkerHttpServlet { } try { - // execute super.super.doGet() - vitroHttpServletDoGet(request, response); + // do setup defined in VitroHttpServlet + setup(request); VitroRequest vreq = new VitroRequest(request); ResponseValues values = buildTheResponse(vreq);