com.sippnex.fileblade.controller.DirectoryController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fileblade-server Show documentation
Show all versions of fileblade-server Show documentation
Server-side Spring library for fileblade. A web filemanager
package com.sippnex.fileblade.controller;
import com.sippnex.fileblade.domain.FbDirectory;
import com.sippnex.fileblade.domain.FbElement;
import com.sippnex.fileblade.service.DirectoryService;
import com.sippnex.fileblade.util.PathUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Set;
@RestController
@RequestMapping("/fileblade/directories")
public class DirectoryController {
private final DirectoryService directoryService;
public DirectoryController(DirectoryService directoryService) {
this.directoryService = directoryService;
}
@GetMapping("**")
public Set readDirectory(HttpServletRequest request) throws IOException {
String pathString = PathUtils.getPathFromRequest(request);
return directoryService.readDirectory(new FbDirectory(pathString));
}
@PostMapping("**")
public void createDirectory(HttpServletRequest request) throws IOException {
String pathString = PathUtils.getPathFromRequest(request);
directoryService.createDirectory(new FbDirectory(pathString));
}
}