Esempio n. 1
0
 /** Run once when servlet loaded. */
 public void init(ServletConfig config) throws ServletException {
   super.init(config);
   context = config.getServletContext();
   theApp = (LockssApp) context.getAttribute(ServletManager.CONTEXT_ATTR_LOCKSS_APP);
   servletMgr = (ServletManager) context.getAttribute(ServletManager.CONTEXT_ATTR_SERVLET_MGR);
   if (theApp instanceof LockssDaemon) {
     acctMgr = getLockssDaemon().getAccountManager();
   }
 }
Esempio n. 2
0
 /**
  * Add javascript to page. Normally adds a link to the script file, but can be told to include the
  * script directly in the page, to accomodate unit testing of individual servlets, when other
  * fetches won't work.
  */
 protected void addJavaScript(Composite comp) {
   String include = (String) context.getAttribute(ATTR_INCLUDE_SCRIPT);
   if (StringUtil.isNullString(include)) {
     linkToJavaScript(comp);
   } else {
     includeJavaScript0(comp);
   }
 }
Esempio n. 3
0
 protected boolean hasTestRole(String role) {
   // Servlet test harness puts roles in context
   List roles = (List) context.getAttribute(ATTR_ALLOW_ROLES);
   return roles != null && (roles.contains(role) || roles.contains(ROLE_USER_ADMIN));
 }