@RequestMapping(value = "/Users", produces = "application/json", consumes = "application/json", method = POST) public RestEntity writeEntry(@RequestBody RestUser user, HttpServletRequest request) throws RestException { RequestContext requestContext = ControllerUtil.getRequestContext(request); if(requestContext.isSecure()) { if(StringUtils.stringNotEmpty(user.getUsername()) && StringUtils.stringNotEmpty(user.getAllowedHost()) && StringUtils.stringNotEmpty(user.getPassword())) { try { userManager.addUser(requestContext.getUserSession(), user.getUsername(), user.getAllowedHost(), user.getPassword()); return new RestUser(user.getUsername(), user.getAllowedHost(), null); } catch(JasDBStorageException e) { LOG.error("", e); throw new RestException("Unable to create user", e); } } else { throw new RestException("Incomplete user details"); } } else { throw new RestException("Unable to create user, unsecure connection"); } }