if (_webApp == null) {
final WebManager webman = WebManager.getWebManager(((HttpServletRequest) request).getSession(false).getServletContext());
_webApp = webman.getWebApp();
}
final Desktop desktop = (Desktop) request.getAttribute(ATTR_DESKTOP);
if (desktop == null) {
final String dtid = request.getParameter("dt");
if (dtid != null) {
final HttpSession hsess = ((HttpServletRequest)request).getSession(false);
if (hsess != null) {
if (hsess.getAttribute(dtid) != null) { //with the preset token
hsess.removeAttribute(dtid);
final Session sess = ((WebAppCtrl)_webApp).getSessionCache().get(hsess);
if (sess != null) {
final DesktopCache cache = ((WebAppCtrl)_webApp).getDesktopCache(sess);
if (cache != null) {
final Desktop olddesktop = cache.getDesktopIfAny(dtid);
if (olddesktop != null) {
//set ATTR_DESKTOP, so will reuse the old desktop
request.setAttribute(ATTR_DESKTOP, olddesktop);
//cleanup the "au" channel to avoid get the
// residue of the previous desktop operation