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 RE: Question: MimeType usage
Date Wed, 06 Nov 2002 16:21:07 GMT
Scott,

agree, please find a patch

Pavel

> -----Original Message-----
> From: Scott Nichol [mailto:snicholnews@scottnichol.com]
> Sent: Tuesday, November 05, 2002 10:17 PM
> To: soap-dev@xml.apache.org
> Subject: Re: Question: MimeType usage
> 
> 
> From your description, I guess you have traced into
> MimeType#match(String) to see that it instantiates a MimeType 
> so it can
> call MimeType#match(MimeType), right?  If that is the case, 
> it seems to
> me that something that will speed execution without worrying about the
> actual logic in the call is to create class variables for the types we
> always compare against:
> 
> private static final MimeType MT_APPLICATION_OCTET_STREAM = new
> MimeType("application/octet-stream");
> 
> if (ctype.match(MT_APPLICATION_OCTET_STREAM) ...
> 
> Scott Nichol
> 
> ----- Original Message -----
> From: "Pavel Ausianik" <Pavel_Ausianik@epam.com>
> To: <soap-dev@xml.apache.org>
> Sent: Tuesday, November 05, 2002 10:55 AM
> Subject: Question: MimeType usage
> 
> 
> > 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>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:soap-dev-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <mailto:soap-dev-help@xml.apache.org>
> 


Mime
View raw message