title: Marshalling/Unmarshalling java.util.Date to Json in jax rs
body: <p>I am using jaxb and Date adapter. But the response doesn't contain the date.</p>
  
  <pre><code>@XmlRootElement(name = "project")
  public class Project implements Serializable {
  
      private static final long serialVersionUID = -6462790408417409266L;
      private long projectId;
      private long userId;
      private String projectName;
      private Date createdDate;
      private Date lastUpdatedDate;
  
      public final long getProjectId() {
          return projectId;
      }
      public final void setProjectId(final long projectId) {
          this.projectId = projectId;
      }
      public final long getUserId() {
          return userId;
      }
      public final void setUserId(long userId) {
          this.userId = userId;
      }
      public final String getProjectName() {
          return projectName;
      }
      public final void setProjectName(final String projectName) {
          this.projectName = projectName;
      }
  
      /**
       * @return the createdDate
       */
      @XmlElement(name = "createdDate")
      @XmlJavaTypeAdapter(value = DateAdapter.class, type = Date.class)
      public final Date getCreatedDate() {
          return createdDate;
      }
  
      /**
       * @param createdDate
       *            the createdDate to set
       */
      public final void setCreatedDate(final Date createdDate) {
          this.createdDate = createdDate;
      }
  
      /**
       * @return the lastUpdatedDate
       */
      @XmlElement(name = "lastUpdatedDate")
      @XmlJavaTypeAdapter(value = DateAdapter.class, type = Date.class)
      public final Date getLastUpdatedDate() {
          return lastUpdatedDate;
      }
  
      /**
       * @param lastUpdatedDate
       *            the lastUpdatedDate to set
       */
      public final void setLastUpdatedDate(final Date lastUpdatedDate) {
          this.lastUpdatedDate = lastUpdatedDate;
      }
  
  }
  </code></pre>
  
  <p>And following is my Adapter class,</p>
  
  <pre><code>public class DateAdapter extends XmlAdapter&lt;String, Date&gt; {
  
      private final SimpleDateFormat dateFormat = new SimpleDateFormat(
              "yyyy-MM-dd'T'HH:mm:ss");
  
      @Override
      public String marshal(Date v) throws Exception {
          return dateFormat.format(v);
      }
  
      @Override
      public Date unmarshal(String v) throws Exception {
          return dateFormat.parse(v);
      }
  
  }
  </code></pre>
  
  <p>When I call the resful service through a rest client what I get is the following,</p>
  
  <pre><code>{"project":{"projectId":1,"projectName":"testProject","userId":1}}
  </code></pre>
  
  <p>It doesn't contain the date. What am I missing here?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I have deployed this in <a href="http://wso2.com/products/application-server/" rel="nofollow">WSO2 application server</a> in CXF environment. 
  And following is the service exposed method definition,</p>
  
  <pre><code>@GET
  @Path("{userId}/{projectName}")
  @Produces("application/json")
  public Project getProjectByUser(@PathParam("userId") long userId,
          @PathParam("projectName") String projectName) throws IOException;
  </code></pre>