Skip to content

Commit

Permalink
small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
GordeaS authored and GordeaS committed Jun 18, 2024
1 parent 037ec15 commit 09565e5
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public AnnotationPage search(Query query, HttpServletRequest request) throws Htt
}

// if current page is not the last one
boolean isLastPage = protocol.getTotalInCollection() <= (currentPage - Query.DEFAULT_PAGE + 1) * query.getPageSize();
final int nextPageStartIndex = (currentPage - Query.DEFAULT_PAGE + 1) * query.getPageSize();
boolean isLastPage = protocol.getTotalInCollection() <= nextPageStartIndex;
if (!isLastPage) {
String nextPage = buildPageUrl(collectionUrl, currentPage + 1, query.getPageSize());
protocol.setNextPageUri(nextPage);
Expand Down Expand Up @@ -147,18 +148,10 @@ private String buildCollectionUrl(Query query, HttpServletRequest request) {
queryString +=
("&" + WebAnnotationFields.PARAM_PROFILE + "=" + query.getSearchProfile().toString());

String result = configuration.getAnnoApiEndpoint() + "/search?";
String url = configuration.getAnnoApiEndpoint() + "/search?";
url += queryString;

// try {
// result += URLEncoder.encode(queryString, StandardCharsets.UTF_8.toString());
// } catch (UnsupportedEncodingException e) {
// logger.log(Level.ERROR, "The UnsupportedEncodingException during the URL encoding of the
// string.", e);
// result += queryString;
// }
result += queryString;

return result;
return url;
}

protected String removeParam(final String queryParam, String queryParams) {
Expand Down

0 comments on commit 09565e5

Please sign in to comment.