Reorganized FreeMarker controllers into a single package

This commit is contained in:
rjy7 2010-05-18 14:24:03 +00:00
parent fc8c9876f0
commit 269b89825f
15 changed files with 90 additions and 66 deletions

View file

@ -266,7 +266,7 @@
<servlet> <servlet>
<servlet-name>AboutController</servlet-name> <servlet-name>AboutController</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.AboutControllerFM</servlet-class> <servlet-class>edu.cornell.mannlib.vitro.webapp.controller.freemarker.AboutController</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>AboutController</servlet-name> <servlet-name>AboutController</servlet-name>
@ -788,12 +788,12 @@
</servlet-mapping> </servlet-mapping>
<servlet> <servlet>
<servlet-name>IndividualListControllerFM</servlet-name> <servlet-name>IndividualListController</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.IndividualListControllerFM</servlet-class> <servlet-class>edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>IndividualListControllerFM</servlet-name> <servlet-name>IndividualListController</servlet-name>
<url-pattern>/individuallistFM</url-pattern> <url-pattern>/individuallist</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet> <servlet>
@ -829,7 +829,7 @@
<servlet> <servlet>
<servlet-name>TermsOfUseController</servlet-name> <servlet-name>TermsOfUseController</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.TermsOfUseControllerFM</servlet-class> <servlet-class>edu.cornell.mannlib.vitro.webapp.controller.freemarker.TermsOfUseController</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>TermsOfUseController</servlet-name> <servlet-name>TermsOfUseController</servlet-name>
@ -959,7 +959,7 @@
<servlet> <servlet>
<servlet-name>browsecontroller</servlet-name> <servlet-name>browsecontroller</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.BrowseControllerFM</servlet-class> <servlet-class>edu.cornell.mannlib.vitro.webapp.controller.freemarker.BrowseController</servlet-class>
<load-on-startup>5</load-on-startup> <load-on-startup>5</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>

View file

