[jboss-svn-commits] JBossWS SVN: r670 - trunk/src/main/java/org/jboss/ws/jaxrpc/encoding
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Aug 3 04:54:57 EDT 2006
Author: heiko.braun at jboss.com
Date: 2006-08-03 04:54:54 -0400 (Thu, 03 Aug 2006)
New Revision: 670
Removed:
trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java
trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java
Log:
moved to package xop
Deleted: trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java 2006-08-03 08:54:21 UTC (rev 669)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPDeserializer.java 2006-08-03 08:54:54 UTC (rev 670)
@@ -1,76 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.jaxrpc.encoding;
-
-// $Id$
-
-import java.io.IOException;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.SOAPException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.DeserializerSupport;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.common.SOAPMessageContextBase;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/**
- * Deserializer for XOP
- *
- * @author Thomas.Diesler at jboss.org
- * @since 18-Jan-2006
- */
-public class XOPDeserializer extends DeserializerSupport
-{
- // provide logging
- private static final Logger log = Logger.getLogger(XOPDeserializer.class);
-
- public Object deserialize(QName xmlName, QName xmlType, String cid, SerializationContext serContext) throws BindingException
- {
- log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");
-
- try
- {
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
- AttachmentPart part = soapMessage.getAttachmentByContentId(cid);
- if (part == null)
- throw new BindingException("Cannot find attachment part for: " + cid);
-
- DataHandler dataHandler = part.getDataHandler();
- return dataHandler.getContent();
- }
- catch (SOAPException ex)
- {
- throw new BindingException(ex);
- }
- catch (IOException ex)
- {
- throw new BindingException(ex);
- }
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java 2006-08-03 08:54:21 UTC (rev 669)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/encoding/XOPSerializer.java 2006-08-03 08:54:54 UTC (rev 670)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.jaxrpc.encoding;
-
-// $Id$
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.soap.AttachmentPart;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.SerializationContext;
-import org.jboss.ws.binding.SerializerSupport;
-import org.jboss.ws.common.SOAPMessageContextBase;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.SOAPMessageImpl;
-import org.jboss.ws.soap.attachment.MimeConstants;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Serializer for XOP values.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 17-Jan-2006
- */
-public class XOPSerializer extends SerializerSupport
-{
- // provide logging
- private static final Logger log = Logger.getLogger(XOPSerializer.class);
-
- /**
- * Serializes an XOP object into an xop:Include
- */
- public String serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException
- {
- log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");
-
- NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
-
- // Add the xop:Include element
- StringBuilder xopInclude = new StringBuilder("<" + Constants.PREFIX_XOP + ":Include ");
- xopInclude.append("xmlns:" + Constants.PREFIX_XOP + "='" + Constants.NS_XOP + "' ");
-
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
-
- String cid = soapMessage.getCidGenerator().generateFromName(xmlName.getLocalPart());
- xopInclude.append("href='" + cid + "'/>");
-
- Node attr = attributes.getNamedItemNS(Constants.NS_XML_MIME, "contentType");
- if (attr == null)
- throw new WSException("Cannot obtain xmime:contentType");
-
- String contentType = attr.getNodeValue();
-
- AttachmentPart xopPart;
- if (value instanceof DataHandler)
- {
- DataHandler dataHandler = (DataHandler)value;
- xopPart = soapMessage.createAttachmentPart(dataHandler);
- if (contentType.equals(dataHandler.getContentType()) == false)
- log.warn("ContentType missmatch " + contentType + "!=" + dataHandler.getContentType());
- }
- else
- {
- xopPart = soapMessage.createAttachmentPart(value, contentType);
- }
-
- xopPart.addMimeHeader(MimeConstants.CONTENT_ID, cid);
- soapMessage.addAttachmentPart(xopPart);
-
- String xmlFragment = wrapValueStr(xmlName, xopInclude.toString(), nsRegistry, attributes);
- return xmlFragment;
- }
-}
More information about the jboss-svn-commits
mailing list