diff options
author | wbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-09-25 07:29:47 +0000 |
---|---|---|
committer | wbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-09-25 07:29:47 +0000 |
commit | e21dd5249d5fa19c5619847922cf8cdea95e3145 (patch) | |
tree | 00756b302d7fe37a4912ff5da812e25e2a781d9b /utils | |
parent | 55302f2bbe65d28a21d61822f3c316a7fafd1eff (diff) | |
download | mocca-e21dd5249d5fa19c5619847922cf8cdea95e3145.tar.gz mocca-e21dd5249d5fa19c5619847922cf8cdea95e3145.tar.bz2 mocca-e21dd5249d5fa19c5619847922cf8cdea95e3145.zip |
improved robustness of http binding processor
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@70 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'utils')
-rw-r--r-- | utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/HTTPURLProtocolHandlerImpl.java | 3 | ||||
-rw-r--r-- | utils/src/main/java/at/gv/egiz/idlink/IdentityLinkTransformer.java | 30 |
2 files changed, 24 insertions, 9 deletions
diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/HTTPURLProtocolHandlerImpl.java b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/HTTPURLProtocolHandlerImpl.java index 600e5605..8d01fad1 100644 --- a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/HTTPURLProtocolHandlerImpl.java +++ b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/HTTPURLProtocolHandlerImpl.java @@ -52,7 +52,8 @@ public class HTTPURLProtocolHandlerImpl implements URLProtocolHandler { protected StreamData dereferenceHTTP(URL url) throws IOException { log.debug("Dereferencing url: "+url);
- HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
+ HttpURLConnection httpConn = (HttpURLConnection) url.openConnection(); + log.trace("Successfully opened connection");
return new StreamData(url.toString(), httpConn.getContentType(), httpConn
.getInputStream());
}
diff --git a/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkTransformer.java b/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkTransformer.java index 060ccef5..98f8d1c1 100644 --- a/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkTransformer.java +++ b/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkTransformer.java @@ -35,13 +35,20 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.stream.StreamSource; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; + +import at.gv.egiz.bku.utils.urldereferencer.StreamData; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; -public class IdentityLinkTransformer {
+public class IdentityLinkTransformer { + + protected static Log log = LogFactory.getLog(IdentityLinkTransformer.class);
private class IdLTransformer {
@@ -101,11 +108,15 @@ public class IdentityLinkTransformer { if (!"http".equalsIgnoreCase(url.getProtocol()) && !"https".equalsIgnoreCase(url.getProtocol())) {
throw new MalformedURLException("Protocol " + url.getProtocol() + " not supported for IssuerTemplate URL.");
- }
- StreamSource source = new StreamSource(url.openStream());
+ } + + URLDereferencer dereferencer = URLDereferencer.getInstance(); + StreamData data = dereferencer.dereference(url.toExternalForm(), null); + StreamSource source = new StreamSource(data.getStream());
+ log.trace("Trying to creating template from stylesheet");
templates = factory.newTemplates(source);
-
+ log.trace("Successfully created stylesheet template");
initTime = System.currentTimeMillis() - created;
}
@@ -233,7 +244,7 @@ public class IdentityLinkTransformer { pool = new HashMap<String, List<IdLTransformer>>();
}
- private synchronized IdLTransformer getFreeTransfomer(String stylesheetURL) throws TransformerConfigurationException, IOException {
+ private IdLTransformer getFreeTransfomer(String stylesheetURL) throws TransformerConfigurationException, IOException {
IdLTransformer transformer = null;
@@ -260,9 +271,12 @@ public class IdentityLinkTransformer { }
- public void transformIdLink(String stylesheetURL, Source source, Result result) throws IOException, TransformerException {
- IdLTransformer transformer = getFreeTransfomer(stylesheetURL);
- transformer.transform(source, result);
+ public void transformIdLink(String stylesheetURL, Source source, Result result) throws IOException, TransformerException { + log.trace("Trying to get free IdentityLinkTransformer for issuer template '" + stylesheetURL + "'.");
+ IdLTransformer transformer = getFreeTransfomer(stylesheetURL); + log.trace("Trying to transform IdentityLink.");
+ transformer.transform(source, result); + log.trace("IdentityLink transformed successfully. " + getStatistics());
}
public String getStatistics() {
|