01: /**********************************************************************************
02: *
03: * $Id: ContextManagementStandaloneImpl.java 9271 2006-05-10 21:52:49Z ray@media.berkeley.edu $
04: *
05: ***********************************************************************************
06: *
07: * Copyright (c) 2005 The Regents of the University of California, The MIT Corporation
08: *
09: * Licensed under the Educational Community License, Version 1.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.opensource.org/licenses/ecl1.php
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: *
21: **********************************************************************************/package org.sakaiproject.tool.gradebook.facades.standalone;
22:
23: import java.io.UnsupportedEncodingException;
24: import java.net.URLDecoder;
25:
26: import javax.servlet.ServletRequest;
27:
28: import org.apache.commons.logging.Log;
29: import org.apache.commons.logging.LogFactory;
30: import org.sakaiproject.tool.gradebook.facades.ContextManagement;
31:
32: /**
33: * An implementation of the ContextManagement facade to support demos and UI tests.
34: */
35: public class ContextManagementStandaloneImpl implements
36: ContextManagement {
37: private static Log logger = LogFactory
38: .getLog(ContextManagementStandaloneImpl.class);
39:
40: private static final String GRADEBOOK_UID_PARAM = "gradebookUid";
41:
42: public String getGradebookUid(Object request) {
43: String gradebookUid = (String) ((ServletRequest) request)
44: .getParameter(GRADEBOOK_UID_PARAM);
45: if (gradebookUid != null) {
46: try {
47: gradebookUid = URLDecoder.decode(gradebookUid, "UTF-8");
48: } catch (UnsupportedEncodingException ex) {
49: logger.error("Unlikely exception thrown", ex);
50: }
51: }
52: if (logger.isDebugEnabled())
53: logger.debug("getGradebookUid returning " + gradebookUid);
54: return gradebookUid;
55: }
56: }
|