Search in sources :

Example 1 with CookieContainer

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);
}
Also used : JsonToken(com.fasterxml.jackson.core.JsonToken) CookieContainer(com.github.dreamhead.moco.parser.model.CookieContainer)

Aggregations

JsonToken (com.fasterxml.jackson.core.JsonToken)1 CookieContainer (com.github.dreamhead.moco.parser.model.CookieContainer)1