use of com.github.dreamhead.moco.parser.model.CookieContainer in project moco by dreamhead.
the class CookieContainerDeserializer method deserialize.
@Override
public CookieContainer deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException {
JsonToken currentToken = jp.getCurrentToken();
if (currentToken == JsonToken.VALUE_STRING) {
return CookieContainer.newContainer(jp.getText());
}
if (currentToken == JsonToken.START_OBJECT) {
jp.nextToken();
InternalCookieContainer container = get(jp.readValuesAs(InternalCookieContainer.class), 0);
return container.toContainer();
}
return (CookieContainer) ctxt.handleUnexpectedToken(CookieContainer.class, jp);
}
Aggregations