if (updateURI == null || wapp == null)
throw new IllegalArgumentException("null");
//Feature 1811241: we create a temporary exec (in WebManager.newDesktop),
//so DesktopInit can access Executions.getCurrent
final Execution exec = Executions.getCurrent();
if (exec != null)
((ExecutionCtrl)exec).setDesktop(this);
_wapp = wapp;
_updateURI = updateURI;
init();
_sess = Sessions.getCurrent(); //must be the current session
String dir = null;
if (path != null) {
_path = path;
final int j = path.lastIndexOf('/');
if (j >= 0) dir = path.substring(0, j + 1);
} else {
_path = "";
}
setCurrentDirectory(dir);
_qs = getQueryString(request);
if (deviceType != null && deviceType.length() != 0)
setDeviceType(deviceType);
final Configuration config = _wapp.getConfiguration();
_exec = exec; //fake
try {
final WebAppCtrl wappc = (WebAppCtrl)_wapp;
final DesktopCache dc = _sess != null ? wappc.getDesktopCache(_sess): null;
//_sess is null if in a working thread
final IdGenerator idgen = wappc.getIdGenerator();
if (idgen != null)
_id = idgen.nextDesktopId(this);
if (_id == null)
_id = nextDesktopId(dc);
else if (idgen != null)
ComponentsCtrl.checkUuid(_id);
updateUuidPrefix();
config.invokeDesktopInits(this, request); //it might throw exception
if (exec != null && exec.isVoided()) return; //sendredirect or forward
if (dc != null)
dc.addDesktop(this); //add to cache after invokeDesktopInits
final Monitor monitor = config.getMonitor();