users@jersey.java.net

how to serialize enumerations ? (Jersey Client)

From: Felipe Gaścho <fgaucho_at_gmail.com>
Date: Wed, 28 Oct 2009 21:20:29 +0100

This code cannot be de-serialized by the Jersey Client:

        private enum CompetitionStatus {
                NEW, CALL_FOR_PAPERS, EVALUATION, HISTORY
        }

        @XmlAttribute
        @Enumerated(EnumType.STRING)
        @Column(columnDefinition = "VARCHAR(20) DEFAULT 'NEW'")
        private PujCompetitionEntity.CompetitionStatus status;


Error marshalling
com.kenai.puj.arena.model.entity.PujCompetitionEntity$CompetitionStatus:


---- In the browser, the URI returns normally:

http://fgaucho.dyndns.org:8080/arena-http/competition

please notice the attribute 'status'


--- is it a JAXB customization issue ? any trick in Jersey Client ?

the client code:

                Collection<PujHomeworkEntity> ret = arena
                                .path("homework")
                                .queryParam("competition", competition.getName())
                                .queryParam("start", Integer.toString(offset))
                                .queryParam("max", Integer.toString(limit))
                                .get(new GenericType<Collection<PujHomeworkEntity>>() {
                                });