snichol 2002/11/06 10:08:04 Modified: java/src/org/apache/soap/rpc SOAPContext.java Log: Submitted by: Pavel Ausianik <[EMAIL PROTECTED]> Create class constants against which to check type for base64 encoding, instead of creating new instances each time. Revision Changes Path 1.13 +24 -4 xml-soap/java/src/org/apache/soap/rpc/SOAPContext.java Index: SOAPContext.java =================================================================== RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/rpc/SOAPContext.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- SOAPContext.java 11 Oct 2002 19:21:41 -0000 1.12 +++ SOAPContext.java 6 Nov 2002 18:08:04 -0000 1.13 @@ -90,6 +90,12 @@ protected Boolean gzip = null; protected Boolean acceptGzip = null; + // Constants for checking type for base64 encoding + private static MimeType MIME_STREAM; + private static MimeType MIME_IMAGE; + private static MimeType MIME_AUDIO; + private static MimeType MIME_VIDEO; + /** * This flag indicates if setRootPart() was called, so we can distinguish * default root part resolution from deliberate root part indication. @@ -121,6 +127,20 @@ */ public SOAPContext() { parts = null; + // Initialize mime types + if (MIME_STREAM == null) { + synchronized (SOAPContext.class) { + if (MIME_STREAM == null) { + try { + MIME_STREAM = new MimeType("application", "octet-stream"); + MIME_IMAGE = new MimeType("image", "*"); + MIME_AUDIO = new MimeType("audio", "*"); + MIME_VIDEO = new MimeType("video", "*"); + } + catch (MimeTypeParseException e) {} + } + } + } } /** @@ -361,10 +381,10 @@ * exception for text/*, which should be UTF-8 encoded. * To do: find a way to do the latter... */ - if (ctype.match("application/octet-stream") || - ctype.match("image/*") || - ctype.match("audio/*") || - ctype.match("video/*")) + if (ctype.match(MIME_STREAM) || + ctype.match(MIME_IMAGE) || + ctype.match(MIME_AUDIO) || + ctype.match(MIME_VIDEO)) part.setHeader("Content-Transfer-Encoding", "8bit"); } catch(MessagingException me) { throw new IllegalArgumentException(
-- To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org> For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>