This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git
commit 1bc2bf069e608dea1b23b85f8c4d12e84ba770f5 Author: Colm O hEigeartaigh <[email protected]> AuthorDate: Tue Sep 12 13:10:09 2017 +0100 FEDIZ-209 - Make FedizResponse properly serializable --- .../cxf/fediz/core/processor/FedizResponse.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FedizResponse.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FedizResponse.java index 0c0ae33..e6bf782 100644 --- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FedizResponse.java +++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FedizResponse.java @@ -19,14 +19,24 @@ package org.apache.cxf.fediz.core.processor; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.Serializable; +import java.io.StringReader; import java.util.Collections; import java.util.Date; import java.util.List; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.stream.XMLStreamException; + import org.w3c.dom.Element; +import org.xml.sax.SAXException; import org.apache.cxf.fediz.core.Claim; +import org.apache.cxf.fediz.core.util.DOMUtils; +import org.apache.wss4j.common.util.DOM2Writer; public class FedizResponse implements Serializable { @@ -38,6 +48,7 @@ public class FedizResponse implements Serializable { private String issuer; private List<Claim> claims; private transient Element token; + private String tokenStr; private String uniqueTokenId; /** @@ -116,5 +127,19 @@ public class FedizResponse implements Serializable { return token; } + private void writeObject(ObjectOutputStream stream) throws IOException { + if (token != null && tokenStr == null) { + tokenStr = DOM2Writer.nodeToString(token); + } + stream.defaultWriteObject(); + } + + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException, + XMLStreamException, SAXException, ParserConfigurationException { + in.defaultReadObject(); + if (token == null && tokenStr != null) { + token = DOMUtils.readXml(new StringReader(tokenStr)).getDocumentElement(); + } + } } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
