use of lee.study.down.mvc.form.TaskInfoForm in project proxyee-down by monkeyWie.
the class DownContent method setUrl.
public static List<TaskInfoForm> setUrl(List<TaskInfo> taskInfoList) {
List<TaskInfoForm> ret = new ArrayList<>();
for (TaskInfo taskInfo : taskInfoList) {
TaskInfoForm taskInfoForm = new TaskInfoForm();
BeanUtils.copyProperties(taskInfo, taskInfoForm);
HttpRequestInfo httpRequest = (HttpRequestInfo) ContentManager.DOWN.getDownInfo(taskInfo.getId()).getRequest();
String uri = httpRequest.uri();
String host = httpRequest.requestProto().getHost();
String url = (uri.indexOf("/") == 0 ? host : "") + uri;
if (url.indexOf("http://") != 0 && url.indexOf("https://") != 0) {
url = (httpRequest.requestProto().getSsl() ? "https://" : "http://") + url;
}
taskInfoForm.setUrl(url);
ret.add(taskInfoForm);
}
return ret;
}
Aggregations