Package org.mockserver.client.serialization.model

Examples of org.mockserver.client.serialization.model.StringBodyDTO


                                    jsonParser.nextToken();
                                    if (jsonParser.getCurrentToken() == JsonToken.VALUE_STRING) {
                                        String value = jsonParser.getText();
                                        jsonParser.nextToken();
                                        if (jsonParser.getCurrentToken() == JsonToken.END_OBJECT) {
                                            return new StringBodyDTO(new StringBody(value, type));
                                        }
                                    }
                                }
                                break;
                            case BINARY:
                                if (jsonParser.getCurrentToken() == JsonToken.FIELD_NAME && jsonParser.getText().equals("value")) {
                                    jsonParser.nextToken();
                                    if (jsonParser.getCurrentToken() == JsonToken.VALUE_STRING) {
                                        String value = jsonParser.getText();
                                        jsonParser.nextToken();
                                        if (jsonParser.getCurrentToken() == JsonToken.END_OBJECT) {
                                            return new BinaryBodyDTO(new BinaryBody(Base64Converter.base64StringToBytes(value)));
                                        }
                                    }
                                }
                                break;
                            case PARAMETERS:
                                if (jsonParser.getCurrentToken() == JsonToken.FIELD_NAME && jsonParser.getText().equals("parameters")) {
                                    jsonParser.nextToken();
                                    if (jsonParser.isExpectedStartArrayToken()) {
                                        List<Parameter> parameters = new ArrayList<Parameter>();
                                        boolean inObject = false;
                                        while (inObject || jsonParser.getCurrentToken() != JsonToken.END_ARRAY) {
                                            JsonToken token = jsonParser.nextToken();
                                            switch (token) {
                                                case START_OBJECT:
                                                    inObject = true;
                                                    break;
                                                case END_OBJECT:
                                                    inObject = false;
                                                    break;
                                                case FIELD_NAME:
                                                    if (jsonParser.getText().equals("name")) {
                                                        if (jsonParser.nextToken() == JsonToken.VALUE_STRING) {
                                                            String name = jsonParser.getText();
                                                            jsonParser.nextToken();
                                                            if (jsonParser.nextToken() == JsonToken.START_ARRAY) {
                                                                List<String> values = new ArrayList<String>();
                                                                while (jsonParser.nextToken() != null && jsonParser.getCurrentToken() != JsonToken.END_ARRAY) {
                                                                    if (jsonParser.getCurrentToken() == JsonToken.VALUE_STRING) {
                                                                        values.add(jsonParser.getText());
                                                                    }
                                                                }
                                                                parameters.add(new Parameter(name, values));
                                                            }
                                                        }
                                                    }
                                                    break;
                                            }
                                        }
                                        jsonParser.nextToken();
                                        if (jsonParser.getCurrentToken() == JsonToken.END_OBJECT) {
                                            return new ParameterBodyDTO(new ParameterBody(parameters));
                                        }
                                    }
                                }
                                break;
                        }
                    }
                }
            } else if (currentToken == JsonToken.VALUE_STRING) {
                return new StringBodyDTO(new StringBody(jsonParser.getText(), Body.Type.STRING));
            }
            return null;
        }
View Full Code Here

TOP

Related Classes of org.mockserver.client.serialization.model.StringBodyDTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.