@@ -21,19 +21,24 @@ public class JShellController {
2121 public JShellResult eval (@ PathVariable String id , @ RequestBody String code ) throws DockerException {
2222 validateId (id );
2323 if (code == null ) throw new ResponseStatusException (HttpStatus .BAD_REQUEST , "Code is null" );
24- return service .sessionById (id ).eval (code ).orElseThrow (() -> new ResponseStatusException (HttpStatus .CONFLICT , "An operation is already running" ));
24+ return service .session (id ).eval (code ).orElseThrow (() -> new ResponseStatusException (HttpStatus .CONFLICT , "An operation is already running" ));
2525 }
2626 @ PostMapping ("/eval" )
2727 public JShellResultWithId eval (@ RequestBody String code ) throws DockerException {
28- JShellService jShellService = service .oneTimeSession ();
28+ JShellService jShellService = service .session ();
2929 return new JShellResultWithId (jShellService .id (), jShellService .eval (code ).orElseThrow (() -> new ResponseStatusException (HttpStatus .CONFLICT , "An operation is already running" )));
3030 }
31+ @ PostMapping ("/single-eval" )
32+ public JShellResult singleEval (@ RequestBody String code ) throws DockerException {
33+ JShellService jShellService = service .oneTimeSession ();
34+ return jShellService .eval (code ).orElseThrow (() -> new ResponseStatusException (HttpStatus .CONFLICT , "An operation is already running" ));
35+ }
3136
3237 @ GetMapping ("/snippets/{id}" )
3338 public List <String > snippets (@ PathVariable String id ) throws DockerException {
3439 validateId (id );
3540 if (!service .hasSession (id )) throw new ResponseStatusException (HttpStatus .NOT_FOUND , "Id " + id + " not found" );
36- return service .sessionById (id ).snippets ().orElseThrow (() -> new ResponseStatusException (HttpStatus .CONFLICT , "An operation is already running" ));
41+ return service .session (id ).snippets ().orElseThrow (() -> new ResponseStatusException (HttpStatus .CONFLICT , "An operation is already running" ));
3742 }
3843
3944 @ DeleteMapping ("/{id}" )
0 commit comments