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

--
To unsubscribe, e-mail:   <mailto:soap-dev-unsubscribe@;xml.apache.org>
For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>

Reply via email to