/*
* Copyright 2001 Sun Microsystems, Inc. All rights reserved.
* PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
*/
package com.sun.portal.desktop;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//
// this class may introduce some performance troubles using java 1.2,
// but they are reported to be fixed in java 1.3.
//
public class DesktopRequestThreadLocalizer {
private static ThreadLocal requestThreadLocal = new ThreadLocal();
private static ThreadLocal responseThreadLocal = new ThreadLocal();
private DesktopRequestThreadLocalizer() {
// nothing, cannot be called
}
public static HttpServletRequest getRequest() {
HttpServletRequest req = (HttpServletRequest)requestThreadLocal.get();
return req;
}
public static HttpServletResponse getResponse() {
HttpServletResponse res = (HttpServletResponse)responseThreadLocal.get();
return res;
}
public static void set(HttpServletRequest req, HttpServletResponse res) {
requestThreadLocal.set(req);
responseThreadLocal.set(res);
}
}
|