001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/portal/tags/sakai_2-4-1/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/BasePortalHandler.java $
003: * $Id: BasePortalHandler.java 29143 2007-04-19 01:10:38Z ajpoland@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006, 2007 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.charon.handlers;
021:
022: import javax.servlet.ServletContext;
023: import javax.servlet.http.HttpServletRequest;
024: import javax.servlet.http.HttpServletResponse;
025:
026: import org.sakaiproject.portal.api.Portal;
027: import org.sakaiproject.portal.api.PortalHandler;
028: import org.sakaiproject.portal.api.PortalHandlerException;
029: import org.sakaiproject.portal.api.PortalService;
030: import org.sakaiproject.tool.api.Session;
031:
032: /**
033: * Abstract class to hold common base methods for portal handlers.
034: *
035: * @author ieb
036: * @since Sakai 2.4
037: * @version $Rev: 29143 $
038: *
039: */
040: public abstract class BasePortalHandler implements PortalHandler {
041:
042: public BasePortalHandler() {
043: urlFragment = "none";
044: }
045:
046: protected PortalService portalService;
047:
048: protected Portal portal;
049:
050: protected String urlFragment;
051:
052: protected ServletContext servletContext;
053:
054: public abstract int doGet(String[] parts, HttpServletRequest req,
055: HttpServletResponse res, Session session)
056: throws PortalHandlerException;
057:
058: // TODO: Go through and make sure to remove and test the mistaken code that
059: // simply
060: // calls doGet in doPost()
061: public int doPost(String[] parts, HttpServletRequest req,
062: HttpServletResponse res, Session session)
063: throws PortalHandlerException {
064: return NEXT;
065: }
066:
067: /*
068: * (non-Javadoc)
069: *
070: * @see org.sakaiproject.portal.charon.PortalHandler#deregister(org.sakaiproject.portal.charon.Portal)
071: */
072: public void deregister(Portal portal) {
073: this .portal = null;
074: }
075:
076: /*
077: * (non-Javadoc)
078: *
079: * @see org.sakaiproject.portal.charon.PortalHandler#register(org.sakaiproject.portal.charon.Portal)
080: */
081: public void register(Portal portal, PortalService portalService,
082: ServletContext servletContext) {
083: this .portal = portal;
084: this .portalService = portalService;
085: this .servletContext = servletContext;
086:
087: }
088:
089: public String getUrlFragment() {
090: return urlFragment;
091: }
092:
093: public void setUrlFragment(String urlFagment) {
094: this .urlFragment = urlFagment;
095: }
096:
097: /**
098: * @return the servletContext
099: */
100: public ServletContext getServletContext() {
101: return servletContext;
102: }
103:
104: /**
105: * @param servletContext
106: * the servletContext to set
107: */
108: public void setServletContext(ServletContext servletContext) {
109: this.servletContext = servletContext;
110: }
111:
112: }
|