01: /**********************************************************************************
02: * $URL:https://source.sakaiproject.org/svn/osp/trunk/common/tool-lib/src/java/org/theospi/utils/mvc/impl/servlet/HelperConsumerFormControllerImpl.java $
03: * $Id:HelperConsumerFormControllerImpl.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 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.theospi.utils.mvc.impl.servlet;
21:
22: import javax.servlet.http.HttpServletRequest;
23:
24: import org.sakaiproject.metaobj.utils.mvc.impl.servlet.FormControllerImpl;
25: import org.sakaiproject.tool.api.SessionManager;
26: import org.sakaiproject.tool.api.ToolSession;
27:
28: /**
29: * Created by IntelliJ IDEA.
30: * User: John Ellis
31: * Date: Jul 22, 2005
32: * Time: 4:14:12 PM
33: * To change this template use File | Settings | File Templates.
34: */
35: public class HelperConsumerFormControllerImpl extends
36: FormControllerImpl {
37:
38: private static String TOOL_RETURNING_ATTRIBUTE = "theospi.toolReturning";
39:
40: private SessionManager sessionManager;
41:
42: protected boolean isFormSubmission(HttpServletRequest request) {
43: ToolSession currentSession = sessionManager
44: .getCurrentToolSession();
45:
46: if (currentSession.getAttribute(TOOL_RETURNING_ATTRIBUTE) != null) {
47: currentSession.removeAttribute(TOOL_RETURNING_ATTRIBUTE);
48: return true;
49: } else {
50: currentSession.setAttribute(TOOL_RETURNING_ATTRIBUTE,
51: "true");
52: return false;
53: }
54: }
55:
56: public SessionManager getSessionManager() {
57: return sessionManager;
58: }
59:
60: public void setSessionManager(SessionManager sessionManager) {
61: this.sessionManager = sessionManager;
62: }
63:
64: }
|