01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/portal/tags/sakai_2-4-1/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/AtomHandler.java $
03: * $Id: AtomHandler.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.portal.api.PortalRenderContext;
27: import org.sakaiproject.tool.api.Session;
28:
29: /**
30: * Handler for Atom url space
31: *
32: * @author ieb
33: * @since Sakai 2.4
34: * @version $Rev: 29143 $
35: *
36: */
37: public class AtomHandler extends BasePortalHandler {
38: public AtomHandler() {
39: urlFragment = "atom";
40: }
41:
42: @Override
43: public int doGet(String[] parts, HttpServletRequest req,
44: HttpServletResponse res, Session session)
45: throws PortalHandlerException {
46: if ((parts.length >= 2) && parts[1].equals("atom")) {
47: try {
48:
49: // /portal/rss/site-id
50: String siteId = null;
51: if (parts.length >= 3) {
52: siteId = parts[2];
53: }
54:
55: PortalRenderContext rcontext = portal.includePortal(
56: req, res, session, siteId,
57: /* toolId */null, req.getContextPath()
58: + req.getServletPath(),
59: /* prefix */"site", /* doPages */true, /* resetTools */
60: false,
61: /* includeSummary */true, /* expandSite */
62: false);
63: // sendResponse(rcontext, res, parts[1],
64: // "application/atom+xml");
65: portal
66: .sendResponse(rcontext, res, parts[1],
67: "text/xml");
68: return END;
69: } catch (Exception ex) {
70: throw new PortalHandlerException(ex);
71: }
72: } else {
73: return NEXT;
74: }
75: }
76:
77: }
|