JBossWS SVN: r8679 - stack/native/branches/jbossws-native-2.0.1.SP2_CP03_JBPAPP-1383/src/main/java/org/jboss/ws/core/server.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-11-07 10:36:54 -0500 (Fri, 07 Nov 2008)
New Revision: 8679
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP03_JBPAPP-1383/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
Log:
[JBPAPP-1383] Correct WSDL dynamic address replacement.
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP03_JBPAPP-1383/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP03_JBPAPP-1383/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2008-11-07 15:06:34 UTC (rev 8678)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP03_JBPAPP-1383/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2008-11-07 15:36:54 UTC (rev 8679)
@@ -187,21 +187,18 @@
String orgLocation = locationAttr.getNodeValue();
URL orgURL = new URL(orgLocation);
- String orgProtocol = orgURL.getProtocol();
String orgHost = orgURL.getHost();
- int orgPort = orgURL.getPort();
String orgPath = orgURL.getPath();
if (ServerConfig.UNDEFINED_HOSTNAME.equals(orgHost))
{
URL newURL = new URL(wsdlHost);
+ String newProtocol = newURL.getProtocol();
String newHost = newURL.getHost();
int newPort = newURL.getPort();
- String newLocation = orgProtocol + "://" + newHost;
- if (orgPort != -1)
- newLocation += ":" + orgPort;
- else if (newPort != -1)
+ String newLocation = newProtocol + "://" + newHost;
+ if (newPort != -1)
newLocation += ":" + newPort;
newLocation += orgPath;
16 years, 2 months
JBossWS SVN: r8678 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-11-07 10:06:34 -0500 (Fri, 07 Nov 2008)
New Revision: 8678
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP03_JBPAPP-1383/
Log:
[JBPAPP-1383] Branch for patch.
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP03_JBPAPP-1383 (from rev 8677, stack/native/tags/jbossws-native-2.0.1.SP2_CP03)
16 years, 2 months
JBossWS SVN: r8677 - stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/server.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-11-07 09:47:14 -0500 (Fri, 07 Nov 2008)
New Revision: 8677
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
Log:
[JBPAPP-1352] Correct WSDL dynamic address replacement.
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2008-11-07 14:09:39 UTC (rev 8676)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2008-11-07 14:47:14 UTC (rev 8677)
@@ -187,21 +187,18 @@
String orgLocation = locationAttr.getNodeValue();
URL orgURL = new URL(orgLocation);
- String orgProtocol = orgURL.getProtocol();
String orgHost = orgURL.getHost();
- int orgPort = orgURL.getPort();
String orgPath = orgURL.getPath();
if (ServerConfig.UNDEFINED_HOSTNAME.equals(orgHost))
{
URL newURL = new URL(wsdlHost);
+ String newProtocol = newURL.getProtocol();
String newHost = newURL.getHost();
int newPort = newURL.getPort();
- String newLocation = orgProtocol + "://" + newHost;
- if (orgPort != -1)
- newLocation += ":" + orgPort;
- else if (newPort != -1)
+ String newLocation = newProtocol + "://" + newHost;
+ if (newPort != -1)
newLocation += ":" + newPort;
newLocation += orgPath;
16 years, 2 months
JBossWS SVN: r8676 - in stack/native/trunk/modules/core/src/main/java/org/jboss/ws: core/binding and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-11-07 09:09:39 -0500 (Fri, 07 Nov 2008)
New Revision: 8676
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/util/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/util/xml/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/util/xml/BufferedStreamResult.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/util/xml/BufferedStreamSource.java
Removed:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java
Log:
[JBWS-2318] refactoring utility classes
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/binding/BufferedStreamResult.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core.binding;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.ws.WSException;
-import org.jboss.wsf.common.IOUtils;
-
-/**
- * @author Heiko.Braun(a)jboss.org
- * @author Thomas.Diesler(a)jboss.org
- * @since 06.02.2007
- */
-public class BufferedStreamResult extends StreamResult
-{
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
-
- public BufferedStreamResult()
- {
- }
-
- public BufferedStreamResult(String xmlFragment)
- {
- try
- {
- IOUtils.copyStream(getOutputStream(), new ByteArrayInputStream(xmlFragment.getBytes("UTF-8")));
- }
- catch (IOException e)
- {
- WSException.rethrow(e);
- }
- }
-
- @Override
- public Writer getWriter()
- {
- return null;
- }
-
- @Override
- public OutputStream getOutputStream()
- {
- return baos;
- }
-
- @Override
- public void setWriter(Writer writer)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setOutputStream(OutputStream outputStream)
- {
- throw new UnsupportedOperationException();
- }
-
- public String toString()
- {
- String result = null;
- try
- {
- result = baos.toString("UTF-8");
- }
- catch (UnsupportedEncodingException e)
- {
- WSException.rethrow(e);
- }
-
- return result;
- }
-}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -26,11 +26,11 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.extensions.xop.XOPContext;
import org.jboss.ws.extensions.xop.jaxrpc.XOPMarshallerImpl;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.wsf.common.JavaUtils;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -1,128 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core.jaxrpc.binding;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.CharArrayReader;
-import java.io.CharArrayWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-
-import javax.xml.transform.stream.StreamSource;
-
-import org.jboss.ws.WSException;
-import org.jboss.wsf.common.IOUtils;
-
-/**
- * A StreamSource that can be read repeatedly.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-Mar-2007
- */
-public class BufferedStreamSource extends StreamSource
-{
- private byte[] bytes;
- private char[] chars;
-
- public BufferedStreamSource(StreamSource source)
- {
- try
- {
- InputStream ins = source.getInputStream();
- if (ins != null)
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- IOUtils.copyStream(baos, ins);
- bytes = baos.toByteArray();
- }
-
- Reader rd = source.getReader();
- if (ins == null && rd != null)
- {
- char[] auxbuf = new char[1024];
- CharArrayWriter wr = new CharArrayWriter(auxbuf.length);
- int r = rd.read(auxbuf);
- while (r > 0)
- {
- wr.write(auxbuf, 0, r);
- r = rd.read(auxbuf);
- }
- chars = wr.toCharArray();
- }
- }
- catch (IOException ex)
- {
- WSException.rethrow(ex);
- }
- }
-
- public BufferedStreamSource(byte[] bytes)
- {
- this.bytes = bytes;
- }
-
- @Override
- public InputStream getInputStream()
- {
- return (bytes != null ? new ByteArrayInputStream(bytes) : null);
- }
-
- @Override
- public Reader getReader()
- {
- return (chars != null ? new CharArrayReader(chars) : null);
- }
-
- @Override
- public void setInputStream(InputStream inputStream)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setReader(Reader reader)
- {
- throw new UnsupportedOperationException();
- }
-
- public String toString()
- {
- String retStr = null;
- if (bytes != null)
- {
- try
- {
- retStr = new String(bytes, "UTF-8");
- }
- catch (UnsupportedEncodingException e)
- {
- WSException.rethrow(e);
- }
- }
- else if (chars != null)
- retStr = new String(chars);
- return "" + retStr;
- }
-}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -29,9 +29,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/DateSerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -30,9 +30,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -26,9 +26,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.wsf.common.DOMWriter;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/HexSerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -26,9 +26,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.wsf.common.JavaUtils;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -30,7 +30,6 @@
import org.apache.xerces.xs.XSModel;
import org.jboss.logging.Logger;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.ComplexTypeSerializer;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC;
@@ -39,6 +38,7 @@
import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.w3c.dom.NamedNodeMap;
/**
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -27,9 +27,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.xb.binding.NamespaceRegistry;
import org.w3c.dom.NamedNodeMap;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -29,9 +29,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -28,7 +28,6 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.AbstractSerializerFactory;
import org.jboss.ws.core.binding.SerializerSupport;
@@ -37,6 +36,7 @@
import org.jboss.ws.core.soap.SOAPContentElement;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.wsf.common.JavaUtils;
import org.w3c.dom.NamedNodeMap;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -27,9 +27,9 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.wsf.common.DOMWriter;
import org.w3c.dom.NamedNodeMap;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -27,9 +27,9 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.SerializerSupport;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.xb.binding.NamespaceRegistry;
import org.jboss.xb.binding.SimpleTypeBindings;
import org.w3c.dom.NamedNodeMap;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -34,10 +34,10 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
import org.jboss.ws.core.binding.ComplexTypeSerializer;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.extensions.xop.jaxws.AttachmentMarshallerImpl;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import org.jboss.wsf.spi.binding.BindingCustomization;
import org.w3c.dom.NamedNodeMap;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -24,7 +24,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.HTTPMessageImpl;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.ws.util.xml.BufferedStreamResult;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java 2008-11-07 13:02:35 UTC (rev 8675)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLFragment.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -39,8 +39,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.binding.BufferedStreamResult;
-import org.jboss.ws.core.jaxrpc.binding.BufferedStreamSource;
+import org.jboss.ws.util.xml.BufferedStreamResult;
+import org.jboss.ws.util.xml.BufferedStreamSource;
import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
import org.w3c.dom.Element;
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/util/xml/BufferedStreamResult.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/util/xml/BufferedStreamResult.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/util/xml/BufferedStreamResult.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.util.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import javax.xml.transform.stream.StreamResult;
+
+import org.jboss.ws.WSException;
+import org.jboss.wsf.common.IOUtils;
+
+/**
+ * Buffered StreamResult Utility class
+ * @author Richard.Opalka(a)jboss.org
+ * @author Heiko.Braun(a)jboss.org
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 06.02.2007
+ */
+public final class BufferedStreamResult extends StreamResult
+{
+
+ private final ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+
+ public BufferedStreamResult()
+ {
+ }
+
+ public BufferedStreamResult(String xmlFragment)
+ {
+ try
+ {
+ IOUtils.copyStream(getOutputStream(), new ByteArrayInputStream(xmlFragment.getBytes("UTF-8")));
+ }
+ catch (IOException e)
+ {
+ WSException.rethrow(e);
+ }
+ }
+
+ @Override
+ public final OutputStream getOutputStream()
+ {
+ return baos;
+ }
+
+ @Override
+ public final String toString()
+ {
+ try
+ {
+ return baos.toString("UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ WSException.rethrow(e);
+ }
+
+ return null;
+ }
+
+ @Override
+ public final Writer getWriter()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final void setWriter(Writer writer)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final void setOutputStream(OutputStream outputStream)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+}
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/util/xml/BufferedStreamSource.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/util/xml/BufferedStreamSource.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/util/xml/BufferedStreamSource.java 2008-11-07 14:09:39 UTC (rev 8676)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.util.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayReader;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.ws.WSException;
+import org.jboss.wsf.common.IOUtils;
+
+/**
+ * A StreamSource that can be read repeatedly.
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Richard.Opalka(a)jboss.org
+ * @since 29-Mar-2007
+ */
+public final class BufferedStreamSource extends StreamSource
+{
+ private byte[] bytes;
+ private char[] chars;
+
+ public BufferedStreamSource(StreamSource source)
+ {
+ try
+ {
+ final InputStream sourceInputStream = source.getInputStream();
+ if (sourceInputStream != null)
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ IOUtils.copyStream(baos, sourceInputStream);
+ bytes = baos.toByteArray();
+ }
+
+ final Reader sourceReader = source.getReader();
+ if ((sourceInputStream == null) && (sourceReader != null))
+ {
+ final char[] buffer = new char[1024];
+ final CharArrayWriter charArrayWriter = new CharArrayWriter(buffer.length);
+ int countOfReadChars = sourceReader.read(buffer);
+ while (countOfReadChars > 0)
+ {
+ charArrayWriter.write(buffer, 0, countOfReadChars);
+ countOfReadChars = sourceReader.read(buffer);
+ }
+ chars = charArrayWriter.toCharArray();
+ }
+ }
+ catch (IOException ex)
+ {
+ WSException.rethrow(ex);
+ }
+ }
+
+ public BufferedStreamSource(byte[] bytes)
+ {
+ this.bytes = bytes;
+ }
+
+ @Override
+ public final InputStream getInputStream()
+ {
+ return (bytes != null ? new ByteArrayInputStream(bytes) : null);
+ }
+
+ @Override
+ public final Reader getReader()
+ {
+ return (chars != null ? new CharArrayReader(chars) : null);
+ }
+
+ @Override
+ public final String toString()
+ {
+ String retVal = null;
+ if (bytes != null)
+ {
+ try
+ {
+ retVal = new String(bytes, "UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ WSException.rethrow(e);
+ }
+ }
+ else if (chars != null)
+ {
+ retVal = new String(chars);
+ }
+
+ return "" + retVal;
+ }
+
+ @Override
+ public final void setInputStream(InputStream inputStream)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final void setReader(Reader reader)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+}
16 years, 2 months
JBossWS SVN: r8675 - in stack/native/trunk/modules/core/src/main/java/org/jboss/ws: core and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-11-07 08:02:35 -0500 (Fri, 07 Nov 2008)
New Revision: 8675
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/WSException.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java
Log:
[JBWS-2318] rollback
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/WSException.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/WSException.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/WSException.java 2008-11-07 13:02:35 UTC (rev 8675)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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;
+
+/**
+ * A RuntimeException that should be thrown when a cause is needed
+ *
+ * The retrotranslator-0.9.5 cannot handle
+ *
+ * new IllegalStateException(String, Throwable)
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 06-Jan-2006
+ */
+public class WSException extends RuntimeException
+{
+ public WSException()
+ {
+ }
+
+ public WSException(String message)
+ {
+ super(message);
+ }
+
+ public WSException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public WSException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public static void rethrow(String string, Throwable th)
+ {
+ if (th instanceof WSException)
+ throw (WSException)th;
+
+ throw new WSException(string, th);
+ }
+
+ public static void rethrow(Throwable th)
+ {
+ if (th instanceof WSException)
+ throw (WSException)th;
+
+ throw new WSException(th);
+ }
+}
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java 2008-11-07 13:02:35 UTC (rev 8675)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.core;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The SOAPFaultException exception represents a SOAP fault.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class CommonSOAPFaultException extends RuntimeException
+{
+ private QName faultCode;
+ private String faultString;
+
+ public CommonSOAPFaultException(QName faultCode, String faultString)
+ {
+ super(faultString);
+
+ this.faultCode = faultCode;
+ this.faultString = faultString;
+ }
+
+ public QName getFaultCode()
+ {
+ return faultCode;
+ }
+
+ public String getFaultString()
+ {
+ return faultString;
+ }
+}
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java 2008-11-07 13:02:35 UTC (rev 8675)
@@ -0,0 +1,351 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.core.utils;
+
+import java.awt.image.BufferedImage;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.mail.internet.ContentType;
+import javax.mail.internet.MimeMultipart;
+import javax.mail.internet.ParseException;
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.wsf.common.IOUtils;
+import org.jboss.wsf.common.JavaUtils;
+
+import com.sun.image.codec.jpeg.JPEGCodec;
+import com.sun.image.codec.jpeg.JPEGImageDecoder;
+import com.sun.image.codec.jpeg.JPEGImageEncoder;
+
+/**
+ * Generic mime utility class.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
+ */
+public class MimeUtils
+{
+
+ private static Map<String, Class> mime2class = new HashMap<String, Class>();
+ private static Map<Class, String> class2mime = new HashMap<Class, String>();
+
+ static {
+ mime2class.put("text/plain", java.lang.String.class);
+ mime2class.put("image/jpeg", java.awt.Image.class);
+ mime2class.put("text/xml", javax.xml.transform.Source.class);
+ mime2class.put("application/xml", javax.xml.transform.Source.class);
+ mime2class.put("application/octet-stream", javax.activation.DataHandler.class);
+
+ class2mime.put(java.awt.Image.class, "image/jpeg");
+ class2mime.put(javax.xml.transform.Source.class, "text/xml");
+ class2mime.put(java.lang.String.class, "text/plain");
+ }
+
+ /**
+ * Converts a MIME type into a proprietary JBossWS attachment xml type.
+ *
+ * @param mimeType the MIME type string to convert
+ * @return the xml type that this mime type corresponds to
+ */
+ public static QName convertMimeTypeToXmlType(String mimeType)
+ {
+ StringBuilder mimeName = new StringBuilder(mimeType);
+
+ int pos = mimeName.indexOf("/");
+
+ if (pos == -1)
+ return null;
+
+ mimeName.setCharAt(pos, '_');
+
+ return new QName(Constants.NS_ATTACHMENT_MIME_TYPE, mimeName.toString());
+ }
+
+ /**
+ * Gets the base portion of a MIME type string. This basically just strips
+ * off any type parameter elements.
+ *
+ * @param mimeType any MIME type string
+ * @return a reduced MIME string containing no type parameters
+ */
+ public static String getBaseMimeType(String mimeType)
+ {
+ ContentType contentType;
+
+ if (mimeType == null)
+ return null;
+ try
+ {
+ contentType = new ContentType(mimeType);
+ }
+ catch (ParseException e)
+ {
+ return null;
+ }
+
+ return contentType.getBaseType();
+ }
+
+ /**
+ * Checks if there is a matching mime pattern for mimeType in mimeTypes. This
+ * will return true if there is an exact match (for example text/plain =
+ * text/plain), or if there is a wildcard subtype match (text/plain =
+ * text/*).
+ *
+ * @param mimeType the mime type to search for
+ * @param mimeTypes the set of mime types to search
+ * @return true if there is a match, false if not
+ */
+ public static boolean isMemberOf(String mimeType, Set mimeTypes)
+ {
+ if (mimeTypes.contains(mimeType))
+ return true;
+
+ try
+ {
+ if (mimeTypes.contains(new ContentType(mimeType).getPrimaryType() + "/*"))
+ return true;
+ }
+ catch (ParseException e)
+ {
+ // eat
+ }
+
+ return false;
+ }
+
+ /**
+ * Resolve the class for a mype type.
+ * Defaults to <code>DataHandler</code> if no mapping could be found.
+ */
+ public static Class resolveClass(String mimeType) {
+ Class cl = mime2class.get(mimeType);
+ if(null==cl)
+ cl = javax.activation.DataHandler.class;
+ return cl;
+ }
+
+ /**
+ * Resolve the mime type for an object.
+ * Default to <code>application/octet-stream</code>
+ * if no mapping could be found.
+ */
+ public static String resolveMimeType(Object obj) {
+ String mimeType = (obj instanceof MimeMultipart) ?
+ ((MimeMultipart)obj).getContentType() :
+ resolveMimeType(obj.getClass());
+ return mimeType;
+ }
+
+ public static String resolveMimeType(Class clazz) {
+ String mimeType = "application/octet-stream";
+ for(Class cl : class2mime.keySet())
+ {
+ if(JavaUtils.isAssignableFrom(cl, clazz))
+ mimeType = class2mime.get(cl);
+ }
+ return mimeType;
+ }
+
+ public static ByteArrayConverter getConverterForJavaType(Class targetClazz)
+ {
+ ByteArrayConverter converter = null;
+ if(JavaUtils.isAssignableFrom(java.awt.Image.class, targetClazz))
+ converter = new ImageConverter();
+ else if (JavaUtils.isAssignableFrom(javax.xml.transform.Source.class, targetClazz))
+ converter = new SourceConverter();
+ else if (JavaUtils.isAssignableFrom(java.lang.String.class, targetClazz))
+ converter = new StringConverter();
+ else if (JavaUtils.isAssignableFrom(java.io.InputStream.class, targetClazz))
+ converter = new StreamConverter();
+
+ if(null == converter)
+ throw new WSException("No ByteArrayConverter for class: " + targetClazz.getName());
+
+ return converter;
+ }
+
+ public static ByteArrayConverter getConverterForContentType(String contentType)
+ {
+ ByteArrayConverter converter = null;
+
+ if(contentType != null)
+ {
+ if("image/jpeg".equals(contentType) || "image/jpg".equals(contentType))
+ converter = new ImageConverter();
+ else if("text/xml".equals(contentType) || "application/xml".equals(contentType))
+ converter = new SourceConverter();
+ else if("text/plain".equals(contentType))
+ converter = new StringConverter();
+ else if("application/octet-stream".equals(contentType))
+ converter = new StreamConverter();
+ }
+
+ if(null == converter)
+ throw new WSException("No ByteArrayConverter for content type: " + contentType);
+
+ return converter;
+ }
+ public static class ImageConverter implements ByteArrayConverter
+ {
+ public Object readFrom(InputStream in) {
+ Object converted = null;
+ try
+ {
+ JPEGImageDecoder dec = JPEGCodec.createJPEGDecoder(in);
+ BufferedImage bim = dec.decodeAsBufferedImage();
+ converted = bim;
+ }
+ catch (Exception e)
+ {
+ // ignore
+ }
+
+ return converted;
+ }
+
+ public void writeTo(Object obj, OutputStream out) {
+ if(obj instanceof BufferedImage)
+ {
+ JPEGImageEncoder enc = JPEGCodec.createJPEGEncoder(out);
+ try
+ {
+ enc.encode((BufferedImage)obj);
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to convert " + obj.getClass());
+ }
+ }
+ else
+ {
+ throw new WSException("Unable to convert " + obj.getClass());
+ }
+
+ }
+
+ }
+
+ public static class SourceConverter implements ByteArrayConverter
+ {
+ public Object readFrom(InputStream in) {
+ return new StreamSource(in);
+ }
+
+ public void writeTo(Object obj, OutputStream out) {
+ if(obj instanceof StreamSource)
+ {
+ StreamSource s = (StreamSource)obj;
+ try
+ {
+ IOUtils.copyStream(out, s.getInputStream());
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to convert " + obj.getClass());
+ }
+ }
+ else
+ {
+ throw new WSException("Unable to convert " + obj.getClass());
+ }
+ }
+ }
+
+ public static class StringConverter implements ByteArrayConverter
+ {
+ public Object readFrom(InputStream in) {
+ Object converted = null;
+ try
+ {
+ StringBuilder out = new StringBuilder();
+ byte[] b = new byte[4096];
+ for (int n; (n = in.read(b)) != -1;) {
+ out.append(new String(b, 0, n));
+ }
+ converted = out.toString();
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to convert java.lang.String");
+ }
+
+ return converted;
+ }
+
+ public void writeTo(Object obj, OutputStream out) {
+ if(obj instanceof String)
+ {
+ String s = (String)obj;
+ try
+ {
+ out.write(s.getBytes("UTF-8"));
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to convert " + obj.getClass());
+ }
+ }
+ else
+ {
+ throw new WSException("Unable to convert " + obj.getClass());
+ }
+ }
+ }
+
+ public static class StreamConverter implements ByteArrayConverter
+ {
+ public Object readFrom(InputStream in) {
+ return in;
+ }
+
+ public void writeTo(Object obj, OutputStream out) {
+ if(obj instanceof InputStream)
+ {
+ try
+ {
+ IOUtils.copyStream(out, (InputStream)obj);
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Failed to convert " + obj.getClass());
+ }
+ }
+ }
+ }
+ public interface ByteArrayConverter
+ {
+ Object readFrom(InputStream in);
+ void writeTo(Object obj, OutputStream out);
+ }
+
+
+}
16 years, 2 months
JBossWS SVN: r8674 - common/trunk/src/main/java/org/jboss/ws/core/utils.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-11-07 08:01:01 -0500 (Fri, 07 Nov 2008)
New Revision: 8674
Removed:
common/trunk/src/main/java/org/jboss/ws/core/utils/MimeUtils.java
Log:
[JBWS-2318] rollback
Deleted: common/trunk/src/main/java/org/jboss/ws/core/utils/MimeUtils.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/core/utils/MimeUtils.java 2008-11-07 12:58:59 UTC (rev 8673)
+++ common/trunk/src/main/java/org/jboss/ws/core/utils/MimeUtils.java 2008-11-07 13:01:01 UTC (rev 8674)
@@ -1,351 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core.utils;
-
-import java.awt.image.BufferedImage;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.mail.internet.ContentType;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.ParseException;
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.wsf.common.IOUtils;
-import org.jboss.wsf.common.JavaUtils;
-
-import com.sun.image.codec.jpeg.JPEGCodec;
-import com.sun.image.codec.jpeg.JPEGImageDecoder;
-import com.sun.image.codec.jpeg.JPEGImageEncoder;
-
-/**
- * Generic mime utility class.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
- */
-public class MimeUtils
-{
-
- private static Map<String, Class> mime2class = new HashMap<String, Class>();
- private static Map<Class, String> class2mime = new HashMap<Class, String>();
-
- static {
- mime2class.put("text/plain", java.lang.String.class);
- mime2class.put("image/jpeg", java.awt.Image.class);
- mime2class.put("text/xml", javax.xml.transform.Source.class);
- mime2class.put("application/xml", javax.xml.transform.Source.class);
- mime2class.put("application/octet-stream", javax.activation.DataHandler.class);
-
- class2mime.put(java.awt.Image.class, "image/jpeg");
- class2mime.put(javax.xml.transform.Source.class, "text/xml");
- class2mime.put(java.lang.String.class, "text/plain");
- }
-
- /**
- * Converts a MIME type into a proprietary JBossWS attachment xml type.
- *
- * @param mimeType the MIME type string to convert
- * @return the xml type that this mime type corresponds to
- */
- public static QName convertMimeTypeToXmlType(String mimeType)
- {
- StringBuilder mimeName = new StringBuilder(mimeType);
-
- int pos = mimeName.indexOf("/");
-
- if (pos == -1)
- return null;
-
- mimeName.setCharAt(pos, '_');
-
- return new QName(Constants.NS_ATTACHMENT_MIME_TYPE, mimeName.toString());
- }
-
- /**
- * Gets the base portion of a MIME type string. This basically just strips
- * off any type parameter elements.
- *
- * @param mimeType any MIME type string
- * @return a reduced MIME string containing no type parameters
- */
- public static String getBaseMimeType(String mimeType)
- {
- ContentType contentType;
-
- if (mimeType == null)
- return null;
- try
- {
- contentType = new ContentType(mimeType);
- }
- catch (ParseException e)
- {
- return null;
- }
-
- return contentType.getBaseType();
- }
-
- /**
- * Checks if there is a matching mime pattern for mimeType in mimeTypes. This
- * will return true if there is an exact match (for example text/plain =
- * text/plain), or if there is a wildcard subtype match (text/plain =
- * text/*).
- *
- * @param mimeType the mime type to search for
- * @param mimeTypes the set of mime types to search
- * @return true if there is a match, false if not
- */
- public static boolean isMemberOf(String mimeType, Set mimeTypes)
- {
- if (mimeTypes.contains(mimeType))
- return true;
-
- try
- {
- if (mimeTypes.contains(new ContentType(mimeType).getPrimaryType() + "/*"))
- return true;
- }
- catch (ParseException e)
- {
- // eat
- }
-
- return false;
- }
-
- /**
- * Resolve the class for a mype type.
- * Defaults to <code>DataHandler</code> if no mapping could be found.
- */
- public static Class resolveClass(String mimeType) {
- Class cl = mime2class.get(mimeType);
- if(null==cl)
- cl = javax.activation.DataHandler.class;
- return cl;
- }
-
- /**
- * Resolve the mime type for an object.
- * Default to <code>application/octet-stream</code>
- * if no mapping could be found.
- */
- public static String resolveMimeType(Object obj) {
- String mimeType = (obj instanceof MimeMultipart) ?
- ((MimeMultipart)obj).getContentType() :
- resolveMimeType(obj.getClass());
- return mimeType;
- }
-
- public static String resolveMimeType(Class clazz) {
- String mimeType = "application/octet-stream";
- for(Class cl : class2mime.keySet())
- {
- if(JavaUtils.isAssignableFrom(cl, clazz))
- mimeType = class2mime.get(cl);
- }
- return mimeType;
- }
-
- public static ByteArrayConverter getConverterForJavaType(Class targetClazz)
- {
- ByteArrayConverter converter = null;
- if(JavaUtils.isAssignableFrom(java.awt.Image.class, targetClazz))
- converter = new ImageConverter();
- else if (JavaUtils.isAssignableFrom(javax.xml.transform.Source.class, targetClazz))
- converter = new SourceConverter();
- else if (JavaUtils.isAssignableFrom(java.lang.String.class, targetClazz))
- converter = new StringConverter();
- else if (JavaUtils.isAssignableFrom(java.io.InputStream.class, targetClazz))
- converter = new StreamConverter();
-
- if(null == converter)
- throw new WSException("No ByteArrayConverter for class: " + targetClazz.getName());
-
- return converter;
- }
-
- public static ByteArrayConverter getConverterForContentType(String contentType)
- {
- ByteArrayConverter converter = null;
-
- if(contentType != null)
- {
- if("image/jpeg".equals(contentType) || "image/jpg".equals(contentType))
- converter = new ImageConverter();
- else if("text/xml".equals(contentType) || "application/xml".equals(contentType))
- converter = new SourceConverter();
- else if("text/plain".equals(contentType))
- converter = new StringConverter();
- else if("application/octet-stream".equals(contentType))
- converter = new StreamConverter();
- }
-
- if(null == converter)
- throw new WSException("No ByteArrayConverter for content type: " + contentType);
-
- return converter;
- }
- public static class ImageConverter implements ByteArrayConverter
- {
- public Object readFrom(InputStream in) {
- Object converted = null;
- try
- {
- JPEGImageDecoder dec = JPEGCodec.createJPEGDecoder(in);
- BufferedImage bim = dec.decodeAsBufferedImage();
- converted = bim;
- }
- catch (Exception e)
- {
- // ignore
- }
-
- return converted;
- }
-
- public void writeTo(Object obj, OutputStream out) {
- if(obj instanceof BufferedImage)
- {
- JPEGImageEncoder enc = JPEGCodec.createJPEGEncoder(out);
- try
- {
- enc.encode((BufferedImage)obj);
- }
- catch (IOException e)
- {
- throw new WSException("Failed to convert " + obj.getClass());
- }
- }
- else
- {
- throw new WSException("Unable to convert " + obj.getClass());
- }
-
- }
-
- }
-
- public static class SourceConverter implements ByteArrayConverter
- {
- public Object readFrom(InputStream in) {
- return new StreamSource(in);
- }
-
- public void writeTo(Object obj, OutputStream out) {
- if(obj instanceof StreamSource)
- {
- StreamSource s = (StreamSource)obj;
- try
- {
- IOUtils.copyStream(out, s.getInputStream());
- }
- catch (IOException e)
- {
- throw new WSException("Failed to convert " + obj.getClass());
- }
- }
- else
- {
- throw new WSException("Unable to convert " + obj.getClass());
- }
- }
- }
-
- public static class StringConverter implements ByteArrayConverter
- {
- public Object readFrom(InputStream in) {
- Object converted = null;
- try
- {
- StringBuilder out = new StringBuilder();
- byte[] b = new byte[4096];
- for (int n; (n = in.read(b)) != -1;) {
- out.append(new String(b, 0, n));
- }
- converted = out.toString();
- }
- catch (IOException e)
- {
- throw new WSException("Failed to convert java.lang.String");
- }
-
- return converted;
- }
-
- public void writeTo(Object obj, OutputStream out) {
- if(obj instanceof String)
- {
- String s = (String)obj;
- try
- {
- out.write(s.getBytes("UTF-8"));
- }
- catch (IOException e)
- {
- throw new WSException("Failed to convert " + obj.getClass());
- }
- }
- else
- {
- throw new WSException("Unable to convert " + obj.getClass());
- }
- }
- }
-
- public static class StreamConverter implements ByteArrayConverter
- {
- public Object readFrom(InputStream in) {
- return in;
- }
-
- public void writeTo(Object obj, OutputStream out) {
- if(obj instanceof InputStream)
- {
- try
- {
- IOUtils.copyStream(out, (InputStream)obj);
- }
- catch (IOException e)
- {
- throw new WSException("Failed to convert " + obj.getClass());
- }
- }
- }
- }
- public interface ByteArrayConverter
- {
- Object readFrom(InputStream in);
- void writeTo(Object obj, OutputStream out);
- }
-
-
-}
16 years, 2 months
JBossWS SVN: r8673 - in common/trunk/src/main/java/org/jboss/ws: core and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-11-07 07:58:59 -0500 (Fri, 07 Nov 2008)
New Revision: 8673
Removed:
common/trunk/src/main/java/org/jboss/ws/WSException.java
common/trunk/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java
Log:
[JBWS-2318] rollback
Deleted: common/trunk/src/main/java/org/jboss/ws/WSException.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/WSException.java 2008-11-07 12:12:09 UTC (rev 8672)
+++ common/trunk/src/main/java/org/jboss/ws/WSException.java 2008-11-07 12:58:59 UTC (rev 8673)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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;
-
-/**
- * A RuntimeException that should be thrown when a cause is needed
- *
- * The retrotranslator-0.9.5 cannot handle
- *
- * new IllegalStateException(String, Throwable)
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 06-Jan-2006
- */
-public class WSException extends RuntimeException
-{
- public WSException()
- {
- }
-
- public WSException(String message)
- {
- super(message);
- }
-
- public WSException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public WSException(Throwable cause)
- {
- super(cause);
- }
-
- public static void rethrow(String string, Throwable th)
- {
- if (th instanceof WSException)
- throw (WSException)th;
-
- throw new WSException(string, th);
- }
-
- public static void rethrow(Throwable th)
- {
- if (th instanceof WSException)
- throw (WSException)th;
-
- throw new WSException(th);
- }
-}
Deleted: common/trunk/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java 2008-11-07 12:12:09 UTC (rev 8672)
+++ common/trunk/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java 2008-11-07 12:58:59 UTC (rev 8673)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core;
-
-import javax.xml.namespace.QName;
-
-/**
- * The SOAPFaultException exception represents a SOAP fault.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class CommonSOAPFaultException extends RuntimeException
-{
- private QName faultCode;
- private String faultString;
-
- public CommonSOAPFaultException(QName faultCode, String faultString)
- {
- super(faultString);
-
- this.faultCode = faultCode;
- this.faultString = faultString;
- }
-
- public QName getFaultCode()
- {
- return faultCode;
- }
-
- public String getFaultString()
- {
- return faultString;
- }
-}
16 years, 2 months
JBossWS SVN: r8672 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-11-07 07:12:09 -0500 (Fri, 07 Nov 2008)
New Revision: 8672
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
Log:
[JBWS-2373] Dynamic address re-writing if the request URL does not have a port do not add a port to the generated address.
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2008-11-07 12:06:04 UTC (rev 8671)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2008-11-07 12:12:09 UTC (rev 8672)
@@ -185,7 +185,6 @@
URL orgURL = new URL(orgLocation);
String orgHost = orgURL.getHost();
- int orgPort = orgURL.getPort();
String orgPath = orgURL.getPath();
if (ServerConfig.UNDEFINED_HOSTNAME.equals(orgHost))
@@ -198,8 +197,6 @@
String newLocation = newProtocol + "://" + newHost;
if (newPort != -1)
newLocation += ":" + newPort;
- else if (orgPort != -1)
- newLocation += ":" + orgPort;
newLocation += orgPath;
locationAttr.setNodeValue(newLocation);
16 years, 2 months
JBossWS SVN: r8671 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-11-07 07:06:04 -0500 (Fri, 07 Nov 2008)
New Revision: 8671
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
Log:
[JBWS-2372] Protocol not considered when re-writing address in WSDL based on request address.
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2008-11-07 11:24:25 UTC (rev 8670)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2008-11-07 12:06:04 UTC (rev 8671)
@@ -184,7 +184,6 @@
String orgLocation = locationAttr.getNodeValue();
URL orgURL = new URL(orgLocation);
- String orgProtocol = orgURL.getProtocol();
String orgHost = orgURL.getHost();
int orgPort = orgURL.getPort();
String orgPath = orgURL.getPath();
@@ -192,10 +191,11 @@
if (ServerConfig.UNDEFINED_HOSTNAME.equals(orgHost))
{
URL newURL = new URL(wsdlHost);
+ String newProtocol = newURL.getProtocol();
String newHost = newURL.getHost();
int newPort = newURL.getPort();
- String newLocation = orgProtocol + "://" + newHost;
+ String newLocation = newProtocol + "://" + newHost;
if (newPort != -1)
newLocation += ":" + newPort;
else if (orgPort != -1)
16 years, 2 months
JBossWS SVN: r8670 - in stack/native/trunk/modules/core/src/main/java/org/jboss/ws: core and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-11-07 06:24:25 -0500 (Fri, 07 Nov 2008)
New Revision: 8670
Removed:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/Constants.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/WSException.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/HashCodeUtil.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/JBossWSEntityResolver.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/JarUrlConnection.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/ResourceURL.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/XMLPredefinedEntityReferenceResolver.java
Log:
[JBWS-2318] refactoring to common
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/Constants.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/Constants.java 2008-11-07 11:21:50 UTC (rev 8669)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/Constants.java 2008-11-07 11:24:25 UTC (rev 8670)
@@ -1,330 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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;
-
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPConstants;
-import javax.xml.ws.http.HTTPBinding;
-import javax.xml.ws.soap.SOAPBinding;
-
-import org.jboss.ws.core.soap.NameImpl;
-
-
-/**
- * A collection of constants relevant to JBossWS
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public interface Constants
-{
- /** Header for XML Documents */
- static final String XML_HEADER = "<?xml version='1.0' encoding='UTF-8'?>";
-
- /** Default charset for XML Documents */
- static final String DEFAULT_XML_CHARSET = "UTF-8";
-
- /** JBossWS namespace URI */
- static final String NS_JBOSSWS_URI = "http://www.jboss.org/jbossws";
- /** XML Namespace */
- static final String NS_XML = "http://www.w3.org/XML/1998/namespace";
- /** XML namespace declaration namespace */
- static final String NS_XMLNS = "http://www.w3.org/2000/xmlns/";
- /** XMLSchema namespace http://www.w3.org/2001/XMLSchema */
- static final String NS_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
- /** XMLSchema instance namespace http://www.w3.org/2001/XMLSchema-instance */
- static final String NS_SCHEMA_XSI = "http://www.w3.org/2001/XMLSchema-instance";
- /** SOAP-1.1 namespace http://schemas.xmlsoap.org/wsdl/soap/ */
- static final String NS_SOAP11 = "http://schemas.xmlsoap.org/wsdl/soap/";
- /** SOAP-1.1 envelope namespace http://schemas.xmlsoap.org/soap/envelope/ */
- static final String NS_SOAP11_ENV = SOAPConstants.URI_NS_SOAP_ENVELOPE;
- /** SOAP-1.2 namespace http://schemas.xmlsoap.org/wsdl/soap12/ */
- static final String NS_SOAP12 = "http://schemas.xmlsoap.org/wsdl/soap12/";
- /** HTTP binding namespace http://schemas.xmlsoap.org/wsdl/http/ */
- static final String NS_HTTP = "http://schemas.xmlsoap.org/wsdl/http/";
- /** SOAP-1.2 envelope namespace http://www.w3.org/2003/05/soap-envelope */
- static final String NS_SOAP12_ENV = SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE;
- /** The namespace for the SwA mime type */
- static final String NS_SWA_MIME = "http://schemas.xmlsoap.org/wsdl/mime/";
- /** Default namespace for WSDL-1.1 http://schemas.xmlsoap.org/wsdl/ */
- static final String NS_WSDL11 = "http://schemas.xmlsoap.org/wsdl/";
- /** The namespace for the MTOM content type attribute. */
- static final String NS_XML_MIME = "http://www.w3.org/2005/05/xmlmime";
- /** The namespace for XOP. */
- static final String NS_XOP = "http://www.w3.org/2004/08/xop/include";
-
- /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
- public static final String SOAP11HTTP_BINDING = SOAPBinding.SOAP11HTTP_BINDING;
- /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */
- public static final String SOAP12HTTP_BINDING = SOAPBinding.SOAP12HTTP_BINDING;
- /** A constant representing the identity of the SOAP 1.1 over HTTP binding with MTOM enabled by default. */
- public static final String SOAP11HTTP_MTOM_BINDING = SOAPBinding.SOAP11HTTP_MTOM_BINDING;
- /** A constant representing the identity of the SOAP 1.2 over HTTP binding with MTOM enabled by default. */
- public static final String SOAP12HTTP_MTOM_BINDING = SOAPBinding.SOAP12HTTP_MTOM_BINDING;
- /** A constant representing the identity of the XML/HTTP binding. */
- public static final String HTTP_BINDING = HTTPBinding.HTTP_BINDING;
-
- /** SOAP-1.1 encoding URI */
- static final String URI_SOAP11_ENC = SOAPConstants.URI_NS_SOAP_ENCODING;
- /** SOAP-1.2 encoding URI */
- static final String URI_SOAP12_ENC = SOAPConstants.URI_NS_SOAP_1_2_ENCODING;
- /** SOAP HTTP transport URI in wsdl soap binding */
- static final String URI_SOAP_HTTP = "http://schemas.xmlsoap.org/soap/http";
- /** Literal encoding URI */
- static final String URI_LITERAL_ENC = "";
- /** WSDL 2.0 Encoding Rules */
- static final String URI_STYLE_RPC = "http://www.w3.org/2004/03/wsdl/style/rpc";
- static final String URI_STYLE_DOCUMENT = "http://www.w3.org/2004/03/wsdl/style/iri";
-
- /** WS-Eventing namespace uri **/
- static final String URI_WS_EVENTING = "http://schemas.xmlsoap.org/ws/2004/08/eventing";
-
- /** WS-Policy namespace uri **/
- static final String URI_WS_POLICY = "http://schemas.xmlsoap.org/ws/2004/09/policy";
-
- /** WS-Addressing namespace uri **/
- static final String URI_WS_ADDRESSING = "http://www.w3.org/2005/08/addressing";
-
- /** JAX-WS binding customizations namespace uri **/
- static final String URI_JAXWS_WSDL_CUSTOMIZATIONS = "http://java.sun.com/xml/ns/jaxws";
-
- /**Style of WSDL */
- static final String RPC_LITERAL = "RPC/Literal";
- static final String DOCUMENT_LITERAL = "Document/Literal";
-
- // Some prefixes
- static final String PREFIX_ENV = SOAPConstants.SOAP_ENV_PREFIX;
- static final String PREFIX_XMIME = "xmime";
- static final String PREFIX_SOAP11 = "soap";
- static final String PREFIX_SOAP11_ENC = "soap11-enc";
- static final String PREFIX_TNS = "tns";
- static final String PREFIX_WSDL = "wsdl";
- static final String PREFIX_XOP = "xop";
- static final String PREFIX_XSD = "xsd";
- static final String PREFIX_XSI = "xsi";
- static final String PREFIX_XML = "xml";
-
- /** XOP Include */
- static final QName NAME_XOP_INCLUDE = new QName(NS_XOP, "Include", PREFIX_XOP);
-
- /** SOAP-1.1 roles */
- static final String URI_SOAP11_NEXT_ACTOR = "http://schemas.xmlsoap.org/soap/actor/next";
-
- /** SOAP-1.1 attributes */
- static final String SOAP11_ATTR_ACTOR = "actor";
- static final String SOAP11_ATTR_MUST_UNDERSTAND = "mustUnderstand";
-
- /** SOAP-1.1 fault codes */
- static final QName SOAP11_FAULT_CODE_CLIENT = new QName(NS_SOAP11_ENV, "Client", PREFIX_ENV);
- static final QName SOAP11_FAULT_CODE_SERVER = new QName(NS_SOAP11_ENV, "Server", PREFIX_ENV);
- static final QName SOAP11_FAULT_CODE_VERSION_MISMATCH = new QName(NS_SOAP11_ENV, "VersionMismatch", PREFIX_ENV);
- static final QName SOAP11_FAULT_CODE_MUST_UNDERSTAND = new QName(NS_SOAP11_ENV, "MustUnderstand", PREFIX_ENV);
-
- /** SOAP-1.1 elements */
- static final Name SOAP11_ENVELOPE = new NameImpl("Envelope", PREFIX_ENV, NS_SOAP11_ENV);
- static final Name SOAP11_HEADER = new NameImpl("Header", PREFIX_ENV, NS_SOAP11_ENV);
- static final Name SOAP11_BODY = new NameImpl("Body", PREFIX_ENV, NS_SOAP11_ENV);
- static final Name SOAP11_FAULT = new NameImpl("Fault", PREFIX_ENV, NS_SOAP11_ENV);
- static final QName SOAP11_FAULTCODE = new QName("faultcode");
- static final QName SOAP11_FAULTSTRING = new QName("faultstring");
- static final QName SOAP11_FAULTACTOR = new QName("faultactor");
- static final QName SOAP11_DETAIL = new QName("detail");
-
- /** SOAP-1.2 attributes */
- static final String SOAP12_ATTR_ROLE = "role";
- static final String SOAP12_ATTR_RELAY = "relay";
-
- /**SOAP-1.2 elements */
- static final QName SOAP12_CODE = new QName(NS_SOAP12_ENV, "Code", PREFIX_ENV);
- static final QName SOAP12_VALUE = new QName(NS_SOAP12_ENV, "Value", PREFIX_ENV);
- static final QName SOAP12_SUBCODE = new QName(NS_SOAP12_ENV, "Subcode", PREFIX_ENV);
- static final QName SOAP12_REASON = new QName(NS_SOAP12_ENV, "Reason", PREFIX_ENV);
- static final QName SOAP12_TEXT = new QName(NS_SOAP12_ENV, "Text", PREFIX_ENV);
- static final QName SOAP12_ROLE = new QName(NS_SOAP12_ENV, "Role", PREFIX_ENV);
- static final QName SOAP12_NODE = new QName(NS_SOAP12_ENV, "Node", PREFIX_ENV);
- static final QName SOAP12_DETAIL = new QName(NS_SOAP12_ENV, "Detail", PREFIX_ENV);
-
- /** The default RPC return parameter name */
- static final String DEFAULT_RPC_RETURN_NAME = "result"; // FIXME: According to JSR-181 this should be 'return'
-
- /** Standard Literal XML types */
- static final QName TYPE_LITERAL_ANYSIMPLETYPE = new QName(NS_SCHEMA_XSD, "anySimpleType", PREFIX_XSD);
- static final QName TYPE_LITERAL_ANYTYPE = new QName(NS_SCHEMA_XSD, "anyType", PREFIX_XSD);
- static final QName TYPE_LITERAL_ANYURI = new QName(NS_SCHEMA_XSD, "anyURI", PREFIX_XSD);
- static final QName TYPE_LITERAL_BASE64BINARY = new QName(NS_SCHEMA_XSD, "base64Binary", PREFIX_XSD);
- static final QName TYPE_LITERAL_BOOLEAN = new QName(NS_SCHEMA_XSD, "boolean", PREFIX_XSD);
- static final QName TYPE_LITERAL_BYTE = new QName(NS_SCHEMA_XSD, "byte", PREFIX_XSD);
- static final QName TYPE_LITERAL_DATE = new QName(NS_SCHEMA_XSD, "date", PREFIX_XSD);
- static final QName TYPE_LITERAL_DATETIME = new QName(NS_SCHEMA_XSD, "dateTime", PREFIX_XSD);
- static final QName TYPE_LITERAL_DECIMAL = new QName(NS_SCHEMA_XSD, "decimal", PREFIX_XSD);
- static final QName TYPE_LITERAL_DOUBLE = new QName(NS_SCHEMA_XSD, "double", PREFIX_XSD);
- static final QName TYPE_LITERAL_DURATION = new QName(NS_SCHEMA_XSD, "duration", PREFIX_XSD);
- static final QName TYPE_LITERAL_FLOAT = new QName(NS_SCHEMA_XSD, "float", PREFIX_XSD);
- static final QName TYPE_LITERAL_GDAY = new QName(NS_SCHEMA_XSD, "gDay", PREFIX_XSD);
- static final QName TYPE_LITERAL_GMONTH = new QName(NS_SCHEMA_XSD, "gMonth", PREFIX_XSD);
- static final QName TYPE_LITERAL_GMONTHDAY = new QName(NS_SCHEMA_XSD, "gMonthDay", PREFIX_XSD);
- static final QName TYPE_LITERAL_GYEAR = new QName(NS_SCHEMA_XSD, "gYear", PREFIX_XSD);
- static final QName TYPE_LITERAL_GYEARMONTH = new QName(NS_SCHEMA_XSD, "gYearMonth", PREFIX_XSD);
- static final QName TYPE_LITERAL_HEXBINARY = new QName(NS_SCHEMA_XSD, "hexBinary", PREFIX_XSD);
- static final QName TYPE_LITERAL_ID = new QName(NS_SCHEMA_XSD, "ID", PREFIX_XSD);
- static final QName TYPE_LITERAL_INT = new QName(NS_SCHEMA_XSD, "int", PREFIX_XSD);
- static final QName TYPE_LITERAL_INTEGER = new QName(NS_SCHEMA_XSD, "integer", PREFIX_XSD);
- static final QName TYPE_LITERAL_LANGUAGE = new QName(NS_SCHEMA_XSD, "language", PREFIX_XSD);
- static final QName TYPE_LITERAL_LONG = new QName(NS_SCHEMA_XSD, "long", PREFIX_XSD);
- static final QName TYPE_LITERAL_NAME = new QName(NS_SCHEMA_XSD, "Name", PREFIX_XSD);
- static final QName TYPE_LITERAL_NCNAME = new QName(NS_SCHEMA_XSD, "NCName", PREFIX_XSD);
- static final QName TYPE_LITERAL_NEGATIVEINTEGER = new QName(NS_SCHEMA_XSD, "negativeInteger", PREFIX_XSD);
- static final QName TYPE_LITERAL_NMTOKEN = new QName(NS_SCHEMA_XSD, "NMTOKEN", PREFIX_XSD);
- static final QName TYPE_LITERAL_NMTOKENS = new QName(NS_SCHEMA_XSD, "NMTOKENS", PREFIX_XSD);
- static final QName TYPE_LITERAL_NONNEGATIVEINTEGER = new QName(NS_SCHEMA_XSD, "nonNegativeInteger", PREFIX_XSD);
- static final QName TYPE_LITERAL_NONPOSITIVEINTEGER = new QName(NS_SCHEMA_XSD, "nonPositiveInteger", PREFIX_XSD);
- static final QName TYPE_LITERAL_NORMALIZEDSTRING = new QName(NS_SCHEMA_XSD, "normalizedString", PREFIX_XSD);
- static final QName TYPE_LITERAL_POSITIVEINTEGER = new QName(NS_SCHEMA_XSD, "positiveInteger", PREFIX_XSD);
- static final QName TYPE_LITERAL_QNAME = new QName(NS_SCHEMA_XSD, "QName", PREFIX_XSD);
- static final QName TYPE_LITERAL_SHORT = new QName(NS_SCHEMA_XSD, "short", PREFIX_XSD);
- static final QName TYPE_LITERAL_STRING = new QName(NS_SCHEMA_XSD, "string", PREFIX_XSD);
- static final QName TYPE_LITERAL_TIME = new QName(NS_SCHEMA_XSD, "time", PREFIX_XSD);
- static final QName TYPE_LITERAL_TOKEN = new QName(NS_SCHEMA_XSD, "token", PREFIX_XSD);
- static final QName TYPE_LITERAL_UNSIGNEDBYTE = new QName(NS_SCHEMA_XSD, "unsignedByte", PREFIX_XSD);
- static final QName TYPE_LITERAL_UNSIGNEDINT = new QName(NS_SCHEMA_XSD, "unsignedInt", PREFIX_XSD);
- static final QName TYPE_LITERAL_UNSIGNEDLONG = new QName(NS_SCHEMA_XSD, "unsignedLong", PREFIX_XSD);
- static final QName TYPE_LITERAL_UNSIGNEDSHORT = new QName(NS_SCHEMA_XSD, "unsignedShort", PREFIX_XSD);
-
- /** Standard SOAP-1.1 encoded XML types */
- static final QName TYPE_SOAP11_ANYSIMPLETYPE = new QName(URI_SOAP11_ENC, "anySimpleType", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_ANYTYPE = new QName(URI_SOAP11_ENC, "anyType", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_ANYURI = new QName(URI_SOAP11_ENC, "anyURI", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_BASE64 = new QName(URI_SOAP11_ENC, "base64", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_BASE64BINARY = new QName(URI_SOAP11_ENC, "base64Binary", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_BOOLEAN = new QName(URI_SOAP11_ENC, "boolean", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_BYTE = new QName(URI_SOAP11_ENC, "byte", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_DATE = new QName(URI_SOAP11_ENC, "date", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_DATETIME = new QName(URI_SOAP11_ENC, "dateTime", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_DECIMAL = new QName(URI_SOAP11_ENC, "decimal", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_DOUBLE = new QName(URI_SOAP11_ENC, "double", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_DURATION = new QName(URI_SOAP11_ENC, "duration", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_FLOAT = new QName(URI_SOAP11_ENC, "float", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_GDAY = new QName(URI_SOAP11_ENC, "gDay", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_GMONTH = new QName(URI_SOAP11_ENC, "gMonth", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_GMONTHDAY = new QName(URI_SOAP11_ENC, "gMonthDay", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_GYEAR = new QName(URI_SOAP11_ENC, "gYear", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_GYEARMONTH = new QName(URI_SOAP11_ENC, "gYearMonth", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_HEXBINARY = new QName(URI_SOAP11_ENC, "hexBinary", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_ID = new QName(URI_SOAP11_ENC, "ID", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_INT = new QName(URI_SOAP11_ENC, "int", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_INTEGER = new QName(URI_SOAP11_ENC, "integer", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_LANGUAGE = new QName(URI_SOAP11_ENC, "language", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_LONG = new QName(URI_SOAP11_ENC, "long", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NAME = new QName(URI_SOAP11_ENC, "Name", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NCNAME = new QName(URI_SOAP11_ENC, "NCName", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NEGATIVEINTEGER = new QName(URI_SOAP11_ENC, "negativeInteger", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NMTOKEN = new QName(URI_SOAP11_ENC, "NMTOKEN", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NMTOKENS = new QName(URI_SOAP11_ENC, "NMTOKENS", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NONNEGATIVEINTEGER = new QName(URI_SOAP11_ENC, "nonNegativeInteger", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NONPOSITIVEINTEGER = new QName(URI_SOAP11_ENC, "nonPositiveInteger", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_NORMALIZEDSTRING = new QName(URI_SOAP11_ENC, "normalizedString", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_POSITIVEINTEGER = new QName(URI_SOAP11_ENC, "positiveInteger", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_QNAME = new QName(URI_SOAP11_ENC, "QName", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_SHORT = new QName(URI_SOAP11_ENC, "short", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_STRING = new QName(URI_SOAP11_ENC, "string", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_TIME = new QName(URI_SOAP11_ENC, "time", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_TOKEN = new QName(URI_SOAP11_ENC, "token", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_UNSIGNEDBYTE = new QName(URI_SOAP11_ENC, "unsignedByte", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_UNSIGNEDINT = new QName(URI_SOAP11_ENC, "unsignedInt", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_UNSIGNEDLONG = new QName(URI_SOAP11_ENC, "unsignedLong", PREFIX_SOAP11_ENC);
- static final QName TYPE_SOAP11_UNSIGNEDSHORT = new QName(URI_SOAP11_ENC, "unsignedShort", PREFIX_SOAP11_ENC);
-
- /** Encoded mime type namespace for internall and DII use */
- static final String NS_ATTACHMENT_MIME_TYPE = "http://www.jboss.org/jbossws/attachment/mimetype";
-
- /** Attachment Types */
- static final QName TYPE_MIME_APPLICATION_XML = new QName(NS_ATTACHMENT_MIME_TYPE, "application_xml");
- static final QName TYPE_MIME_IMAGE_JPEG = new QName(NS_ATTACHMENT_MIME_TYPE, "image_jpeg");
- static final QName TYPE_MIME_IMAGE_GIF = new QName(NS_ATTACHMENT_MIME_TYPE, "image_gif");
- static final QName TYPE_MIME_MULTIPART_MIXED = new QName(NS_ATTACHMENT_MIME_TYPE, "multipart_mixed");
- static final QName TYPE_MIME_TEXT_PLAIN = new QName(NS_ATTACHMENT_MIME_TYPE, "text_plain");
- static final QName TYPE_MIME_TEXT_XML = new QName(NS_ATTACHMENT_MIME_TYPE, "text_xml");
-
- static final QName TYPE_XMIME_DEFAULT = new QName(NS_XML_MIME, "base64Binary");
-
- /** For out of bound transport (i.e. in headers); http://www.w3.org/2004/08/wsdl/feature/AD/data */
- static final String WSDL_PROPERTY_APPLICATION_DATA = "http://www.w3.org/2004/08/wsdl/feature/AD/data";
- /** The key to the original message part name */
- static final String WSDL_PROPERTY_MESSAGE_NAME = "http://www.jboss.org/jbossws/messagename";
- /** Key to the inbound message name */
- static final String WSDL_PROPERTY_MESSAGE_NAME_IN = "http://www.jboss.org/jbossws/messagename/in";
- /** Key to the outbound message name */
- static final String WSDL_PROPERTY_MESSAGE_NAME_OUT = "http://www.jboss.org/jbossws/messagename/out";
- /** Key to the inboudn wsa action */
- static final String WSDL_PROPERTY_ACTION_IN = "http://www.jboss.org/jbossws/wsa/actionIn";
- /** Key to the outbound wsa action */
- static final String WSDL_PROPERTY_ACTION_OUT = "http://www.jboss.org/jbossws/wsa/actionOut";
-
- static final String WSDL_PROPERTY_EVENTSOURCE = "http://www.jboss.org/jbossws/wse/isEventSource";
-
- static final String WSDL_ELEMENT_POLICY = "http://www.jboss.org/jbossws/wsp/policy";
- static final String WSDL_PROPERTY_POLICYURIS = "http://www.jboss.org/jbossws/wsp/policyURIs";
- static final String WSDL_ELEMENT_POLICYREFERENCE = "http://www.jboss.org/jbossws/wsp/policyReference";
-
- /** The key to the original message part name */
- static final String WSDL_PROPERTY_PART_NAME = "http://www.jboss.org/jbossws/partname";
- /** The key to the message part type in case a part does not reference an element; http://www.jboss.org/jbossws/part/xmltype */
- static final String WSDL_PROPERTY_PART_XMLTYPE = "http://www.jboss.org/jbossws/part/xmltype";
- /** Used as WSDL 2.0 property string to provide support for WSDL 1.1 mime types */
- static final String WSDL_PROPERTY_WSDL11_MIME_TYPE = NS_ATTACHMENT_MIME_TYPE;
- /** Indicate that the operation has zero arguments */
- static final String WSDL_PROPERTY_ZERO_ARGS = "http://www.jboss.org/jbossws/zero-args";
- /** Indicate that the operation has a void return*/
- static final String WSDL_PROPERTY_VOID_RETURN = "http://www.jboss.org/jbossws/void-return";
- /** Indicates that an output is a return parameter */
- static final String WSDL_PROPERTY_RETURN_PART = "http://www.jboss.org/jbossws/return-part";
-
- static final QName WSDL_ATTRIBUTE_WSA_ACTION = new QName(URI_WS_ADDRESSING, "Action");
-
- static final QName WSDL_ATTRIBUTE_WSE_EVENTSOURCE = new QName(URI_WS_EVENTING, "EventSource");
-
- static final QName WSDL_ATTRIBUTE_WSP_POLICYURIS = new QName(URI_WS_POLICY, "PolicyURIs");
- static final QName WSDL_ELEMENT_WSP_POLICYREFERENCE = new QName(URI_WS_POLICY, "PolicyReference");
- static final QName WSDL_ELEMENT_JAXWS_BINDINGS = new QName(URI_JAXWS_WSDL_CUSTOMIZATIONS, "bindings");
- static final QName WSDL_ELEMENT_JAXWS_CLASS = new QName(URI_JAXWS_WSDL_CUSTOMIZATIONS, "class");
- static final QName WSDL_ELEMENT_JAXWS_METHOD = new QName(URI_JAXWS_WSDL_CUSTOMIZATIONS, "method");
- static final QName WSDL_ELEMENT_JAXWS_JAVADOC = new QName(URI_JAXWS_WSDL_CUSTOMIZATIONS, "javadoc");
-
- /** WSDL-2.0 exchange patterns */
- static final String WSDL20_PATTERN_IN_ONLY = "http://www.w3.org/2004/08/wsdl/in-only";
- static final String WSDL20_PATTERN_ROUST_IN_ONLY = "http://www.w3.org/2004/08/wsdl/robust-in-only";
- static final String WSDL20_PATTERN_IN_OUT = "http://www.w3.org/2004/08/wsdl/in-out";
- static final String WSDL20_PATTERN_IN_OPTIONAL_OUT = "http://www.w3.org/2004/08/wsdl/in-opt-out";
- static final String WSDL20_PATTERN_OUT_ONLY = "http://www.w3.org/2004/08/wsdl/out-only";
- static final String WSDL20_PATTERN_ROBUST_OUT_ONLY = "http://www.w3.org/2004/08/wsdl/robust-out-only";
- static final String WSDL20_PATTERN_OUT_IN = "http://www.w3.org/2004/08/wsdl/out-in";
- static final String WSDL20_PATTERN_OUT_OPT_IN = "http://www.w3.org/2004/08/wsdl/out-opt-in";
-
- static final String ASYNC_METHOD_SUFFIX = "Async";
-
- static final String EAGER_INITIALIZE_JAXB_CONTEXT_CACHE = "org.jboss.ws.eagerInitializeJAXBContextCache";
-
- static final String DOM_CONTENT_CANONICAL_NORMALIZATION = "org.jboss.ws.DOMContentCanonicalNormalization";
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/WSException.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/WSException.java 2008-11-07 11:21:50 UTC (rev 8669)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/WSException.java 2008-11-07 11:24:25 UTC (rev 8670)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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;
-
-/**
- * A RuntimeException that should be thrown when a cause is needed
- *
- * The retrotranslator-0.9.5 cannot handle
- *
- * new IllegalStateException(String, Throwable)
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 06-Jan-2006
- */
-public class WSException extends RuntimeException
-{
- public WSException()
- {
- }
-
- public WSException(String message)
- {
- super(message);
- }
-
- public WSException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public WSException(Throwable cause)
- {
- super(cause);
- }
-
- public static void rethrow(String string, Throwable th)
- {
- if (th instanceof WSException)
- throw (WSException)th;
-
- throw new WSException(string, th);
- }
-
- public static void rethrow(Throwable th)
- {
- if (th instanceof WSException)
- throw (WSException)th;
-
- throw new WSException(th);
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java 2008-11-07 11:21:50 UTC (rev 8669)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonSOAPFaultException.java 2008-11-07 11:24:25 UTC (rev 8670)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core;
-
-import javax.xml.namespace.QName;
-
-/**
- * The SOAPFaultException exception represents a SOAP fault.
- *
- * @author Thomas.Diesler(a)jboss.org
- */
-public class CommonSOAPFaultException extends RuntimeException
-{
- private QName faultCode;
- private String faultString;
-
- public CommonSOAPFaultException(QName faultCode, String faultString)
- {
- super(faultString);
-
- this.faultCode = faultCode;
- this.faultString = faultString;
- }
-
- public QName getFaultCode()
- {
- return faultCode;
- }
-
- public String getFaultString()
- {
- return faultString;
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java 2008-11-07 11:21:50 UTC (rev 8669)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.java 2008-11-07 11:24:25 UTC (rev 8670)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core.utils;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.jboss.logging.Logger;
-
-/**
- * A DocumentBuilderFactory that delegates to Xerces and is namespace aware by default.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 11-Apr-2007
- */
-public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory
-{
- private static Logger log = Logger.getLogger(DocumentBuilderFactoryImpl.class);
-
- public static final String XERCES_DOCUMENT_BUILDER_FACTORY = "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl";
-
- private DocumentBuilderFactory delegate;
-
- public DocumentBuilderFactoryImpl()
- {
- try
- {
- ClassLoader classLoader = getClass().getClassLoader();
- Class clazz = classLoader.loadClass(XERCES_DOCUMENT_BUILDER_FACTORY);
- delegate = (DocumentBuilderFactory)clazz.newInstance();
-
- // namespace aware by default
- delegate.setNamespaceAware(true);
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot create delegate document builder factory: " + XERCES_DOCUMENT_BUILDER_FACTORY, ex);
- }
- }
-
- public Object getAttribute(String name) throws IllegalArgumentException
- {
- return delegate.getAttribute(name);
- }
-
- public boolean getFeature(String name) throws ParserConfigurationException
- {
- return delegate.getFeature(name);
- }
-
- public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException
- {
- DocumentBuilder builder = delegate.newDocumentBuilder();
- builder.setEntityResolver( new JBossWSEntityResolver() );
- return builder;
- }
-
- public void setAttribute(String name, Object value) throws IllegalArgumentException
- {
- delegate.setAttribute(name, value);
- }
-
- public void setFeature(String name, boolean value) throws ParserConfigurationException
- {
- delegate.setFeature(name, value);
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/HashCodeUtil.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/HashCodeUtil.java 2008-11-07 11:21:50 UTC (rev 8669)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/HashCodeUtil.java 2008-11-07 11:24:25 UTC (rev 8670)
@@ -1,146 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core.utils;
-
-import java.lang.reflect.Array;
-
-/**
- * Collected methods which allow easy implementation of <code>hashCode</code>.
- *
- * Example use case:
- * <pre>
- * public int hashCode(){
- * int result = HashCodeUtil.SEED;
- * //collect the contributions of various fields
- * result = HashCodeUtil.hash(result, fPrimitive);
- * result = HashCodeUtil.hash(result, fObject);
- * result = HashCodeUtil.hash(result, fArray);
- * return result;
- * }
- * </pre>
- */
-public final class HashCodeUtil
-{
-
- /**
- * An initial value for a <code>hashCode</code>, to which is added contributions
- * from fields. Using a non-zero value decreases collisons of <code>hashCode</code>
- * values.
- */
- public static final int SEED = 23;
-
- /**
- * booleans.
- */
- public static int hash(int aSeed, boolean aBoolean)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + (aBoolean ? 1 : 0);
- }
-
- /**
- * chars.
- */
- public static int hash(int aSeed, char aChar)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + (int)aChar;
- }
-
- /**
- * ints.
- */
- public static int hash(int aSeed, int aInt)
- {
- /*
- * Implementation Note
- * Note that byte and short are handled by this method, through
- * implicit conversion.
- */
- return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + aInt;
- }
-
- /**
- * longs.
- */
- public static int hash(int aSeed, long aLong)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + (int)(aLong ^ (aLong >>> 32));
- }
-
- /**
- * floats.
- */
- public static int hash(int aSeed, float aFloat)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.hash(aSeed, Float.floatToIntBits(aFloat));
- }
-
- /**
- * doubles.
- */
- public static int hash(int aSeed, double aDouble)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.hash(aSeed, Double.doubleToLongBits(aDouble));
- }
-
- /**
- * <code>aObject</code> is a possibly-null object field, and possibly an array.
- *
- * If <code>aObject</code> is an array, then each element may be a primitive
- * or a possibly-null object.
- */
- public static int hash(int aSeed, Object aObject)
- {
- int result = aSeed;
- if (aObject == null)
- {
- result = org.jboss.ws.core.utils.HashCodeUtil.hash(result, 0);
- }
- else if (!org.jboss.ws.core.utils.HashCodeUtil.isArray(aObject))
- {
- result = org.jboss.ws.core.utils.HashCodeUtil.hash(result, aObject.hashCode());
- }
- else
- {
- int length = Array.getLength(aObject);
- for (int idx = 0; idx < length; ++idx)
- {
- Object item = Array.get(aObject, idx);
- //recursive call!
- result = org.jboss.ws.core.utils.HashCodeUtil.hash(result, item);
- }
- }
- return result;
- }
-
- /// PRIVATE ///
- private static final int fODD_PRIME_NUMBER = 37;
-
- private static int firstTerm(int aSeed)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.fODD_PRIME_NUMBER * aSeed;
- }
-
- private static boolean isArray(Object aObject)
- {
- return aObject.getClass().isArray();
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/JBossWSEntityResolver.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/JBossWSEntityResolver.java 2008-11-07 11:21:50 UTC (rev 8669)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/JBossWSEntityResolver.java 2008-11-07 11:24:25 UTC (rev 8670)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core.utils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.xml.JBossEntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Dynamically register the JBossWS entities.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 02-Aug-2006
- */
-public class JBossWSEntityResolver extends JBossEntityResolver
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JBossWSEntityResolver.class);
-
- public JBossWSEntityResolver()
- {
- registerEntity("urn:jboss:jaxrpc-config:2.0", "schema/jaxrpc-config_2_0.xsd");
- registerEntity("urn:jboss:jaxws-config:2.0", "schema/jaxws-config_2_0.xsd");
- registerEntity("http://java.sun.com/xml/ns/javaee", "schema/javaee_web_services_1_2.xsd");
- registerEntity("http://www.w3.org/2005/08/addressing", "schema/ws-addr.xsd");
- registerEntity("http://schemas.xmlsoap.org/ws/2004/08/eventing", "eventing.xsd");
- registerEntity("http://www.w3.org/2002/06/soap-encoding", "soap-encoding_200206.xsd");
- registerEntity("http://schemas.xmlsoap.org/soap/encoding/", "soap-encoding_1_1.xsd");
- registerEntity("http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd", "j2ee_web_services_client_1_1.xsd");
- registerEntity("http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd", "j2ee_web_services_1_1.xsd");
- registerEntity("http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd", "j2ee_jaxrpc_mapping_1_1.xsd");
- registerEntity("http://ws-i.org/profiles/basic/1.1/swaref.xsd", "schema/swaref.xsd");
- }
-
- public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
- {
- if(log.isDebugEnabled()) log.debug("resolveEntity: [pub=" + publicId + ",sysid=" + systemId + "]");
- InputSource inputSource = super.resolveEntity(publicId, systemId);
-
- if (inputSource == null)
- inputSource = resolveSystemIDAsURL(systemId, log.isTraceEnabled());
-
- if (inputSource == null)
- log.debug("Cannot resolve entity: [pub=" + publicId + ",sysid=" + systemId + "]");
-
- return inputSource;
- }
-
- /** Use a ResourceURL to access the resource.
- * This method should be protected in the super class. */
- protected InputSource resolveSystemIDAsURL(String id, boolean trace)
- {
- if (id == null)
- return null;
-
- if (trace)
- log.trace("resolveIDAsResourceURL, id=" + id);
-
- InputSource inputSource = null;
-
- // Try to use the systemId as a URL to the schema
- try
- {
- if (trace)
- log.trace("Trying to resolve id as a URL");
-
- URL url = new URL(id);
- if (url.getProtocol().equalsIgnoreCase("file") == false)
- log.warn("Trying to resolve id as a non-file URL: " + id);
-
- InputStream ins = new ResourceURL(url).openStream();
- if (ins != null)
- {
- inputSource = new InputSource(ins);
- inputSource.setSystemId(id);
- }
- else
- {
- log.warn("Cannot load id as URL: " + id);
- }
-
- if (trace)
- log.trace("Resolved id as a URL");
- }
- catch (MalformedURLException ignored)
- {
- if (trace)
- log.trace("id is not a url: " + id, ignored);
- }
- catch (IOException e)
- {
- if (trace)
- log.trace("Failed to obtain URL.InputStream from id: " + id, e);
- }
- return inputSource;
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/JarUrlConnection.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/JarUrlConnection.java 2008-11-07 11:21:50 UTC (rev 8669)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/JarUrlConnection.java 2008-11-07 11:24:25 UTC (rev 8670)
@@ -1,276 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core.utils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.JarURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarInputStream;
-
-/** <code>URLConnection</code> capable of handling multiply-nested jars.
- *
- * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a>
- */
-public class JarUrlConnection extends JarURLConnection
-{
- // ----------------------------------------------------------------------
- // Instance members
- // ----------------------------------------------------------------------
-
- /** Base resource. */
- private URL baseResource;
-
- /** Additional nested segments. */
- private String[] segments;
-
- /** Terminal input-stream. */
- private InputStream in;
-
- // ----------------------------------------------------------------------
- // Constructors
- // ----------------------------------------------------------------------
-
- /** Construct.
- *
- * @param url Target URL of the connections.
- *
- * @throws java.io.IOException If an error occurs while attempting to initialize
- * the connection.
- */
- public JarUrlConnection(URL url) throws IOException
- {
- super(url = normaliseURL(url));
-
- String baseText = url.getPath();
-
- int bangLoc = baseText.indexOf("!");
-
- String baseResourceText = baseText.substring(0, bangLoc);
-
- String extraText = "";
-
- if (bangLoc <= (baseText.length() - 2) && baseText.charAt(bangLoc + 1) == '/')
- {
- if (bangLoc + 2 == baseText.length())
- {
- extraText = "";
- }
- else
- {
- extraText = baseText.substring(bangLoc + 1);
- }
- }
- else
- {
- throw new MalformedURLException("No !/ in url: " + url.toExternalForm());
- }
-
- List segments = new ArrayList();
-
- StringTokenizer tokens = new StringTokenizer(extraText, "!");
-
- while (tokens.hasMoreTokens())
- {
- segments.add(tokens.nextToken());
- }
-
- this.segments = (String[])segments.toArray(new String[segments.size()]);
-
- this.baseResource = new URL(baseResourceText);
- }
-
- protected static URL normaliseURL(URL url) throws MalformedURLException
- {
- String text = normalizeUrlPath(url.toString());
-
- if (!text.startsWith("jar:"))
- {
- text = "jar:" + text;
- }
-
- if (text.indexOf('!') < 0)
- {
- text = text + "!/";
- }
-
- return new URL(text);
- }
-
- // ----------------------------------------------------------------------
- // Instance methods
- // ----------------------------------------------------------------------
-
- /** Retrieve the nesting path segments.
- *
- * @return The segments.
- */
- protected String[] getSegments()
- {
- return this.segments;
- }
-
- /** Retrieve the base resource <code>URL</code>.
- *
- * @return The base resource url.
- */
- protected URL getBaseResource()
- {
- return this.baseResource;
- }
-
- /** @see java.net.URLConnection
- */
- public void connect() throws IOException
- {
- if (this.segments.length == 0)
- {
- setupBaseResourceInputStream();
- }
- else
- {
- setupPathedInputStream();
- }
- }
-
- /** Setup the <code>InputStream</code> purely from the base resource.
- *
- * @throws java.io.IOException If an I/O error occurs.
- */
- protected void setupBaseResourceInputStream() throws IOException
- {
- this.in = getBaseResource().openStream();
- }
-
- /** Setup the <code>InputStream</code> for URL with nested segments.
- *
- * @throws java.io.IOException If an I/O error occurs.
- */
- protected void setupPathedInputStream() throws IOException
- {
- InputStream curIn = getBaseResource().openStream();
-
- for (int i = 0; i < this.segments.length; ++i)
- {
- curIn = getSegmentInputStream(curIn, segments[i]);
- }
-
- this.in = curIn;
- }
-
- /** Retrieve the <code>InputStream</code> for the nesting
- * segment relative to a base <code>InputStream</code>.
- *
- * @param baseIn The base input-stream.
- * @param segment The nesting segment path.
- *
- * @return The input-stream to the segment.
- *
- * @throws java.io.IOException If an I/O error occurs.
- */
- protected InputStream getSegmentInputStream(InputStream baseIn, String segment) throws IOException
- {
- JarInputStream jarIn = new JarInputStream(baseIn);
- JarEntry entry = null;
-
- while (jarIn.available() != 0)
- {
- entry = jarIn.getNextJarEntry();
-
- if (entry == null)
- {
- break;
- }
-
- if (("/" + entry.getName()).equals(segment))
- {
- return jarIn;
- }
- }
-
- throw new IOException("unable to locate segment: " + segment);
- }
-
- /** @see java.net.URLConnection
- */
- public InputStream getInputStream() throws IOException
- {
- if (this.in == null)
- {
- connect();
- }
- return this.in;
- }
-
- /**
- * @return JarFile
- * @throws java.io.IOException
- * @see java.net.JarURLConnection#getJarFile()
- */
- public JarFile getJarFile() throws IOException
- {
- String url = baseResource.toExternalForm();
-
- if (url.startsWith("file:/"))
- {
- url = url.substring(6);
- }
-
- return new JarFile(URLDecoder.decode(url, "UTF-8"));
- }
-
- private static String normalizeUrlPath(String name)
- {
- if (name.startsWith("/"))
- {
- name = name.substring(1);
-
- System.out.println("1 name = " + name);
- }
-
- // Looking for org/codehaus/werkflow/personality/basic/../common/core-idioms.xml
- // | i |
- // +-------+ remove
- //
- int i = name.indexOf("/..");
-
- // Can't be at the beginning because we have no root to refer to so
- // we start at 1.
- if (i > 0)
- {
- int j = name.lastIndexOf("/", i - 1);
-
- name = name.substring(0, j) + name.substring(i + 3);
-
- System.out.println("2 name = " + name);
- }
-
- return name;
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java 2008-11-07 11:21:50 UTC (rev 8669)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/MimeUtils.java 2008-11-07 11:24:25 UTC (rev 8670)
@@ -1,351 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core.utils;
-
-import java.awt.image.BufferedImage;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.mail.internet.ContentType;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.ParseException;
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.wsf.common.IOUtils;
-import org.jboss.wsf.common.JavaUtils;
-
-import com.sun.image.codec.jpeg.JPEGCodec;
-import com.sun.image.codec.jpeg.JPEGImageDecoder;
-import com.sun.image.codec.jpeg.JPEGImageEncoder;
-
-/**
- * Generic mime utility class.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
- */
-public class MimeUtils
-{
-
- private static Map<String, Class> mime2class = new HashMap<String, Class>();
- private static Map<Class, String> class2mime = new HashMap<Class, String>();
-
- static {
- mime2class.put("text/plain", java.lang.String.class);
- mime2class.put("image/jpeg", java.awt.Image.class);
- mime2class.put("text/xml", javax.xml.transform.Source.class);
- mime2class.put("application/xml", javax.xml.transform.Source.class);
- mime2class.put("application/octet-stream", javax.activation.DataHandler.class);
-
- class2mime.put(java.awt.Image.class, "image/jpeg");
- class2mime.put(javax.xml.transform.Source.class, "text/xml");
- class2mime.put(java.lang.String.class, "text/plain");
- }
-
- /**
- * Converts a MIME type into a proprietary JBossWS attachment xml type.
- *
- * @param mimeType the MIME type string to convert
- * @return the xml type that this mime type corresponds to
- */
- public static QName convertMimeTypeToXmlType(String mimeType)
- {
- StringBuilder mimeName = new StringBuilder(mimeType);
-
- int pos = mimeName.indexOf("/");
-
- if (pos == -1)
- return null;
-
- mimeName.setCharAt(pos, '_');
-
- return new QName(Constants.NS_ATTACHMENT_MIME_TYPE, mimeName.toString());
- }
-
- /**
- * Gets the base portion of a MIME type string. This basically just strips
- * off any type parameter elements.
- *
- * @param mimeType any MIME type string
- * @return a reduced MIME string containing no type parameters
- */
- public static String getBaseMimeType(String mimeType)
- {
- ContentType contentType;
-
- if (mimeType == null)
- return null;
- try
- {
- contentType = new ContentType(mimeType);
- }
- catch (ParseException e)
- {
- return null;
- }
-
- return contentType.getBaseType();
- }
-
- /**
- * Checks if there is a matching mime pattern for mimeType in mimeTypes. This
- * will return true if there is an exact match (for example text/plain =
- * text/plain), or if there is a wildcard subtype match (text/plain =
- * text/*).
- *
- * @param mimeType the mime type to search for
- * @param mimeTypes the set of mime types to search
- * @return true if there is a match, false if not
- */
- public static boolean isMemberOf(String mimeType, Set mimeTypes)
- {
- if (mimeTypes.contains(mimeType))
- return true;
-
- try
- {
- if (mimeTypes.contains(new ContentType(mimeType).getPrimaryType() + "/*"))
- return true;
- }
- catch (ParseException e)
- {
- // eat
- }
-
- return false;
- }
-
- /**
- * Resolve the class for a mype type.
- * Defaults to <code>DataHandler</code> if no mapping could be found.
- */
- public static Class resolveClass(String mimeType) {
- Class cl = mime2class.get(mimeType);
- if(null==cl)
- cl = javax.activation.DataHandler.class;
- return cl;
- }
-
- /**
- * Resolve the mime type for an object.
- * Default to <code>application/octet-stream</code>
- * if no mapping could be found.
- */
- public static String resolveMimeType(Object obj) {
- String mimeType = (obj instanceof MimeMultipart) ?
- ((MimeMultipart)obj).getContentType() :
- resolveMimeType(obj.getClass());
- return mimeType;
- }
-
- public static String resolveMimeType(Class clazz) {
- String mimeType = "application/octet-stream";
- for(Class cl : class2mime.keySet())
- {
- if(JavaUtils.isAssignableFrom(cl, clazz))
- mimeType = class2mime.get(cl);
- }
- return mimeType;
- }
-
- public static ByteArrayConverter getConverterForJavaType(Class targetClazz)
- {
- ByteArrayConverter converter = null;
- if(JavaUtils.isAssignableFrom(java.awt.Image.class, targetClazz))
- converter = new ImageConverter();
- else if (JavaUtils.isAssignableFrom(javax.xml.transform.Source.class, targetClazz))
- converter = new SourceConverter();
- else if (JavaUtils.isAssignableFrom(java.lang.String.class, targetClazz))
- converter = new StringConverter();
- else if (JavaUtils.isAssignableFrom(java.io.InputStream.class, targetClazz))
- converter = new StreamConverter();
-
- if(null == converter)
- throw new WSException("No ByteArrayConverter for class: " + targetClazz.getName());
-
- return converter;
- }
-
- public static ByteArrayConverter getConverterForContentType(String contentType)
- {
- ByteArrayConverter converter = null;
-
- if(contentType != null)
- {
- if("image/jpeg".equals(contentType) || "image/jpg".equals(contentType))
- converter = new ImageConverter();
- else if("text/xml".equals(contentType) || "application/xml".equals(contentType))
- converter = new SourceConverter();
- else if("text/plain".equals(contentType))
- converter = new StringConverter();
- else if("application/octet-stream".equals(contentType))
- converter = new StreamConverter();
- }
-
- if(null == converter)
- throw new WSException("No ByteArrayConverter for content type: " + contentType);
-
- return converter;
- }
- public static class ImageConverter implements ByteArrayConverter
- {
- public Object readFrom(InputStream in) {
- Object converted = null;
- try
- {
- JPEGImageDecoder dec = JPEGCodec.createJPEGDecoder(in);
- BufferedImage bim = dec.decodeAsBufferedImage();
- converted = bim;
- }
- catch (Exception e)
- {
- // ignore
- }
-
- return converted;
- }
-
- public void writeTo(Object obj, OutputStream out) {
- if(obj instanceof BufferedImage)
- {
- JPEGImageEncoder enc = JPEGCodec.createJPEGEncoder(out);
- try
- {
- enc.encode((BufferedImage)obj);
- }
- catch (IOException e)
- {
- throw new WSException("Failed to convert " + obj.getClass());
- }
- }
- else
- {
- throw new WSException("Unable to convert " + obj.getClass());
- }
-
- }
-
- }
-
- public static class SourceConverter implements ByteArrayConverter
- {
- public Object readFrom(InputStream in) {
- return new StreamSource(in);
- }
-
- public void writeTo(Object obj, OutputStream out) {
- if(obj instanceof StreamSource)
- {
- StreamSource s = (StreamSource)obj;
- try
- {
- IOUtils.copyStream(out, s.getInputStream());
- }
- catch (IOException e)
- {
- throw new WSException("Failed to convert " + obj.getClass());
- }
- }
- else
- {
- throw new WSException("Unable to convert " + obj.getClass());
- }
- }
- }
-
- public static class StringConverter implements ByteArrayConverter
- {
- public Object readFrom(InputStream in) {
- Object converted = null;
- try
- {
- StringBuilder out = new StringBuilder();
- byte[] b = new byte[4096];
- for (int n; (n = in.read(b)) != -1;) {
- out.append(new String(b, 0, n));
- }
- converted = out.toString();
- }
- catch (IOException e)
- {
- throw new WSException("Failed to convert java.lang.String");
- }
-
- return converted;
- }
-
- public void writeTo(Object obj, OutputStream out) {
- if(obj instanceof String)
- {
- String s = (String)obj;
- try
- {
- out.write(s.getBytes("UTF-8"));
- }
- catch (IOException e)
- {
- throw new WSException("Failed to convert " + obj.getClass());
- }
- }
- else
- {
- throw new WSException("Unable to convert " + obj.getClass());
- }
- }
- }
-
- public static class StreamConverter implements ByteArrayConverter
- {
- public Object readFrom(InputStream in) {
- return in;
- }
-
- public void writeTo(Object obj, OutputStream out) {
- if(obj instanceof InputStream)
- {
- try
- {
- IOUtils.copyStream(out, (InputStream)obj);
- }
- catch (IOException e)
- {
- throw new WSException("Failed to convert " + obj.getClass());
- }
- }
- }
- }
- public interface ByteArrayConverter
- {
- Object readFrom(InputStream in);
- void writeTo(Object obj, OutputStream out);
- }
-
-
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/ResourceURL.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/ResourceURL.java 2008-11-07 11:21:50 UTC (rev 8669)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/ResourceURL.java 2008-11-07 11:24:25 UTC (rev 8670)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core.utils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-/**
- * A wrapper around an URL that can handle input streams for resources in nested jars.
- *
- * The jdk-1.5.0_10 cannot handle this type of URL
- *
- * jar:file://somepath/jaxws-eardeployment.ear!/jaxws-eardeployment.war!/WEB-INF/wsdl/TestEndpoint.wsdl
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-Dec-2006 (Dosi's birthday)
- */
-public class ResourceURL
-{
- private URL targetURL;
-
- public ResourceURL(URL targetURL)
- {
- this.targetURL = targetURL;
- }
-
- public URL getTargetURL()
- {
- return targetURL;
- }
-
- public InputStream openStream() throws IOException
- {
- boolean isJarUrl = "jar".equals(targetURL.getProtocol());
- return isJarUrl ? new JarUrlConnection(targetURL).getInputStream() : targetURL.openStream();
- }
-
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof ResourceURL)) return false;
- ResourceURL other = (ResourceURL)obj;
- return toString().equals(other.toString());
- }
-
- public String toString()
- {
- return targetURL.toString();
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/XMLPredefinedEntityReferenceResolver.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/XMLPredefinedEntityReferenceResolver.java 2008-11-07 11:21:50 UTC (rev 8669)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/utils/XMLPredefinedEntityReferenceResolver.java 2008-11-07 11:24:25 UTC (rev 8670)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.core.utils;
-
-import java.util.HashMap;
-
-/**
- * Utility class for resolving predefined XML entity and character references.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
- */
-public class XMLPredefinedEntityReferenceResolver
-{
- private static HashMap<String, Character> entities = new HashMap<String, Character>();
-
- static
- {
- entities.put("quot", '"');
- entities.put("amp", '&');
- entities.put("lt", '<');
- entities.put("gt", '>');
- entities.put("apos", '\'');
- }
-
- private static int resolveCharRef(String source, int pos, StringBuilder builder)
- {
- int radix = 10;
- if (source.charAt(pos += 2) == 'x')
- {
- pos++;
- radix = 16;
- }
-
- int end = source.indexOf(';', pos);
- if (end == -1)
- throw new IllegalArgumentException("Invalid character reference");
-
- int c = Integer.parseInt(source.substring(pos, end), radix);
- builder.append((char) c);
-
- return end + 1;
- }
-
- private static int resolveEntityRef(String source, int pos, StringBuilder builder)
- {
- int end = source.indexOf(';', ++pos);
- if (end == -1)
- throw new IllegalArgumentException("Invalid entity reference");
-
- String entity = source.substring(pos, end);
- Character c = entities.get(entity);
- if (c == null)
- throw new IllegalArgumentException("Invalid entity: " + entity);
-
- builder.append(c.charValue());
-
- return end + 1;
- }
-
- /**
- * Transforms an XML normalized string by resolving all predefined character and entity references
- *
- * @param normalized an XML normalized string
- * @return a standard java string that is no longer XML normalized
- */
- public static String resolve(String normalized)
- {
- StringBuilder builder = new StringBuilder();
- int end = normalized.length();
- int pos = normalized.indexOf('&');
- int last = 0;
-
- // No references
- if (pos == -1)
- return normalized;
-
- while (pos != -1)
- {
- String sub = normalized.subSequence(last, pos).toString();
- builder.append(sub);
-
- int peek = pos + 1;
- if (peek == end)
- throw new IllegalArgumentException("Invalid entity reference");
-
- if (normalized.charAt(peek) == '#')
- pos = resolveCharRef(normalized, pos, builder);
- else
- pos = resolveEntityRef(normalized, pos, builder);
-
- last = pos;
- pos = normalized.indexOf('&', pos);
- }
-
- if (last < end)
- {
- String sub = normalized.subSequence(last, end).toString();
- builder.append(sub);
- }
-
- return builder.toString();
- }
-}
16 years, 2 months