Merge branch 'omaha_14.3.1' into omaha_14.4.1
Conflicts (these go to ufcore): cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/AbstractGraphicsTarget.java cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/IGraphicsTarget.java cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ChangePointStyleAction.java Former-commit-id: da50f581c90ea0cca5f43c45c44cb8ac045a6c8c
This commit is contained in:
commit
cc7e6bc52a
2 changed files with 34 additions and 7 deletions
|
@ -45,6 +45,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.SerializationMode;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 11, 2013 2562 bclement Initial creation
|
||||
* Feb 27, 2013 2756 bclement extends BaseExtension
|
||||
* Jun 12, 2013 2903 bclement default to wrap jaxb xml in base64
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -56,6 +57,8 @@ public class SessionPayload extends BaseExtension {
|
|||
private static final IUFStatusHandler log = UFStatus
|
||||
.getHandler(SessionPayload.class);
|
||||
|
||||
public static final String XML_ENCODING = "UTF-8";
|
||||
|
||||
public static enum PayloadType {
|
||||
Config, Command, Invitation;
|
||||
};
|
||||
|
@ -133,7 +136,13 @@ public class SessionPayload extends BaseExtension {
|
|||
CollaborationXmlManager jaxb = CollaborationXmlManager
|
||||
.getInstance();
|
||||
String xml = jaxb.marshalToFragment(data);
|
||||
builder.appendText(xml);
|
||||
/*
|
||||
* wrap JAXB XML in base64 to avoid problems with openfire
|
||||
* disconnecting due to complex XML
|
||||
*/
|
||||
String base64Xml = Base64.encodeBytes(xml
|
||||
.getBytes(XML_ENCODING));
|
||||
builder.appendText(base64Xml);
|
||||
} catch (Exception je) {
|
||||
throw new CollaborationException(
|
||||
"[JAXB] Could not serialize object", je);
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.SerializationMode;
|
|||
* Dec 16, 2013 2562 bclement Initial creation
|
||||
* Feb 12, 2014 2793 bclement improved error handling
|
||||
* Feb 27, 2013 2756 bclement extends BaseProvider
|
||||
* Jun 12, 2013 2903 bclement added support for jaxb xml in base64
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -168,13 +169,30 @@ public class SessionPayloadProvider extends BaseProvider<SessionPayload>
|
|||
*/
|
||||
private static Object unmarshalJaxb(XmlPullParser parser)
|
||||
throws XmlPullParserException, IOException, CollaborationException {
|
||||
int tag = parser.next();
|
||||
if (tag != XmlPullParser.START_TAG) {
|
||||
throw new CollaborationException(
|
||||
"Encountered JAXB payload without XML as data");
|
||||
}
|
||||
CollaborationXmlManager manager = CollaborationXmlManager.getInstance();
|
||||
return manager.unmarshalFromXPP(parser);
|
||||
int tag = parser.next();
|
||||
Object rval;
|
||||
if (tag == XmlPullParser.TEXT) {
|
||||
/*
|
||||
* default behavior is to wrap XML in base64 to avoid problems with
|
||||
* openfire handling complex XML leading to disconnect
|
||||
*/
|
||||
byte[] xmlBytes = Base64.decode(parser.getText());
|
||||
String xml = new String(xmlBytes, SessionPayload.XML_ENCODING);
|
||||
try {
|
||||
rval = manager.unmarshalFromXml(xml);
|
||||
} catch (JAXBException e) {
|
||||
throw new CollaborationException(
|
||||
"Unable to parse base64 encoded XML payload: " + xml, e);
|
||||
}
|
||||
} else if (tag == XmlPullParser.START_TAG) {
|
||||
/* JAXB payload is more XML, attempt to unmarshal it */
|
||||
rval = manager.unmarshalFromXPP(parser);
|
||||
} else {
|
||||
throw new CollaborationException(
|
||||
"Unexpected parser state after JAXB tag: " + tag);
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue