Could not find MessageBodyWriter for response object of type: java.util.ArrayList of media type: text/html - in Resteasy

前端 未结 7 2076
傲寒
傲寒 2021-02-18 15:39

I am developing RESTEasy Example. In this example I am using all latest dependencies and deploying om tomcat 8.x version. I can successfully deploy the applicat

7条回答
  •  故里飘歌
    2021-02-18 16:25

    For me it was about trying to serialize the array to XML. If you would like that it would need a wrapper class like this for movies:

    @XmlRootElement(name = "movies")
    @XmlAccessorType(XmlAccessType.FIELD)
    public class Movies
    {
        @XmlElement(name = "movie")
        private List movies;
    
        public List getMovies() {
            return movies;
        }
    
        public void setMovies(List movies) {
            this.movies = movies;
        }
    }
    

    This way it can be serialized under the root object.

提交回复
热议问题