On 9/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
+ public static boolean isMatch(MimeType a, MimeType b) {
+ try {
+ final MimeType WILDCARD = new MimeType("*/*");
+ if (a == null || b == null) return true;
+ if (a.match(b)) return true;
+ if (a.equals(WILDCARD)) return true;
+ if (a.getPrimaryType().equals("*")) {
+ MimeType c = new MimeType(b.getPrimaryType(), a.getSubType());
+ return c.match(b);
+ }
+ if (b.getPrimaryType().equals("*")) {
+ MimeType c = new MimeType(a.getPrimaryType(), b.getSubType());
+ return c.match(a);
+ }
+ } catch (Exception e) {}
+ return false;
It seems like WILDCARD would be a nice chance for a static member, to
avoid having to allocate one each time through here...
-garrett