01: /*
02: * Copyright 2003 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.TypedException;
14: import com.sun.portal.providers.Provider;
15: import com.sun.portal.providers.ProviderException;
16: import com.sun.portal.providers.context.ContainerProviderContext;
17: import com.sun.portal.providers.containers.jsp.single.JSPSingleContainerProvider;
18:
19: public class ObtainSelectedChannelFromRequestTag extends
20: 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
27: .getSelectedChannel((HttpServletRequest) pageContext
28: .getRequest());
29: p = scp.getContainerProviderContext().getProvider(
30: (HttpServletRequest) pageContext.getRequest(),
31: scp.getName(), selectedChannel);
32: } catch (ProviderException pe) {
33: throw new DesktopTaglibException(pe);
34: }
35:
36: if (p == null)
37: throw new DesktopTaglibException(selectedChannel
38: + " channel is not available",
39: TypedException.UNKNOWN_CHANNEL_TYPE);
40:
41: setCurrentProvider(p);
42: saveDesktopTaglibContext();
43:
44: return EVAL_BODY_INCLUDE;
45: }
46:
47: public int doEndTag() throws JspException {
48: setCurrentProvider(null);
49: saveDesktopTaglibContext();
50: return EVAL_PAGE;
51: }
52: }
|