01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/portal/tags/sakai_2-4-1/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/SiteResetHandler.java $
03: * $Id: SiteResetHandler.java 29143 2007-04-19 01:10:38Z ajpoland@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2003, 2004, 2005, 2006, 2007 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.portal.charon.handlers;
21:
22: import javax.servlet.http.HttpServletRequest;
23: import javax.servlet.http.HttpServletResponse;
24:
25: import org.sakaiproject.portal.api.PortalHandlerException;
26: import org.sakaiproject.tool.api.Session;
27: import org.sakaiproject.util.Web;
28:
29: /**
30: *
31: * @author ieb
32: * @since Sakai 2.4
33: * @version $Rev: 29143 $
34: *
35: */
36: public class SiteResetHandler extends BasePortalHandler {
37: public SiteResetHandler() {
38: urlFragment = "site-reset";
39: }
40:
41: @Override
42: public int doGet(String[] parts, HttpServletRequest req,
43: HttpServletResponse res, Session session)
44: throws PortalHandlerException {
45: if ((parts.length > 2) && (parts[1].equals("site-reset"))) {
46: try {
47: String siteUrl = req.getContextPath() + "/site"
48: + Web.makePath(parts, 2, parts.length);
49: // Make sure to add the parameters such as panel=Main
50: String queryString = req.getQueryString();
51: if (queryString != null) {
52: siteUrl = siteUrl + "?" + queryString;
53: }
54: portalService.setResetState("true");
55: res.sendRedirect(siteUrl);
56: return RESET_DONE;
57: } catch (Exception ex) {
58: throw new PortalHandlerException(ex);
59: }
60: } else {
61: return NEXT;
62: }
63: }
64:
65: }
|