/** Initialize this servlet. */ public void init() throws ServletException { super.init(); try { basicAuth = new BasicAuth(); basicAuth.init(); transformerFactory = TransformerFactory.newInstance(); try { docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); } catch (ParserConfigurationException e) { log.warn(this + " cannot get DocumentBuilder " + e.getMessage()); } } catch (Exception e) { log.warn(this + "init " + e.getMessage()); } }
/** * respond to an HTTP GET request * * @param req HttpServletRequest object with the client request * @param res HttpServletResponse object back to the client * @exception ServletException in case of difficulties * @exception IOException in case of difficulties */ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { // process any login that might be present basicAuth.doLogin(req); // catch the login helper requests // 1: Get site status: request url is of format // https://server_name/sakai-site-manage-tool/tool/sitecopystatus/toolId String option = req.getPathInfo(); String[] parts = option.split("/"); if ((parts.length == 3) && ("".equals(parts[0])) && ("sitecopystatus".equals(parts[1]))) { getSiteCopyStatus(parts[2], res); } // 2: Print site participant list: request url if of format // https://server_name/sakai-site-manage-tool/tool/printparticipant/siteId else if ((parts.length == 3) && ("".equals(parts[0])) && ("printparticipant".equals(parts[1]))) { getSiteParticipantList(parts[2], res); } }