hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Creating a ContentType
Date Mon, 01 Oct 2012 13:17:16 GMT
Hi All:

Right now I have code that looks like this:

  final Charset myCharset = ...
  final ContentType ct = ContentType.create(*HTTP.OCTET_STREAM_TYPE*,
myCharset);

HTTP.OCTET_STREAM_TYPE is deprecated, so to avoild magic strings in the
code I can do:

  final ContentType ct =
ContentType.create(ContentType.APPLICATION_OCTET_STREAM.getMimeType(),
myCharset);

What doing a fluent type of call instead:

final ContentType ct = ContentType.APPLICATION_OCTET_STREAM.with(myCharset);

?

-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message