001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/portal/tags/sakai_2-4-1/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/StoredStateImpl.java $
003: * $Id: StoredStateImpl.java 29143 2007-04-19 01:10:38Z ajpoland@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.portal.service;
021:
022: import javax.servlet.http.HttpServletRequest;
023:
024: import org.sakaiproject.portal.api.StoredState;
025: import org.sakaiproject.tool.api.Placement;
026:
027: /**
028: * @author ieb
029: * @since Sakai 2.4
030: * @version $Rev: 29143 $
031: */
032:
033: public class StoredStateImpl implements StoredState {
034: private SessionRequestHolder requestHolder = null;
035:
036: private Placement placement = null;
037:
038: private String toolContextPath = null;
039:
040: private String toolPathInfo = null;
041:
042: private String marker;
043:
044: private String replacement;
045:
046: private String skin;
047:
048: public StoredStateImpl(String marker, String replacement) {
049: this .marker = marker;
050: this .replacement = replacement;
051: }
052:
053: public Placement getPlacement() {
054: return placement;
055: }
056:
057: public void setPlacement(Placement placement) {
058: this .placement = placement;
059: }
060:
061: public HttpServletRequest getRequest(
062: HttpServletRequest currentRequest) {
063: return new RecoveredServletRequest(currentRequest,
064: requestHolder);
065: }
066:
067: public void setRequest(HttpServletRequest request) {
068: this .requestHolder = new SessionRequestHolder(request, marker,
069: replacement);
070: }
071:
072: public String getToolContextPath() {
073: return toolContextPath;
074: }
075:
076: public void setToolContextPath(String toolContextPath) {
077: if (toolContextPath != null) {
078: this .toolContextPath = PortalStringUtil.replaceFirst(
079: toolContextPath, marker, replacement);
080: } else {
081: this .toolContextPath = toolContextPath;
082: }
083: }
084:
085: public String getToolPathInfo() {
086: return toolPathInfo;
087: }
088:
089: public void setToolPathInfo(String toolPathInfo) {
090: if (toolPathInfo != null) {
091: this .toolPathInfo = PortalStringUtil.replaceFirst(
092: toolPathInfo, marker, replacement);
093: } else {
094: this .toolPathInfo = toolPathInfo;
095: }
096: }
097:
098: public void setSkin(String skin) {
099: this .skin = skin;
100:
101: }
102:
103: public String getSkin() {
104: return skin;
105: }
106:
107: }
|