/** * Change connection configuration. * * @param req HTTP request * @param id forward id to change * @return service response. */ @POST @Path("connection/update/{id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public ServiceResponse updateConnection( @Context HttpServletRequest req, @PathParam("id") String id, Connection forwardReq) { Configuration cfg = getEditConfiguration(req); for (Connection account : cfg.getConnection()) { if (account.getId().equals(id)) { account.setName(forwardReq.getName()); account.setHost(forwardReq.getHost()); account.setPort(forwardReq.getPort()); account.setUser(forwardReq.getUser()); account.setPassword( forwardReq.getPassword().endsWith("==") ? forwardReq.getPassword() : DrillServer.getEncDecorder().encrypt(forwardReq.getPassword())); account.setProxy(forwardReq.getProxy()); return ServiceUtils.createOKResponse("Connection changed"); } } return ServiceUtils.createOKResponse("Connection not found: " + id); }