dims 2002/06/23 10:06:30
Modified: java/src/org/apache/axis SOAPPart.java
java/src/org/apache/axis/utils XMLUtils.java
Log:
Fleshing SOAPPart for SAAJ compliance.
Revision Changes Path
1.25 +18 -36 xml-axis/java/src/org/apache/axis/SOAPPart.java
Index: SOAPPart.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/SOAPPart.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- SOAPPart.java 31 May 2002 08:33:26 -0000 1.24
+++ SOAPPart.java 23 Jun 2002 17:06:30 -0000 1.25
@@ -72,6 +72,7 @@
import org.xml.sax.SAXException;
import javax.xml.soap.SOAPException;
+import javax.xml.soap.MimeHeaders;
import javax.xml.transform.Source;
import java.io.*;
import java.util.Hashtable;
@@ -105,7 +106,8 @@
private static final int FORM_FAULT = 6;
private int currentForm;
- private Hashtable headers = new Hashtable();
+ //private Hashtable headers = new Hashtable();
+ private MimeHeaders mimeHeaders = new MimeHeaders();
private String contentId;
private String contentLocation;
@@ -486,14 +488,18 @@
throw new IllegalArgumentException(
JavaUtils.getMessage("headerValueNotNull"));
}
- headers.put(header.toLowerCase(), value);
+ mimeHeaders.setHeader(header.toLowerCase(), value);
}
/**
* Get the specified MIME header.
*/
public String getFirstMimeHeader (String header) {
- return (String) headers.get(header.toLowerCase());
+ //return (String) headers.get(header.toLowerCase());
+ String[] values = mimeHeaders.getHeader(header);
+ if(values != null && values.length>0)
+ return values[0];
+ return null;
}
/**
@@ -551,35 +557,14 @@
* Get all headers that match
*/
public java.util.Iterator getMatchingMimeHeaders( final String[] match){
- java.util.LinkedList retList= new java.util.LinkedList();
- if(null != match && 0 != match.length ){
- for(int i= match.length-1 ; i > -1 ; --i){
- if(match[i] != null){
- String key= match[i].toLowerCase();
- if(headers.containsKey(key))
- retList.add(match[i]);
- }
- }
- }
- return retList.iterator();
+ return mimeHeaders.getMatchingHeaders(match);
}
/**
* Get all headers that do not match
*/
public java.util.Iterator getNonMatchingMimeHeaders( final String[] match){
- java.util.LinkedList retList= new java.util.LinkedList(headers.keySet());
- if(null != match && 0 != match.length && !headers.isEmpty()){
- for(int i= match.length-1 ; i > -1 ; --i){
- if(match[i] != null){
- String remItem= match[i].toLowerCase();
- if(headers.containsKey(remItem)){
- retList.remove(remItem);
- }
- }
- }
- }
- return retList.iterator();
+ return mimeHeaders.getNonMatchingHeaders(match);
}
/**
@@ -592,7 +577,8 @@
* @see #getContent() getContent()
*/
public void setContent(Source source) throws SOAPException {
- //TODO: Flesh this out.
+ InputSource in =
org.apache.axis.utils.XMLUtils.getInputSourceFromURI(source.getSystemId());
+ setCurrentMessage(in.getByteStream(), FORM_INPUTSTREAM);
}
/**
@@ -617,8 +603,7 @@
* headers for this <CODE>SOAPPart</CODE> object
*/
public Iterator getAllMimeHeaders() {
- //TODO: Flesh this out.
- return null;
+ return mimeHeaders.getAllHeaders();
}
/**
@@ -646,7 +631,7 @@
* @see #getMimeHeader(java.lang.String) getMimeHeader(java.lang.String)
*/
public void setMimeHeader(String name, String value) {
- //TODO: Flesh this out.
+ mimeHeaders.setHeader(name,value);
}
/**
@@ -660,10 +645,7 @@
* @see #setMimeHeader(java.lang.String, java.lang.String)
setMimeHeader(java.lang.String, java.lang.String)
*/
public String[] getMimeHeader(String name) {
- //TODO: Flesh this out.
- String[] strings = new String[1];
- strings[0] = getFirstMimeHeader(name);
- return strings;
+ return mimeHeaders.getHeader(name);
}
/**
@@ -671,7 +653,7 @@
* <CODE>SOAPEnvelope</CODE> object.
*/
public void removeAllMimeHeaders() {
- //TODO: Flesh this out.
+ mimeHeaders.removeAllHeaders();
}
/**
@@ -680,7 +662,7 @@
* the name of the MIME header(s) to be removed
*/
public void removeMimeHeader(String header) {
- //TODO: Flesh this out.
+ mimeHeaders.removeHeader(header);
}
/**
1.54 +11 -2 xml-axis/java/src/org/apache/axis/utils/XMLUtils.java
Index: XMLUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/XMLUtils.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- XMLUtils.java 22 Jun 2002 16:40:57 -0000 1.53
+++ XMLUtils.java 23 Jun 2002 17:06:30 -0000 1.54
@@ -505,8 +505,17 @@
throw new SAXException(message);
}
}
-
-
+
+
+ /**
+ * Utility to get the bytes uri
+ *
+ * @param uri the resource to get
+ */
+ public static InputSource getInputSourceFromURI(String uri){
+ return getInputSourceFromURI(uri);
+ }
+
/**
* Utility to get the bytes at a protected uri
*