title: Jackson set default view
body: <h2>I am using Jackson 2.3.2, and I want to set the ObjectMapper default View</h2>
  <hr />
  <h3>First try: <a href="http://wiki.fasterxml.com/JacksonJsonViews#Implementation" rel="noreferrer">http://wiki.fasterxml.com/JacksonJsonViews#Implementation</a></h3>
  <pre><code>// short-cut:
  objectMapper.writeValueUsingView(out, beanInstance, ViewsPublic.class);
  
  // or fully exploded:
  objectMapper.getSerializationConfig().setSerializationView(Views.Public.class);
  // (note: can also pre-construct config object with 'mapper.copySerializationConfig'; reuse)
  objectMapper.writeValue(out, beanInstance); // will use active view set via Config
  
  // or, starting with 1.5, more convenient (ObjectWriter is reusable too)
  objectMapper.viewWriter(ViewsPublic.class).writeValue(out, beanInstance);
  </code></pre>
  <p>So I had:</p>
  <pre><code>ObjectMapper mapper = new ObjectMapper();
  mapper.enable(SerializationFeature.INDENT_OUTPUT);
  mapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, true);
  mapper.getSerializationConfig().setSerializationView(ResourceView.PublicView.class);
  </code></pre>
  <p>Not works <a href="http://jackson.codehaus.org/1.8.2/javadoc/org/codehaus/jackson/map/SerializationConfig.html#setSerializationView%28java.lang.Class%29" rel="noreferrer">JavaDoc <strong>1.8.2</strong> says:</a> <code>setSerializationView</code> is <strong>deprecated</strong>, I have to use <code>withView()</code></p>
  <hr />
  <h3>Second try:</h3>
  <pre><code>ObjectMapper mapper = new ObjectMapper();
  mapper.enable(SerializationFeature.INDENT_OUTPUT);
  mapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, true);
  mapper.getSerializationConfig().withView(ResourceView.PublicView.class);
  </code></pre>
  <p>Still not working. <a href="http://fasterxml.github.io/jackson-databind/javadoc/2.2.0/com/fasterxml/jackson/databind/SerializationConfig.html#withView%28java.lang.Class%29" rel="noreferrer">JavaDoc <strong>2.2.0</strong> says</a></p>
  <blockquote>
  <p><code>public SerializationConfig withView(Class&lt;?&gt; view)</code></p>
  <p>Description copied from class: MapperConfigBase</p>
  <p>Method for constructing and returning a <strong>new instance</strong> with different view to use.</p>
  </blockquote>
  <p>But I can't set the new <code>SerializationConfig</code> to the existing <code>ObjectMapper</code></p>
  <hr />
  <h2>How can I set default View?</h2>
  <hr />
  <h3>UPDATE</h3>
  <p>I use Jersey and JAX-RS on the server side</p>