craigmcc 01/06/13 14:32:57
Modified: src/share/org/apache/struts/taglib/bean IncludeTag.java
Log:
Port the fix for bugzilla #2125.
Revision Changes Path
1.16 +17 -3
jakarta-struts/src/share/org/apache/struts/taglib/bean/IncludeTag.java
Index: IncludeTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/IncludeTag.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- IncludeTag.java 2001/05/14 17:54:56 1.15
+++ IncludeTag.java 2001/06/13 21:32:54 1.16
@@ -1,5 +1,5 @@
/*
- * $Id: IncludeTag.java,v 1.15 2001/05/14 17:54:56 craigmcc Exp $
+ * $Id: IncludeTag.java,v 1.16 2001/06/13 21:32:54 craigmcc Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -63,6 +63,7 @@
import java.io.BufferedInputStream;
import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
@@ -92,7 +93,7 @@
* wrapped response passed to RequestDispatcher.include().
*
* @author Craig R. McClanahan
- * @version $Revision: 1.15 $ $Date: 2001/05/14 17:54:56 $
+ * @version $Revision: 1.16 $ $Date: 2001/06/13 21:32:54 $
*/
public class IncludeTag extends TagSupport {
@@ -246,11 +247,24 @@
URLConnection conn = null;
try {
+ // Set up the basic connection
conn = url.openConnection();
conn.setAllowUserInteraction(false);
conn.setDoInput(true);
conn.setDoOutput(false);
- conn.connect();
+ // Add a session id cookie if appropriate
+ HttpServletRequest request =
+ (HttpServletRequest) pageContext.getRequest();
+ if ((conn instanceof HttpURLConnection) &&
+ urlString.startsWith(request.getContextPath()) &&
+ (request.getRequestedSessionId() != null) &&
+ request.isRequestedSessionIdFromCookie()) {
+ StringBuffer sb = new StringBuffer("JSESSIONID=");
+ sb.append(request.getRequestedSessionId());
+ conn.setRequestProperty("Cookie", sb.toString());
+ }
+ // Connect to the requested resource
+ conn.connect();
} catch (Exception e) {
RequestUtils.saveException(pageContext, e);
throw new JspException