@Test public void testParseContentType () { assertNull (AS2HttpHelper.parseContentType (null)); assertNull (AS2HttpHelper.parseContentType ("")); assertNull (AS2HttpHelper.parseContentType (" ")); assertNull (AS2HttpHelper.parseContentType ("abc")); assertNull (AS2HttpHelper.parseContentType ("abc/")); assertNotNull (AS2HttpHelper.parseContentType ("abc/def")); assertNotNull (AS2HttpHelper.parseContentType ("abc/def; a=b")); assertNotNull (AS2HttpHelper.parseContentType (" abc/def ; a = b ")); assertNotNull (AS2HttpHelper.parseContentType ("abc/def; a=b; c=d")); assertNotNull (AS2HttpHelper.parseContentType (" abc/def ; a = b ; c = d ")); }
@Nullable public static ContentType parseContentType (@Nullable final String sContentType) { if (StringHelper.hasText (sContentType)) { final String sRealContentType = RFC2616Codec.isMaybeEncoded (sContentType) ? new RFC2616Codec ().getDecodedAsString (sContentType) : sContentType; try { return new ContentType (sRealContentType); } catch (final ParseException ex) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Error parsing Content-Type '" + sContentType + "'", ex); } } return null; }
AS2HttpHelper { @Nullable public static ContentType parseContentType (@Nullable final String sContentType) { if (StringHelper.hasText (sContentType)) { final String sRealContentType = RFC2616Codec.isMaybeEncoded (sContentType) ? new RFC2616Codec ().getDecodedAsString (sContentType) : sContentType; try { return new ContentType (sRealContentType); } catch (final ParseException ex) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Error parsing Content-Type '" + sContentType + "'", ex); } } return null; } }
AS2HttpHelper { @Nullable public static ContentType parseContentType (@Nullable final String sContentType) { if (StringHelper.hasText (sContentType)) { final String sRealContentType = RFC2616Codec.isMaybeEncoded (sContentType) ? new RFC2616Codec ().getDecodedAsString (sContentType) : sContentType; try { return new ContentType (sRealContentType); } catch (final ParseException ex) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Error parsing Content-Type '" + sContentType + "'", ex); } } return null; } private  AS2HttpHelper(); }
AS2HttpHelper { @Nullable public static ContentType parseContentType (@Nullable final String sContentType) { if (StringHelper.hasText (sContentType)) { final String sRealContentType = RFC2616Codec.isMaybeEncoded (sContentType) ? new RFC2616Codec ().getDecodedAsString (sContentType) : sContentType; try { return new ContentType (sRealContentType); } catch (final ParseException ex) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Error parsing Content-Type '" + sContentType + "'", ex); } } return null; } private  AS2HttpHelper(); @Nullable static ContentType parseContentType(@Nullable final String sContentType); @Nullable static String getCleanContentType(@Nullable final String sContentType); @Nonnull static InternetHeaders getAsInternetHeaders(@Nonnull final HttpHeaderMap aHeaders); }
AS2HttpHelper { @Nullable public static ContentType parseContentType (@Nullable final String sContentType) { if (StringHelper.hasText (sContentType)) { final String sRealContentType = RFC2616Codec.isMaybeEncoded (sContentType) ? new RFC2616Codec ().getDecodedAsString (sContentType) : sContentType; try { return new ContentType (sRealContentType); } catch (final ParseException ex) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Error parsing Content-Type '" + sContentType + "'", ex); } } return null; } private  AS2HttpHelper(); @Nullable static ContentType parseContentType(@Nullable final String sContentType); @Nullable static String getCleanContentType(@Nullable final String sContentType); @Nonnull static InternetHeaders getAsInternetHeaders(@Nonnull final HttpHeaderMap aHeaders);  }