ws-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Ausianik <Pavel_Ausia...@epam.com>
Subject Question: MimeType usage
Date Tue, 05 Nov 2002 15:55:47 GMT
Hi,


Need an advice of expert on MymeTypes. We have a code in the lib, which
could save around 2% of time in class org.apache.soap.rpc.SOAPContext method
addBodyPart.

           MimeType ctype = new MimeType(dh.getContentType());
            part.setHeader(Constants.HEADER_CONTENT_TYPE,
                           ctype.toString());
	....

            if (ctype.match("application/octet-stream") ||
                ctype.match("image/*") ||
                ctype.match("audio/*") ||
                ctype.match("video/*"))


Unfortunately match method requres create additional MimeType instances and
scan over String

Will be this code fragment safe to rewrite as follows:

           String ctype = dh.getContentType())
            part.setHeader(Constants.HEADER_CONTENT_TYPE,
                           ctype);
	....

            if (ctype.equals("application/octet-stream") ||
                ctype.equals("image/*") ||		// or maybe
ctype.startsWith("image/"
                ctype.equals("audio/*") ||
                ctype.equals("video/*"))
	
Best regards,
Pavel

Mime
View raw message