@ -19,25 +19,25 @@ public class Controllers {
// Servlet urls // Servlet urls
public static final String SITE_ADMIN = "/siteAdmin";
public static final String LOGIN = "/siteAdmin";
public static final String LOGOUT = "/siteAdmin";
public static final String ABOUT = "/about"; public static final String ABOUT = "/about";
public static final String CONTACT_URL = "/comments"; public static final String CONTACT_URL = "/comments";
public static final String TERMS_OF_USE_URL = "/termsOfUse"; public static final String TERMS_OF_USE_URL = "/termsOfUse";
public static final String SEARCH_URL = "/search";
public static final String BROWSE = "/browse";
public static final String INDIVIDUAL_LIST_URL = "/individuallist";
public static final String ENTITY = "/entity"; public static final String ENTITY = "/entity";
public static final String ENTITY_PROP_LIST = "/entityPropList"; public static final String ENTITY_PROP_LIST = "/entityPropList";
public static final String ENTITY_LIST = "/EntityList"; public static final String ENTITY_LIST = "/EntityList";
public static final String BROWSE_CONTROLLER = "browse"; public static final String BROWSE_CONTROLLER = "browsecontroller";
public static final String RETRY_URL = "editForm"; public static final String RETRY_URL = "editForm";
public static final String TAB_ENTITIES = "/TabEntitiesController"; public static final String TAB_ENTITIES = "/TabEntitiesController";
public static final String SITE_ADMIN = "/siteAdmin";
public static final String LOGIN = "/siteAdmin";
public static final String LOGOUT = "/siteAdmin";
public static final String EXPORT_RDF = "/export"; public static final String EXPORT_RDF = "/export";
// jsps go here: // jsps go here:
@ -74,7 +74,7 @@ public class Controllers {
public static final String ALPHA_INDEX_JSP = "/templates/alpha/alphaIndex.jsp"; public static final String ALPHA_INDEX_JSP = "/templates/alpha/alphaIndex.jsp";
public static final String SEARCH_URL = "/search";
public static final String SEARCH_BASIC_JSP = "/templates/search/searchBasic.jsp"; public static final String SEARCH_BASIC_JSP = "/templates/search/searchBasic.jsp";
public static final String SEARCH_PAGED_JSP = "/templates/search/searchPaged.jsp"; public static final String SEARCH_PAGED_JSP = "/templates/search/searchPaged.jsp";
public static final String SEARCH_FAILED_JSP = "/templates/search/searchFailed.jsp"; public static final String SEARCH_FAILED_JSP = "/templates/search/searchFailed.jsp";

View file

@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreeMarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
public class VitroHttpServlet extends HttpServlet public class VitroHttpServlet extends HttpServlet

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller; package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -8,10 +8,10 @@ import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
public class AboutControllerFM extends FreeMarkerHttpServlet { public class AboutController extends FreeMarkerHttpServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(AboutControllerFM.class.getName()); private static final Log log = LogFactory.getLog(AboutController.class.getName());
protected String getTitle() { protected String getTitle() {
return "About " + appName; return "About " + appName;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller; package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.rdf.listeners.StatementListener; import com.hp.hpl.jena.rdf.listeners.StatementListener;
@ -17,7 +17,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.filtering.WebappDaoFactoryFiltering;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilterUtils; import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilterUtils;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters; import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
import edu.cornell.mannlib.vitro.webapp.flags.PortalFlag; import edu.cornell.mannlib.vitro.webapp.flags.PortalFlag;
import edu.cornell.mannlib.vitro.webapp.controller.FreeMarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.view.VClassGroupView; import edu.cornell.mannlib.vitro.webapp.view.VClassGroupView;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -31,7 +30,7 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
public class BrowseControllerFM extends FreeMarkerHttpServlet { public class BrowseController extends FreeMarkerHttpServlet {
static final long serialVersionUID=2006030721126L; static final long serialVersionUID=2006030721126L;
private transient ConcurrentHashMap<Integer, List> _groupListMap private transient ConcurrentHashMap<Integer, List> _groupListMap
@ -40,7 +39,7 @@ public class BrowseControllerFM extends FreeMarkerHttpServlet {
= new ConcurrentLinkedQueue<String>(); = new ConcurrentLinkedQueue<String>();
private RebuildGroupCacheThread _cacheRebuildThread; private RebuildGroupCacheThread _cacheRebuildThread;
private static final Log log = LogFactory.getLog(BrowseControllerFM.class.getName()); private static final Log log = LogFactory.getLog(BrowseController.class.getName());
public void init(javax.servlet.ServletConfig servletConfig) public void init(javax.servlet.ServletConfig servletConfig)
throws javax.servlet.ServletException { throws javax.servlet.ServletException {
@ -230,8 +229,8 @@ public class BrowseControllerFM extends FreeMarkerHttpServlet {
/* ****************** Jena Model Change Listener***************************** */ /* ****************** Jena Model Change Listener***************************** */
private class BrowseControllerChangeListener extends StatementListener { private class BrowseControllerChangeListener extends StatementListener {
private BrowseControllerFM controller = null; private BrowseController controller = null;
public BrowseControllerChangeListener(BrowseControllerFM controller){ public BrowseControllerChangeListener(BrowseController controller){
this.controller=controller; this.controller=controller;
} }
@ -260,13 +259,13 @@ public class BrowseControllerFM extends FreeMarkerHttpServlet {
} }
/* ******************** RebuildGroupCacheThread **************** */ /* ******************** RebuildGroupCacheThread **************** */
protected class RebuildGroupCacheThread extends Thread { protected class RebuildGroupCacheThread extends Thread {
BrowseControllerFM controller; BrowseController controller;
boolean die = false; boolean die = false;
boolean queueChange = false; boolean queueChange = false;
long queueChangeMills = 0; long queueChangeMills = 0;
private boolean awareOfQueueChange = false; private boolean awareOfQueueChange = false;
RebuildGroupCacheThread(BrowseControllerFM controller) { RebuildGroupCacheThread(BrowseController controller) {
this.controller = controller; this.controller = controller;
} }
public void run() { public void run() {

View file

@ -1,8 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller; package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -22,7 +20,7 @@ public class FreeMarkerComponentGenerator extends FreeMarkerHttpServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(FreeMarkerHttpServlet.class.getName()); private static final Log log = LogFactory.getLog(FreeMarkerHttpServlet.class.getName());
FreeMarkerComponentGenerator(HttpServletRequest request, HttpServletResponse response) { public FreeMarkerComponentGenerator(HttpServletRequest request, HttpServletResponse response) {
doSetup(request, response); doSetup(request, response);
} }

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller; package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -14,7 +14,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -30,6 +29,9 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vedit.beans.LoginFormBean; import edu.cornell.mannlib.vedit.beans.LoginFormBean;
import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean; import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
import edu.cornell.mannlib.vitro.webapp.beans.Portal; import edu.cornell.mannlib.vitro.webapp.beans.Portal;
import edu.cornell.mannlib.vitro.webapp.controller.ContactMailServlet;
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.utils.StringUtils; import edu.cornell.mannlib.vitro.webapp.utils.StringUtils;
import edu.cornell.mannlib.vitro.webapp.view.menu.TabMenu; import edu.cornell.mannlib.vitro.webapp.view.menu.TabMenu;
import edu.cornell.mannlib.vitro.webapp.web.BreadCrumbsUtil; import edu.cornell.mannlib.vitro.webapp.web.BreadCrumbsUtil;
@ -66,7 +68,7 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
throws IOException, ServletException { throws IOException, ServletException {
try { try {
callSuperGet(request, response); // RY Yuck...redo callSuperGet(request, response); // ??
doSetup(request, response); doSetup(request, response);
setTitle(); setTitle();
setBody(); setBody();
@ -258,15 +260,15 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
Map<String, String> portalParam = new HashMap<String, String>(); Map<String, String> portalParam = new HashMap<String, String>();
portalParam.put("home", "" + portalId); portalParam.put("home", "" + portalId);
urls.put("about", getUrl(Controllers.ABOUT, portalParam)); urls.put("about", getUrl(Router.ABOUT, portalParam));
if (ContactMailServlet.getSmtpHostFromProperties() != null) { if (ContactMailServlet.getSmtpHostFromProperties() != null) {
urls.put("contact", getUrl(Controllers.CONTACT_URL, portalParam)); urls.put("contact", getUrl(Router.CONTACT, portalParam));
} }
urls.put("search", getUrl(Controllers.SEARCH_URL)); urls.put("search", getUrl(Router.SEARCH));
urls.put("termsOfUse", getUrl(Controllers.TERMS_OF_USE_URL, portalParam)); urls.put("termsOfUse", getUrl(Router.TERMS_OF_USE, portalParam));
urls.put("login", getUrl(Controllers.LOGIN)); urls.put("login", getUrl(Router.LOGIN));
urls.put("logout", getUrl(Controllers.LOGOUT)); urls.put("logout", getUrl(Router.LOGOUT));
urls.put("siteAdmin", getUrl(Controllers.SITE_ADMIN)); urls.put("siteAdmin", getUrl(Router.SITE_ADMIN));
root.put("urls", urls); root.put("urls", urls);
} }
@ -388,4 +390,5 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
return encodedUrl; return encodedUrl;
} }
} }

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller; package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -39,6 +39,8 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement; import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Portal; import edu.cornell.mannlib.vitro.webapp.beans.Portal;
import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQuery; import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQuery;
@ -55,8 +57,10 @@ import edu.cornell.mannlib.vitro.webapp.web.jsptags.StringProcessorTag;
* @author bdc34 * @author bdc34
* *
*/ */
public class IndividualControllerFM extends VitroHttpServlet { public class IndividualController extends FreeMarkerHttpServlet {
private static final Log log = LogFactory.getLog(IndividualControllerFM.class.getName());
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(IndividualController.class.getName());
private String default_jsp = Controllers.BASIC_JSP; private String default_jsp = Controllers.BASIC_JSP;
private String default_body_jsp = Controllers.ENTITY_JSP; private String default_body_jsp = Controllers.ENTITY_JSP;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller; package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -22,12 +22,12 @@ import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
import edu.cornell.mannlib.vitro.webapp.view.IndividualView; import edu.cornell.mannlib.vitro.webapp.view.IndividualView;
public class IndividualListControllerFM extends FreeMarkerHttpServlet { public class IndividualListController extends FreeMarkerHttpServlet {
long startTime = -1; long startTime = -1;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(IndividualListControllerFM.class.getName()); private static final Log log = LogFactory.getLog(IndividualListController.class.getName());
private VClass vclass = null; private VClass vclass = null;
/** /**
@ -59,7 +59,7 @@ public class IndividualListControllerFM extends FreeMarkerHttpServlet {
vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vitroClassIdStr); vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vitroClassIdStr);
if (vclass == null) { if (vclass == null) {
log.error("Couldn't retrieve vclass "+vitroClassIdStr); log.error("Couldn't retrieve vclass "+vitroClassIdStr);
response.sendRedirect(Controllers.BROWSE_CONTROLLER+"-freemarker?"+vreq.getQueryString()); response.sendRedirect(Router.BROWSE + "?"+vreq.getQueryString());
} }
} catch (Exception ex) { } catch (Exception ex) {
throw new HelpException("EntityListControllerFM: request parameter 'vclassId' must be a URI string"); throw new HelpException("EntityListControllerFM: request parameter 'vclassId' must be a URI string");

View file

@ -0,0 +1,23 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
// For now this class just holds constants for creating links. Could later be used to implement custom routing,
// if we go that route.
public class Router {
public static final String ABOUT = "/about";
public static final String CONTACT = "/comments";
public static final String BROWSE = "/browse";
public static final String INDIVIDUAL = "/individual";
public static final String INDIVIDUAL_LIST = "/individuallist";
public static final String SEARCH = "/search";
public static final String TERMS_OF_USE = "/termsOfUse";
// Put these under /siteAdmin/...
// Currently login, logout, and site admin are all the same page, but they don't have to be.
public static final String LOGIN = "/siteAdmin";
public static final String LOGOUT = "/siteAdmin";
public static final String SITE_ADMIN = "/siteAdmin";
}

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller; package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -10,10 +10,10 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.utils.StringUtils; import edu.cornell.mannlib.vitro.webapp.utils.StringUtils;
public class TermsOfUseControllerFM extends FreeMarkerHttpServlet { public class TermsOfUseController extends FreeMarkerHttpServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(TermsOfUseControllerFM.class.getName()); private static final Log log = LogFactory.getLog(TermsOfUseController.class.getName());
protected String getTitle() { protected String getTitle() {
return appName + " Terms of Use"; return appName + " Terms of Use";

View file

@ -2,9 +2,6 @@
package edu.cornell.mannlib.vitro.webapp.servlet.setup; package edu.cornell.mannlib.vitro.webapp.servlet.setup;
import java.io.File;
import java.io.IOException;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import javax.servlet.ServletContextListener;
@ -13,9 +10,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties; import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
import edu.cornell.mannlib.vitro.webapp.controller.FreeMarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreeMarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.view.ViewObject; import edu.cornell.mannlib.vitro.webapp.view.ViewObject;
import freemarker.template.Configuration; import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper; import freemarker.template.DefaultObjectWrapper;
import freemarker.template.TemplateException; import freemarker.template.TemplateException;
@ -60,9 +56,7 @@ public class FreeMarkerSetup implements ServletContextListener {
String contextPath = sc.getContextPath(); String contextPath = sc.getContextPath();
FreeMarkerHttpServlet.contextPath = contextPath; FreeMarkerHttpServlet.contextPath = contextPath;
FreeMarkerHttpServlet.context = sc; FreeMarkerHttpServlet.context = sc;
ViewObject.contextPath = contextPath; // ViewObject.contextPath = contextPath;
// For JSP => FreeMarker transition.
} }

View file

@ -8,12 +8,13 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.Portal; import edu.cornell.mannlib.vitro.webapp.beans.Portal;
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.Router;
public class IndividualView extends ViewObject { public class IndividualView extends ViewObject {
private static final Log log = LogFactory.getLog(IndividualView.class.getName()); private static final Log log = LogFactory.getLog(IndividualView.class.getName());
private static final String URL = "/individual"; private static final String URL = Router.INDIVIDUAL;
private Individual individual; private Individual individual;
@ -37,7 +38,8 @@ public class IndividualView extends ViewObject {
// e.g., getEditUrl, getDeleteUrl - these would return the computations of PropertyEditLinks // e.g., getEditUrl, getDeleteUrl - these would return the computations of PropertyEditLinks
// Just call getUrl... // Just call getUrl...
public String getProfileUrl() { public String getProfileUrl() {
return contextPath + URL + ""; // ADD IN the label from the individual's uri //return contextPath + URL + ""; // ADD IN the label from the individual's uri
return ""; // RY FIX THIS
} }
public String getCustomView() { public String getCustomView() {

View file

@ -9,12 +9,12 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.controller.Controllers; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.Router;
public class VClassView extends ViewObject { public class VClassView extends ViewObject {
private static final Log log = LogFactory.getLog(VClassView.class.getName()); private static final Log log = LogFactory.getLog(VClassView.class.getName());
private static final String URL = Controllers.INDIVIDUAL_LIST_URL; private static final String URL = Router.INDIVIDUAL_LIST;
private VClass vclass; private VClass vclass;

View file

@ -7,7 +7,7 @@ import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.controller.FreeMarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreeMarkerHttpServlet;
// RY We may want an interface that the superclass would implement. // RY We may want an interface that the superclass would implement.
// RY Consider using FreeMarker's DisplayObjectWrapper instead, or extending it. // RY Consider using FreeMarker's DisplayObjectWrapper instead, or extending it.
@ -17,7 +17,7 @@ public abstract class ViewObject {
private static final Log log = LogFactory.getLog(ViewObject.class.getName()); private static final Log log = LogFactory.getLog(ViewObject.class.getName());
// RY Can probably remove this, since we're using the FreeMarkerHttpServlet methods instead // RY Can probably remove this, since we're using the FreeMarkerHttpServlet methods instead
public static String contextPath; // public static String contextPath;
protected String getUrl(String path) { protected String getUrl(String path) {
return FreeMarkerHttpServlet.getUrl(path); return FreeMarkerHttpServlet.getUrl(path);