throws JahiaException {
String fieldIDStr = Integer.toString(fieldID);
String entryPointUniqueIDStr = fieldIDStr + ENTRYPOINT_ID_SEPARATOR + entryPointIDStr;
EntryPointInstance entryPointInstance = ServicesRegistry.getInstance().getApplicationsManagerService().getEntryPointInstance(entryPointIDStr, workspaceName);
if (entryPointInstance == null) {
if(entryPointIDStr != null){
logger.error("Couldn't find application entry point with ID=" + entryPointIDStr);
}else{
logger.debug("ID=" + entryPointIDStr+" --> no selected application.");
}
return "";
}
ApplicationBean appBean = applicationsManager.getApplicationByContext(entryPointInstance.getContextName());
if (appBean == null) {
logger.error("Couldn't find application with appID=" + entryPointIDStr);
return "";
}
DispatchingProvider dispatcher = (DispatchingProvider) dispatchingProviders.get(appBean.getType());
if (dispatcher == null) {
logger.error("Found no dispatching that corresponds to application type [" + appBean.getType() + "]");
return "";
}
// we deactivate the HTML page cache to avoid storing the entry screen of
// the application (first call on a page since it was flushed) in the
// HTML cache. The side effect of this is that any page that contains
// a web application is *NEVER* cached.
// jParams.setCacheExpirationDelay(0);
// Now let's check the request URL to see if the target application is this one or not.
Object url = httpServletRequest.getAttribute("url");
httpServletRequest.setAttribute("url",null); // todo : should we put something here ?
String renderResult = null;
if(httpServletRequest!=null) {
// now we can render the output of the application.
// we check the request, because we want to make sure this
// method is called only once.
if (httpServletRequest.getAttribute("org.jahia.applications.renderAlreadyProcessed." + entryPointUniqueIDStr) == null) {
// process the action now
renderResult = dispatcher.render(entryPointInstance, entryPointInstance.getID(), jahiaUser, httpServletRequest, httpServletResponse, servletContext, workspaceName);
httpServletRequest.setAttribute("org.jahia.applications.renderAlreadyProcessed." + entryPointUniqueIDStr, renderResult);
} else {
renderResult = (String) httpServletRequest.getAttribute("org.jahia.applications.renderAlreadyProcessed." + entryPointUniqueIDStr);
}
}