Workaround added to WebScript status template to handle very strange proxied Hibernate Exception objects.

Fix to PageTag to work outside of a valid FacesContext scope.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10122 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2008-07-30 13:08:14 +00:00
parent 872b6c940c
commit 979d719f54

View File

@@ -371,21 +371,28 @@ public class PageTag extends TagSupport
*/
private String getWindowOnloadCode()
{
CCProperties ccProps = (CCProperties) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "CCProperties");
StringBuffer onloadCode = new StringBuffer();
if (ccProps.getWebdavUrl() != null || ccProps.getCifsPath() != null)
FacesContext fc = FacesContext.getCurrentInstance();
if (fc != null)
{
String webdavUrl = (ccProps.getWebdavUrl() != null) ? (ccProps.getWebdavUrl()) : ("");
String cifsPath = (ccProps.getCifsPath() != null) ? (ccProps.getCifsPath()) : ("");
onloadCode.append("window.onload=onloadFunc('").append(webdavUrl).append("','").append(cifsPath).append("');");
ccProps.setCifsPath(null); // we need reset cifsPath flag
ccProps.setWebdavUrl(null); // we need reset webdavUrl flag
CCProperties ccProps = (CCProperties) FacesHelper.getManagedBean(fc, "CCProperties");
StringBuilder onloadCode = new StringBuilder();
if (ccProps.getWebdavUrl() != null || ccProps.getCifsPath() != null)
{
String webdavUrl = (ccProps.getWebdavUrl() != null) ? (ccProps.getWebdavUrl()) : ("");
String cifsPath = (ccProps.getCifsPath() != null) ? (ccProps.getCifsPath()) : ("");
onloadCode.append("window.onload=onloadFunc('").append(webdavUrl).append("','").append(cifsPath).append("');");
ccProps.setCifsPath(null); // we need reset cifsPath flag
ccProps.setWebdavUrl(null); // we need reset webdavUrl flag
}
return onloadCode.toString();
}
else
{
return "";
}
return onloadCode.toString();
}
}