12
12
import java .util .TimeZone ;
13
13
14
14
import javax .ws .rs .Produces ;
15
+ import javax .ws .rs .core .GenericType ;
15
16
import javax .ws .rs .core .MediaType ;
16
17
import javax .ws .rs .ext .ContextResolver ;
17
18
import javax .ws .rs .ext .Provider ;
37
38
import com .fasterxml .jackson .databind .SerializationFeature ;
38
39
import com .fasterxml .jackson .databind .SerializerProvider ;
39
40
import com .fasterxml .jackson .databind .module .SimpleModule ;
41
+ import com .fasterxml .jackson .databind .type .CollectionType ;
40
42
import com .fasterxml .jackson .jaxrs .json .JacksonJaxbJsonProvider ;
41
43
42
44
/**
@@ -132,7 +134,8 @@ public <T> T unmarshal(Class<T> returnType, String postData) throws JsonParseExc
132
134
*/
133
135
public <T > List <T > unmarshalList (Class <T > returnType , Reader reader ) throws JsonParseException , JsonMappingException , IOException {
134
136
ObjectMapper objectMapper = getContext (null );
135
- return (objectMapper .readValue (reader , new TypeReference <List <T >>() {}));
137
+ CollectionType javaType = objectMapper .getTypeFactory ().constructCollectionType (List .class , returnType );
138
+ return (objectMapper .readValue (reader , javaType ));
136
139
}
137
140
138
141
/**
@@ -148,7 +151,8 @@ public <T> List<T> unmarshalList(Class<T> returnType, Reader reader) throws Json
148
151
*/
149
152
public <T > List <T > unmarshalList (Class <T > returnType , String postData ) throws JsonParseException , JsonMappingException , IOException {
150
153
ObjectMapper objectMapper = getContext (null );
151
- return objectMapper .readValue (postData , new TypeReference <List <T >>() {});
154
+ CollectionType javaType = objectMapper .getTypeFactory ().constructCollectionType (List .class , returnType );
155
+ return (objectMapper .readValue (postData , javaType ));
152
156
}
153
157
154
158
/**
0 commit comments