Created method for VitroHttpServlet setup, callable by FreeMarker controllers that have their own doGet() method.

This commit is contained in:
rjy7 2010-07-02 14:45:11 +00:00
parent e7675e494d
commit 767ca049e0
3 changed files with 23 additions and 28 deletions

View file

@ -44,6 +44,11 @@ public class VitroHttpServlet extends HttpServlet
protected void doGet( HttpServletRequest request, HttpServletResponse response )
throws ServletException, IOException
{
setup(request);
}
protected final void setup(HttpServletRequest request) {
if (request.getSession() != null) {
Object webappDaoFactoryAttr = request.getSession().getAttribute("webappDaoFactory");
if (webappDaoFactoryAttr != null && webappDaoFactoryAttr instanceof WebappDaoFactory) {

View file

@ -51,16 +51,6 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
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 <code>super.doGet(req, resp)</code>,
* it can call this method instead, to run
* <code>VitroHttpServlet.doGet(req, resp)</code>.
*/
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 {

View file

@ -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);