Search in sources :

Example 21 with TaskInfo

use of lee.study.down.model.TaskInfo in project proxyee-down by monkeyWie.

the class OpenController method open.

@RequestMapping("createTask")
public ResultInfo open(@RequestBody CreateTaskForm createTaskForm) throws Exception {
    ResultInfo resultInfo = HttpDownController.commonBuildTask(createTaskForm.getRequest());
    if (resultInfo.getStatus() == ResultStatus.SUCC.getCode()) {
        TaskInfo taskInfo = ContentManager.DOWN.getTaskInfo(resultInfo.getData().toString());
        NewTaskForm taskForm = new NewTaskForm();
        taskForm.setId(taskInfo.getId());
        if (!StringUtils.isEmpty(createTaskForm.getFileName())) {
            taskForm.setFileName(createTaskForm.getFileName());
        } else {
            taskForm.setFileName(taskInfo.getFileName());
        }
        if (!StringUtils.isEmpty(taskInfo.getFilePath())) {
            taskForm.setFilePath(taskInfo.getFilePath());
        } else {
            taskForm.setFilePath(createTaskForm.getFilePath());
        }
        taskForm.setUnzip(createTaskForm.getUnzipFlag() == 1);
        taskForm.setUnzipPath(createTaskForm.getUnzipPath());
        taskForm.setConnections(createTaskForm.getConnections());
        resultInfo = HttpDownController.commonStartTask(taskForm);
    }
    return resultInfo;
}
Also used : TaskInfo(lee.study.down.model.TaskInfo) NewTaskForm(lee.study.down.mvc.form.NewTaskForm) ResultInfo(lee.study.down.model.ResultInfo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

TaskInfo (lee.study.down.model.TaskInfo)21 HttpDownInfo (lee.study.down.model.HttpDownInfo)6 ResultInfo (lee.study.down.model.ResultInfo)6 AbstractHttpDownBootstrap (lee.study.down.boot.AbstractHttpDownBootstrap)5 ChunkInfo (lee.study.down.model.ChunkInfo)5 HttpRequestInfo (lee.study.down.model.HttpRequestInfo)5 IOException (java.io.IOException)4 BootstrapException (lee.study.down.exception.BootstrapException)4 WsForm (lee.study.down.mvc.form.WsForm)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 HttpResponse (io.netty.handler.codec.http.HttpResponse)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 Channel (io.netty.channel.Channel)2 HttpContent (io.netty.handler.codec.http.HttpContent)2 MalformedURLException (java.net.MalformedURLException)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 TimeoutException (java.util.concurrent.TimeoutException)2 HttpDownCallback (lee.study.down.dispatch.HttpDownCallback)2