mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.0 to HEAD
5456: (From WCM_DEPLOY) There were many pure conflicts on license headers, one conflict due to CR-LF and some other smaller issues to resolve: ----------------------------------------- Resolved (line endings not cr-lf): root\projects\repository\config\alfresco\public-services-context.xml Reverted: root\projects\web-client\source\web\images\icons\ajax_anim.gif Reverted or Resolved (License text conflicts): svn revert root\projects\jndi-client\source\java\org\alfresco\jndi\JndiTest.java svn resolved root\projects\jndi-client\source\java\org\alfresco\jndi\AVMFileDirContext.java svn revert root\projects\jndi-client\source\java\org\alfresco\jndi\AVMBulkLoader.java svn revert root\projects\jndi-client\source\java\org\alfresco\filter\CacheControlFilter.java svn revert root\projects\jndi-client\source\java\org\alfresco\filter\CacheControlFilterInfoBean.java svn revert -R root\projects\catalina-virtual\source\java\org\alfresco\mbeans svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\context\AVMStandardContext.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\loader\AVMWebappClassLoader.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\loader\AVMWebappLoader.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\host\AVMResourceBinding.java svn resolved root\projects\catalina-virtual\source\java\org\alfresco\catalina\host\AVMHostConfig.java - why the change in method naming convention? svn resolved root\projects\catalina-virtual\source\java\org\alfresco\catalina\host\AVMHost.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\host\DefaultAVMResourceBinding.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\valve\AVMUrlValveTest.java svn resolved root\projects\catalina-virtual\source\java\org\alfresco\catalina\valve\AVMUrlValve.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\host\AVMHostMatch.java Modified: root\projects\web-client\source\java\org\alfresco\web\ui\wcm\component\UIDeployWebsite.java (Kevin to check line 330) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5484 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -27,6 +27,7 @@ import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.transform.ErrorListener;
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Transformer;
|
||||
@@ -228,9 +229,6 @@ public class XSLTRenderingEngine
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(XSLTRenderingEngine.class);
|
||||
|
||||
public static final QName PROP_URI_RESOLVER_BASE_URI =
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "xslt_resolver_base_uri");
|
||||
|
||||
public XSLTRenderingEngine() { }
|
||||
|
||||
public String getName() { return "XSLT"; }
|
||||
@@ -401,13 +399,83 @@ public class XSLTRenderingEngine
|
||||
this.addScripts(model, xslTemplate);
|
||||
this.addParameters(model, xslTemplate);
|
||||
|
||||
final LinkedList<TransformerException> errors = new LinkedList<TransformerException>();
|
||||
final ErrorListener errorListener = new ErrorListener()
|
||||
{
|
||||
public void error(final TransformerException te)
|
||||
throws TransformerException
|
||||
{
|
||||
LOGGER.debug("error " + te.getMessageAndLocation());
|
||||
errors.add(te);
|
||||
}
|
||||
|
||||
public void fatalError(final TransformerException te)
|
||||
throws TransformerException
|
||||
{
|
||||
LOGGER.debug("fatalError " + te.getMessageAndLocation());
|
||||
throw te;
|
||||
}
|
||||
|
||||
public void warning(final TransformerException te)
|
||||
throws TransformerException
|
||||
{
|
||||
LOGGER.debug("warning " + te.getMessageAndLocation());
|
||||
errors.add(te);
|
||||
}
|
||||
};
|
||||
|
||||
// create a uri resolver to resolve document() calls to the virtualized
|
||||
// web application
|
||||
final URIResolver uriResolver = new URIResolver()
|
||||
{
|
||||
public Source resolve(final String href, String base)
|
||||
throws TransformerException
|
||||
{
|
||||
LOGGER.debug("request to resolve href " + href +
|
||||
" using base " + base);
|
||||
final RenderingEngine.TemplateResourceResolver trr = (RenderingEngine.TemplateResourceResolver)
|
||||
model.get(RenderingEngineTemplateImpl.PROP_RESOURCE_RESOLVER);
|
||||
|
||||
InputStream in = null;
|
||||
try
|
||||
{
|
||||
in = trr.resolve(href);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new TransformerException("unable to load " + href, e);
|
||||
}
|
||||
|
||||
if (in == null)
|
||||
{
|
||||
throw new TransformerException("unable to resolve href " + href);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
final Document d = XMLUtil.parse(in);
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("loaded " + XMLUtil.toString(d));
|
||||
return new DOMSource(d);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new TransformerException("unable to load " + href, e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Source xmlSource = this.getXMLSource(model);
|
||||
|
||||
Transformer t = null;
|
||||
try
|
||||
{
|
||||
final TransformerFactory tf = TransformerFactory.newInstance();
|
||||
tf.setErrorListener(errorListener);
|
||||
tf.setURIResolver(uriResolver);
|
||||
t = tf.newTransformer(new DOMSource(xslTemplate));
|
||||
t.setErrorListener(errorListener);
|
||||
t.setURIResolver(uriResolver);
|
||||
t.setParameter("versionParam", "2.0");
|
||||
}
|
||||
catch (TransformerConfigurationException tce)
|
||||
@@ -416,47 +484,6 @@ public class XSLTRenderingEngine
|
||||
throw new RenderingEngine.RenderingException(tce);
|
||||
}
|
||||
|
||||
// create a uri resolver to resolve document() calls to the virtualized
|
||||
// web application
|
||||
t.setURIResolver(new URIResolver()
|
||||
{
|
||||
public Source resolve(final String href, String base)
|
||||
throws TransformerException
|
||||
{
|
||||
LOGGER.debug("request to resolve href " + href +
|
||||
" using base " + base);
|
||||
if (model.containsKey(PROP_URI_RESOLVER_BASE_URI))
|
||||
{
|
||||
base = (String)model.get(PROP_URI_RESOLVER_BASE_URI);
|
||||
LOGGER.debug("overriding base with " + base);
|
||||
}
|
||||
|
||||
URI uri = null;
|
||||
try
|
||||
{
|
||||
uri = new URI(base + href);
|
||||
}
|
||||
catch (URISyntaxException e)
|
||||
{
|
||||
throw new TransformerException("unable to create uri " + base + href,
|
||||
e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("loading " + uri);
|
||||
final Document d = XMLUtil.parse(uri.toURL().openStream());
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("loaded " + XMLUtil.toString(d));
|
||||
return new DOMSource(d);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new TransformerException("unable to load " + uri, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
t.transform(xmlSource, result);
|
||||
@@ -471,5 +498,15 @@ public class XSLTRenderingEngine
|
||||
LOGGER.error("unexpected error " + e);
|
||||
throw new RenderingEngine.RenderingException(e);
|
||||
}
|
||||
|
||||
if (errors.size() != 0)
|
||||
{
|
||||
final StringBuilder msg = new StringBuilder("errors encountered during transformation: \n");
|
||||
for (TransformerException te : errors)
|
||||
{
|
||||
msg.append(te.getMessageAndLocation()).append("\n");
|
||||
}
|
||||
throw new RenderingEngine.RenderingException(msg.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user