01: /**
02: * $Id: IncludeTag.java,v 1.10 2005/09/21 10:53:23 dg154973 Exp $
03: * Copyright 2002 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.wireless.taglibs.util;
14:
15: import javax.servlet.jsp.*;
16: import javax.servlet.jsp.tagext.*;
17: import java.io.*;
18: import java.util.logging.Level;
19: import java.util.logging.LogRecord;
20: import java.util.logging.Logger;
21:
22: import javax.servlet.*;
23: import javax.servlet.http.*;
24:
25: //import com.sun.portal.session.*;
26: //import com.sun.portal.profile.*;
27: //import com.sun.portal.client.*;
28:
29: import com.iplanet.sso.*;
30: import com.iplanet.am.util.*;
31:
32: import com.sun.portal.log.common.PortalLogger;
33: import com.sun.portal.wireless.taglibs.base.*;
34:
35: /**
36: * <util:include> tag implementation.
37: *
38: *
39: * @author John Saare
40: * @version 1.0, 04/16/2001
41: */
42: public class IncludeTag extends UrlMaker {
43:
44: private static Logger logger = PortalLogger
45: .getLogger(IncludeTag.class);
46:
47: /**
48: * Include...
49: * Take note that include will ONLY work with a valid session.
50: * Because errorPage/forwarding will not work in the included page due to
51: * flushing of buffers, this checking for valid session will hopefully
52: * minimize the chances of this happening.
53: *
54: * @return what to do next
55: */
56: public int doStartTag() throws JspException {
57:
58: getContext();
59:
60: // Check tht we have a valid session.
61: SSOToken session = context.getSession();
62: if (null == session) {
63: if (logger.isLoggable(Level.SEVERE)) {
64: LogRecord rec = new LogRecord(Level.SEVERE,
65: "PSMA_CSPWTU0002");
66: String[] param = { "doStartTag" };
67: rec.setParameters(param);
68: rec.setLoggerName(logger.getName());
69: logger.log(rec);
70: }
71: throw new JspException(this .getClass().getName()
72: + ".doStartTag() failed.");
73: }
74:
75: String finalUrl;
76:
77: try {
78: finalUrl = computeUrl(false);
79: pageContext.include(finalUrl);
80:
81: } catch (Exception e) {
82: if (logger.isLoggable(Level.SEVERE)) {
83: LogRecord rec = new LogRecord(Level.SEVERE,
84: "PSMA_CSPWTU0002");
85: rec.setThrown(e);
86: String[] param = { "doStartTag" };
87: rec.setParameters(param);
88: rec.setLoggerName(logger.getName());
89: logger.log(rec);
90: }
91: throw new JspException(this .getClass().getName()
92: + ".doStartTag() failed.");
93: }
94:
95: return (SKIP_BODY);
96: }
97:
98: }
|