Removed xalan dependency and made the needed changes to the code which makes the xsl transformations.
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerCore@95546 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
05484cf8de
commit
e7e5ca1f41
6
pom.xml
6
pom.xml
|
@ -9,7 +9,7 @@
|
|||
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
<version>4.3.0-SNAPSHOT</version>
|
||||
<version>4.4.0-SNAPSHOT</version>
|
||||
|
||||
|
||||
<name>Application Support Layer Core</name>
|
||||
|
@ -96,13 +96,13 @@
|
|||
<artifactId>kxml2</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
<version>2.6.0</version>
|
||||
</dependency>
|
||||
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.addressing</groupId>
|
||||
<artifactId>addressing</artifactId>
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.gcube.application.framework.core.util.SessionConstants;
|
|||
//import org.gcube.application.framework.core.util.UserCredential;
|
||||
//import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
//import org.gridforum.jgss.ExtendedGSSCredential;
|
||||
|
||||
/**
|
||||
|
@ -41,6 +42,7 @@ public class ASLSession{
|
|||
private String externalSessionID;
|
||||
private String username;
|
||||
// private ExtendedGSSCredential credential;
|
||||
private String parentScope;
|
||||
private String scope;
|
||||
private HashMap<String, Notifier> notifiers;
|
||||
String scopeName;
|
||||
|
@ -246,6 +248,12 @@ public class ASLSession{
|
|||
innerSession.clear();
|
||||
}
|
||||
|
||||
public String getParentScope(){
|
||||
ScopeBean bean = new ScopeBean(getScope());
|
||||
parentScope = bean.enclosingScope().toString();
|
||||
return parentScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* invalidates the session
|
||||
*/
|
||||
|
|
|
@ -16,20 +16,21 @@ import javax.xml.parsers.ParserConfigurationException;
|
|||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Templates;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.apache.xalan.processor.TransformerFactoryImpl;
|
||||
|
||||
//import org.apache.xalan.processor.TransformerFactoryImpl;
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -119,20 +120,35 @@ public class LayoutPortlets {
|
|||
* @return the HTML.
|
||||
* @throws TransformerException if an error occurs.
|
||||
*/
|
||||
public static String transform(String xml, String xslt) throws TransformerException
|
||||
{
|
||||
|
||||
TransformerFactoryImpl factory = new TransformerFactoryImpl();
|
||||
StreamSource sourceInput = new StreamSource(new ByteArrayInputStream(xslt.getBytes()));
|
||||
Templates sheet = factory.newTemplates(sourceInput);
|
||||
|
||||
Transformer instance = sheet.newTransformer();
|
||||
instance.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "true");
|
||||
// public static String transform_OLD(String xml, String xslt) throws TransformerException
|
||||
// {
|
||||
//
|
||||
// TransformerFactoryImpl factory = new TransformerFactoryImpl();
|
||||
// StreamSource sourceInput = new StreamSource(new ByteArrayInputStream(xslt.getBytes()));
|
||||
// Templates sheet = factory.newTemplates(sourceInput);
|
||||
//
|
||||
// Transformer instance = sheet.newTransformer();
|
||||
// instance.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "true");
|
||||
// StringWriter w = new StringWriter();
|
||||
// instance.transform(new StreamSource(new StringReader(xml)), new StreamResult(w));
|
||||
//
|
||||
// return w.toString();
|
||||
// }
|
||||
|
||||
public static String transform(String dataXML, String inputXSL)
|
||||
throws TransformerConfigurationException,
|
||||
TransformerException
|
||||
{
|
||||
StreamSource xsltInput = new StreamSource(new ByteArrayInputStream(inputXSL.getBytes()));
|
||||
StringWriter w = new StringWriter();
|
||||
instance.transform(new StreamSource(new StringReader(xml)), new StreamResult(w));
|
||||
|
||||
TransformerFactory factory = TransformerFactory.newInstance();
|
||||
Transformer transformer = factory.newTransformer(xsltInput);
|
||||
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "true");
|
||||
transformer.transform(new StreamSource(new StringReader(dataXML)), new StreamResult(w));
|
||||
return w.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//method to convert Document to String
|
||||
private static String getStringFromDocument(Document doc)
|
||||
|
|
Loading…
Reference in New Issue