~ubuntu-branches/ubuntu/oneiric/tomcat6/oneiric

« back to all changes in this revision

Viewing changes to java/org/apache/catalina/connector/Request.java

  • Committer: Bazaar Package Importer
  • Author(s): Thierry Carrez
  • Date: 2010-07-20 14:36:48 UTC
  • mfrom: (2.2.17 sid)
  • Revision ID: james.westby@ubuntu.com-20100720143648-23y81x6cq1kv1z00
Tags: 6.0.28-2
* Add debconf questions for user, group and Java options.
* Use ucf to install /etc/default/tomcat6 from a template
* Drop CATALINA_BASE and CATALINA_HOME from /etc/default/tomcat6 since we
  shouldn't encourage users to change those anyway

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
import org.apache.catalina.realm.GenericPrincipal;
69
69
import org.apache.catalina.util.Enumerator;
70
70
import org.apache.catalina.util.ParameterMap;
71
 
import org.apache.catalina.util.RequestUtil;
72
71
import org.apache.catalina.util.StringManager;
73
72
import org.apache.catalina.util.StringParser;
74
73
 
78
77
 *
79
78
 * @author Remy Maucherat
80
79
 * @author Craig R. McClanahan
81
 
 * @version $Revision: 892545 $ $Date: 2009-12-20 02:04:17 +0100 (So, 20. Dez 2009) $
 
80
 * @version $Id: Request.java 955665 2010-06-17 16:23:22Z kkolinko $
82
81
 */
83
82
 
84
83
public class Request
2252
2251
            return;
2253
2252
        
2254
2253
        if (response != null) {
2255
 
            Cookie newCookie = new Cookie(Globals.SESSION_COOKIE_NAME,
2256
 
                    newSessionId);
2257
 
            newCookie.setMaxAge(-1);
2258
 
            String contextPath = null;
2259
 
            if (!response.getConnector().getEmptySessionPath()
2260
 
                    && (context != null)) {
2261
 
                contextPath = context.getEncodedPath();
2262
 
            }
2263
 
            if ((contextPath != null) && (contextPath.length() > 0)) {
2264
 
                newCookie.setPath(contextPath);
2265
 
            } else {
2266
 
                newCookie.setPath("/");
2267
 
            }
2268
 
            if (isSecure()) {
2269
 
                newCookie.setSecure(true);
2270
 
            }
 
2254
            String scName = null;
 
2255
            if (context != null) {
 
2256
                scName = context.getSessionCookieName();
 
2257
            }
 
2258
            if (scName == null) {
 
2259
                scName = Globals.SESSION_COOKIE_NAME;
 
2260
            }
 
2261
            
 
2262
            Cookie newCookie = new Cookie(scName, newSessionId);
 
2263
 
 
2264
            configureSessionCookie(newCookie);
 
2265
 
2271
2266
            if (context == null) {
2272
 
                response.addCookieInternal(newCookie, false);
 
2267
                response.addSessionCookieInternal(newCookie, false);
2273
2268
            } else {
2274
 
                response.addCookieInternal(newCookie, context.getUseHttpOnly());
 
2269
                response.addSessionCookieInternal(newCookie,
 
2270
                        context.getUseHttpOnly());
2275
2271
            }
2276
2272
        }
2277
2273
    }
2395
2391
        // Creating a new session cookie based on that session
2396
2392
        if ((session != null) && (getContext() != null)
2397
2393
               && getContext().getCookies()) {
2398
 
            Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
2399
 
                                       session.getIdInternal());
 
2394
            String scName = context.getSessionCookieName();
 
2395
            if (scName == null) {
 
2396
                scName = Globals.SESSION_COOKIE_NAME;
 
2397
            }
 
2398
            Cookie cookie = new Cookie(scName, session.getIdInternal());
2400
2399
            configureSessionCookie(cookie);
2401
 
            response.addCookieInternal(cookie, context.getUseHttpOnly());
 
2400
            response.addSessionCookieInternal(cookie, context.getUseHttpOnly());
2402
2401
        }
2403
2402
 
2404
2403
        if (session != null) {
2417
2416
     */
2418
2417
    protected void configureSessionCookie(Cookie cookie) {
2419
2418
        cookie.setMaxAge(-1);
 
2419
        
 
2420
        Context ctxt = getContext();
 
2421
        
2420
2422
        String contextPath = null;
2421
 
        if (!connector.getEmptySessionPath() && (getContext() != null)) {
2422
 
            contextPath = getContext().getEncodedPath();
 
2423
        if (ctxt != null && !getConnector().getEmptySessionPath()) {
 
2424
            if (ctxt.getSessionCookiePath() != null) {
 
2425
                contextPath = ctxt.getSessionCookiePath();
 
2426
            } else {
 
2427
                contextPath = ctxt.getEncodedPath();
 
2428
            }
2423
2429
        }
2424
2430
        if ((contextPath != null) && (contextPath.length() > 0)) {
2425
2431
            cookie.setPath(contextPath);
2426
2432
        } else {
2427
2433
            cookie.setPath("/");
2428
2434
        }
 
2435
        
 
2436
        if (ctxt != null && ctxt.getSessionCookieDomain() != null) {
 
2437
            cookie.setDomain(ctxt.getSessionCookieDomain());
 
2438
        }
 
2439
 
2429
2440
        if (isSecure()) {
2430
2441
            cookie.setSecure(true);
2431
2442
        }
2583
2594
                }
2584
2595
                return;
2585
2596
            }
2586
 
            parameters.processParameters(formData, 0, formData.length);
 
2597
            if (formData != null) {
 
2598
                parameters.processParameters(formData, 0, formData.length);
 
2599
            }
2587
2600
        }
2588
2601
 
2589
2602
    }
2629
2642
                body.append(buffer, 0, len);
2630
2643
            }
2631
2644
        }
 
2645
        if (body.getLength() == 0) {
 
2646
            return null;
 
2647
        }
2632
2648
        if (body.getLength() < body.getBuffer().length) {
2633
2649
            int length = body.getLength();
2634
2650
            byte[] result = new byte[length];