List of usage examples for com.amazonaws.services.polly.model DescribeVoicesResult getNextToken
public String getNextToken()
The pagination token to use in the next request to continue the listing of voices.
From source file:com.github.gregwhitaker.awspolly.example.PollyVoicesHandler.java
License:Apache License
@Override public void handle(Context ctx) throws Exception { String token = null;//from ww w . jav a2 s .c o m List<Voice> voices = new ArrayList<>(); while (true) { DescribeVoicesResult result; if (token == null) { result = polly.describeVoices(new DescribeVoicesRequest()); } else { result = polly.describeVoices(new DescribeVoicesRequest().withNextToken(token)); } voices.addAll(result.getVoices()); if (result.getNextToken() != null) { token = result.getNextToken(); } else { ctx.render(Jackson.toJsonString(voices)); break; } } }