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