Package io.jmix.graphql.controller
Class GraphQLFilesUploadController
java.lang.Object
io.leangen.graphql.spqr.spring.web.GraphQLController<org.springframework.web.context.request.NativeWebRequest>
io.jmix.graphql.controller.GraphQLFilesUploadController
@RestController("graphql_FilesController")
@CrossOrigin
public class GraphQLFilesUploadController
extends io.leangen.graphql.spqr.spring.web.GraphQLController<org.springframework.web.context.request.NativeWebRequest>
-
Field Summary
Modifier and TypeFieldDescriptionprotected AccessManager
protected FilePermissionService
protected FileTransferService
Fields inherited from class io.leangen.graphql.spqr.spring.web.GraphQLController
executor, graphQL
-
Constructor Summary
ConstructorDescriptionGraphQLFilesUploadController
(graphql.GraphQL graphQL, io.leangen.graphql.spqr.spring.web.mvc.GraphQLMvcExecutor executor) -
Method Summary
Modifier and TypeMethodDescriptionvoid
executeMultipartPost
(String operations, String map, String storageName, org.springframework.web.multipart.MultipartHttpServletRequest multiPartRequest, org.springframework.web.context.request.NativeWebRequest webRequest) For Requests that follow the GraphQL Multipart Request Spec from: https://github.com/jaydenseric/graphql-multipart-request-specorg.springframework.http.ResponseEntity<FileInfoResponse>
uploadFile
(javax.servlet.http.HttpServletRequest request, String name, String storageName) Method for simple file upload.org.springframework.http.ResponseEntity<FileInfoResponse>
uploadFile
(org.springframework.web.multipart.MultipartFile file, String name, String storageName, javax.servlet.http.HttpServletRequest request) Method for multipart file upload.Methods inherited from class io.leangen.graphql.spqr.spring.web.GraphQLController
executeFormPost, executeGet, executeGetEventStream, executeGraphQLPost, executeJsonPost, executeJsonPostEventStream, jsonPost
-
Field Details
-
filePermissionService
-
accessManager
-
fileTransferService
-
-
Constructor Details
-
GraphQLFilesUploadController
@Autowired public GraphQLFilesUploadController(graphql.GraphQL graphQL, io.leangen.graphql.spqr.spring.web.mvc.GraphQLMvcExecutor executor)
-
-
Method Details
-
executeMultipartPost
@PostMapping(value="${graphql.spqr.http.endpoint:/graphql}", consumes="multipart/form-data") @ResponseBody public Object executeMultipartPost(@RequestParam("operations") String operations, @RequestParam("map") String map, @RequestParam(value="storageName",required=false) String storageName, org.springframework.web.multipart.MultipartHttpServletRequest multiPartRequest, org.springframework.web.context.request.NativeWebRequest webRequest) throws Exception For Requests that follow the GraphQL Multipart Request Spec from: https://github.com/jaydenseric/graphql-multipart-request-specThe Request contains the following parts: operations: JSON String with the GQL Query map: Maps the multipart files to the variables of the GQL Query
- Throws:
Exception
-
checkFileUploadPermission
public void checkFileUploadPermission() -
uploadFile
@PostMapping(path="${graphql.spqr.http.endpoint:/graphql/files}", consumes="!multipart/form-data") public org.springframework.http.ResponseEntity<FileInfoResponse> uploadFile(javax.servlet.http.HttpServletRequest request, @RequestParam(required=false) String name, @RequestParam(required=false) String storageName) Method for simple file upload. File contents are placed in the request body. Optional file name parameter is passed as a query param. -
uploadFile
@PostMapping(path="${graphql.spqr.http.endpoint:/graphql/files}", consumes="multipart/form-data") public org.springframework.http.ResponseEntity<FileInfoResponse> uploadFile(@RequestParam("file") org.springframework.web.multipart.MultipartFile file, @RequestParam(required=false) String name, @RequestParam(required=false) String storageName, javax.servlet.http.HttpServletRequest request) Method for multipart file upload. It expects the file contents to be passed in the part called 'file'.
-