01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.desktop.taglib.container.single;
06:
07: import javax.servlet.jsp.JspException;
08: import javax.servlet.http.HttpServletRequest;
09:
10: import com.sun.portal.desktop.taglib.BaseDesktopTagSupport;
11: import com.sun.portal.desktop.taglib.DesktopTaglibException;
12: import com.sun.portal.desktop.context.ContextException;
13: import com.sun.portal.desktop.context.ParentContainerThreadLocalizer;
14: import com.sun.portal.desktop.TypedException;
15: import com.sun.portal.providers.Provider;
16: import com.sun.portal.providers.ProviderException;
17: import com.sun.portal.providers.context.ContainerProviderContext;
18: import com.sun.portal.providers.containers.jsp.single.JSPSingleContainerProvider;
19:
20: public class ObtainSelectedChannelTag extends BaseDesktopTagSupport {
21: public int doStartTag() throws JspException {
22: JSPSingleContainerProvider scp = (JSPSingleContainerProvider) getCurrentObj();
23: Provider p = null;
24: String selectedChannel = null;
25: try {
26: selectedChannel = scp.getSelectedChannel();
27: p = scp.getContainerProviderContext().getProvider(
28: (HttpServletRequest) pageContext.getRequest(),
29: scp.getName(), selectedChannel);
30: } catch (ProviderException pe) {
31: throw new DesktopTaglibException(pe);
32: }
33:
34: if (p == null)
35: throw new DesktopTaglibException(selectedChannel
36: + " channel is not available",
37: TypedException.UNKNOWN_CHANNEL_TYPE);
38:
39: setCurrentProvider(p);
40: saveDesktopTaglibContext();
41:
42: return EVAL_BODY_INCLUDE;
43: }
44:
45: public int doEndTag() throws JspException {
46: setCurrentProvider(null);
47: saveDesktopTaglibContext();
48: return EVAL_PAGE;
49: }
50: }
|