View | Details | Raw Unified | Return to bug 4690
Collapse All | Expand All

(-)catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java (-2 / +10 lines)
Lines 919-926 Link Here
919
                }
919
                }
920
                crossContext = !(context.getPath().equals(contextPath));
920
                crossContext = !(context.getPath().equals(contextPath));
921
            }
921
            }
922
            wrapper = new ApplicationHttpRequest
922
            if (!(outerResponse instanceof HttpServletResponse)) {
923
                (hcurrent, context, crossContext);
923
                wrapper = new ApplicationHttpRequest
924
                    (hcurrent, context, crossContext);
925
            }
926
            else {
927
                HttpServletResponse res = (HttpServletResponse)outerResponse;
928
                wrapper = new ApplicationHttpRequest
929
                    (hcurrent, res, context, crossContext);
930
            }
931
924
        } else {
932
        } else {
925
            wrapper = new ApplicationRequest(current);
933
            wrapper = new ApplicationRequest(current);
926
        }
934
        }
(-)catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java (-3 / +37 lines)
Lines 30-35 Link Here
30
import javax.servlet.http.HttpServletRequest;
30
import javax.servlet.http.HttpServletRequest;
31
import javax.servlet.http.HttpServletRequestWrapper;
31
import javax.servlet.http.HttpServletRequestWrapper;
32
import javax.servlet.http.HttpSession;
32
import javax.servlet.http.HttpSession;
33
import javax.servlet.http.Cookie;
34
import javax.servlet.http.HttpServletResponse;
33
35
34
import org.apache.catalina.Context;
36
import org.apache.catalina.Context;
35
import org.apache.catalina.Globals;
37
import org.apache.catalina.Globals;
Lines 82-88 Link Here
82
84
83
    // ----------------------------------------------------------- Constructors
85
    // ----------------------------------------------------------- Constructors
84
86
85
86
    /**
87
    /**
87
     * Construct a new wrapped request around the specified servlet request.
88
     * Construct a new wrapped request around the specified servlet request.
88
     *
89
     *
Lines 98-103 Link Here
98
99
99
    }
100
    }
100
101
102
    /**
103
     * Construct a new wrapped request around the specified servlet request.
104
     *
105
     * @param request The servlet request being wrapped
106
     */
107
    public ApplicationHttpRequest(HttpServletRequest request,
108
                                  HttpServletResponse response,
109
                                  Context context,
110
                                  boolean crossContext) {
111
112
        super(request);
113
        this.context = context;
114
        this.crossContext = crossContext;
115
        setRequest(request);
116
        setResponse(response);
117
118
    }
119
101
120
102
    // ----------------------------------------------------- Instance Variables
121
    // ----------------------------------------------------- Instance Variables
103
122
Lines 188-193 Link Here
188
     */
207
     */
189
    protected Session session = null;
208
    protected Session session = null;
190
209
210
    /**
211
     * The associated response.  Used for creating new sessions.
212
     */
213
    protected HttpServletResponse response;
214
191
215
192
    /**
216
    /**
193
     * Special attributes.
217
     * Special attributes.
Lines 473-481 Link Here
473
     * @param create Create a new session if one does not exist
497
     * @param create Create a new session if one does not exist
474
     */
498
     */
475
    public HttpSession getSession(boolean create) {
499
    public HttpSession getSession(boolean create) {
476
477
        if (crossContext) {
500
        if (crossContext) {
478
            
479
            // There cannot be a session if no context has been assigned yet
501
            // There cannot be a session if no context has been assigned yet
480
            if (context == null)
502
            if (context == null)
481
                return (null);
503
                return (null);
Lines 507-512 Link Here
507
                    localSession.setMaxInactiveInterval
529
                    localSession.setMaxInactiveInterval
508
                        (context.getManager().getMaxInactiveInterval());
530
                        (context.getManager().getMaxInactiveInterval());
509
                    localSession.setId(other.getId());
531
                    localSession.setId(other.getId());
532
533
                    if (context.getCookies() && response != null &&
534
                        !response.isCommitted()) {
535
                        Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
536
                                                   localSession.getId());
537
                        cookie.setPath(context.getPath());
538
                        response.addCookie(cookie);
539
                    }
510
                }
540
                }
511
                localSession.access();
541
                localSession.access();
512
                session = localSession;
542
                session = localSession;
Lines 621-626 Link Here
621
        requestURI = request.getRequestURI();
651
        requestURI = request.getRequestURI();
622
        servletPath = request.getServletPath();
652
        servletPath = request.getServletPath();
623
653
654
    }
655
656
    void setResponse(HttpServletResponse response) {
657
        this.response = response;
624
    }
658
    }
625
659
626
660

Return to bug 4690