@Test void getBody() { final DssRestActorFormDataService service = new DssRestActorFormDataService("test", "/test", DssRestMethodType.GET) { @Override protected DssRestServiceResponse handlingRequest(DssRestServiceRequest<HashMap<String, Object>> request) { return null; } }; final HashMap<String, Object> map1 = service.getBody(""); assertTrue(map1.isEmpty()); final HashMap<String, Object> map2 = service.getBody("id=kebron&password=1234567"); assertFalse(map2.isEmpty()); assertEquals("kebron", map2.get("id")); assertEquals("1234567", map2.get("password")); }
@SuppressWarnings("unchecked") @Override protected final HashMap<String, Object> getBody(String content) { if (StringUtils.isEmpty(content)) { return new HashMap<>(); } final String[] splits = content.split("&"); final HashMap<String, Object> bodyMap = new HashMap<>(splits.length); for (int i = 0; i < splits.length; i++) { final String element = splits[i]; if (!StringUtils.isEmpty(element)) { final String[] formData = element.split("="); if (formData.length == 2) { final String name = formData[0]; final String preValue = formData[1]; bodyMap.put(name, preValue); } else { log.warn("Parse form data error: {}", element); } } } return bodyMap; }
DssRestActorFormDataService extends AbstractDssRestActorService<HashMap<String, Object>> { @SuppressWarnings("unchecked") @Override protected final HashMap<String, Object> getBody(String content) { if (StringUtils.isEmpty(content)) { return new HashMap<>(); } final String[] splits = content.split("&"); final HashMap<String, Object> bodyMap = new HashMap<>(splits.length); for (int i = 0; i < splits.length; i++) { final String element = splits[i]; if (!StringUtils.isEmpty(element)) { final String[] formData = element.split("="); if (formData.length == 2) { final String name = formData[0]; final String preValue = formData[1]; bodyMap.put(name, preValue); } else { log.warn("Parse form data error: {}", element); } } } return bodyMap; } }
DssRestActorFormDataService extends AbstractDssRestActorService<HashMap<String, Object>> { @SuppressWarnings("unchecked") @Override protected final HashMap<String, Object> getBody(String content) { if (StringUtils.isEmpty(content)) { return new HashMap<>(); } final String[] splits = content.split("&"); final HashMap<String, Object> bodyMap = new HashMap<>(splits.length); for (int i = 0; i < splits.length; i++) { final String element = splits[i]; if (!StringUtils.isEmpty(element)) { final String[] formData = element.split("="); if (formData.length == 2) { final String name = formData[0]; final String preValue = formData[1]; bodyMap.put(name, preValue); } else { log.warn("Parse form data error: {}", element); } } } return bodyMap; } DssRestActorFormDataService(String name, String path, DssRestMethodType methodType); }
DssRestActorFormDataService extends AbstractDssRestActorService<HashMap<String, Object>> { @SuppressWarnings("unchecked") @Override protected final HashMap<String, Object> getBody(String content) { if (StringUtils.isEmpty(content)) { return new HashMap<>(); } final String[] splits = content.split("&"); final HashMap<String, Object> bodyMap = new HashMap<>(splits.length); for (int i = 0; i < splits.length; i++) { final String element = splits[i]; if (!StringUtils.isEmpty(element)) { final String[] formData = element.split("="); if (formData.length == 2) { final String name = formData[0]; final String preValue = formData[1]; bodyMap.put(name, preValue); } else { log.warn("Parse form data error: {}", element); } } } return bodyMap; } DssRestActorFormDataService(String name, String path, DssRestMethodType methodType);  }
DssRestActorFormDataService extends AbstractDssRestActorService<HashMap<String, Object>> { @SuppressWarnings("unchecked") @Override protected final HashMap<String, Object> getBody(String content) { if (StringUtils.isEmpty(content)) { return new HashMap<>(); } final String[] splits = content.split("&"); final HashMap<String, Object> bodyMap = new HashMap<>(splits.length); for (int i = 0; i < splits.length; i++) { final String element = splits[i]; if (!StringUtils.isEmpty(element)) { final String[] formData = element.split("="); if (formData.length == 2) { final String name = formData[0]; final String preValue = formData[1]; bodyMap.put(name, preValue); } else { log.warn("Parse form data error: {}", element); } } } return bodyMap; } DssRestActorFormDataService(String name, String path, DssRestMethodType methodType);   }