*/
private Set<DefDescriptor<?>> handleTopLevel(HttpServletRequest request, HttpServletResponse response,
AuraContext context) throws IOException, ServletException {
DefDescriptor<? extends BaseComponentDef> appDesc = context.getApplicationDescriptor();
DefinitionService definitionService = Aura.getDefinitionService();
MasterDefRegistry mdr = context.getDefRegistry();
context.setPreloading(true);
if (appDesc == null) {
//
// This means we have nothing to say to the client, so the response is
// left completely empty.
//
return null;
}
long ifModifiedSince = request.getDateHeader(HttpHeaders.IF_MODIFIED_SINCE);
String uid = context.getUid(appDesc);
try {
try {
definitionService.updateLoaded(appDesc);
if (uid != null && ifModifiedSince != -1) {
//
// In this case, we have an unmodified descriptor, so just tell
// the client that.
//
response.sendError(HttpServletResponse.SC_NOT_MODIFIED);
return null;
}
} catch (ClientOutOfSyncException coose) {
//
// We can't actually handle an out of sync here, since we are doing a
// preload. We have to ignore it, and continue as if nothing happened.
// But in the process, we make sure to set 'no-cache' so that the result
// is thrown away. This may actually not give the right result in bizarre
// corner cases... beware cache inconsistencied on revert after a QFE.
//
// We actually probably should do something different, like send a minimalist
// set of stuff to make the client re-try.
//
setNoCache(response);
String oosUid = mdr.getUid(null, appDesc);
return mdr.getDependencies(oosUid);
}
} catch (QuickFixException qfe) {
DefDescriptor<ComponentDef> qfeDescriptor;
//
// A quickfix exception means that we couldn't compile something.
// In this case, we still want to preload things, but we want to preload
// quick fix values, note that we force NoCache here.
//
setNoCache(response);
qfeDescriptor = definitionService.getDefDescriptor("markup://auradev:quickFixException",
ComponentDef.class);
context.setLoadingApplicationDescriptor(qfeDescriptor);
String qfeUid;
try {
qfeUid = mdr.getUid(null, qfeDescriptor);
} catch (QuickFixException death) {
//
// Ok, we really can't handle this here, so just punt. This means that
// the quickfix display is broken, and whatever we try will give us grief.
//
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return null;
}
return mdr.getDependencies(qfeUid);
}
setLongCache(response);
if (uid == null) {
uid = context.getUid(appDesc);
}
return mdr.getDependencies(uid);
}