Use the MimeType class to extract the MIME type/subtype, ignoring the parameters. The type is cached.
()
| 655 | * ignoring the parameters. The type is cached. |
| 656 | */ |
| 657 | private synchronized String getBaseType() { |
| 658 | if (shortType == null) { |
| 659 | String ct = getContentType(); |
| 660 | try { |
| 661 | MimeType mt = new MimeType(ct); |
| 662 | shortType = mt.getBaseType(); |
| 663 | } catch (MimeTypeParseException e) { |
| 664 | shortType = ct; |
| 665 | } |
| 666 | } |
| 667 | return shortType; |
| 668 | } |
| 669 | |
| 670 | /** |
| 671 | * Sets the DataContentHandlerFactory. The DataContentHandlerFactory |
no test coverage detected