use of com.networknt.portal.usermanagement.model.common.exception.NoSuchUserException in project light-portal by networknt.
the class UserTokenIdGetHandler method handleRequest.
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
String id = exchange.getQueryParameters().get("id").getFirst();
String result = null;
try {
User user = service.confirmEmail(id);
if (user == null) {
result = "no user active by the token";
} else {
result = "user active: " + user.getScreenName();
}
} catch (NoSuchUserException e) {
result = "no Such User";
}
exchange.getResponseHeaders().add(new HttpString("Content-Type"), "application/json");
exchange.getResponseSender().send(Config.getInstance().getMapper().writeValueAsString(result));
// exchange.endExchange();
}
Aggregations