Commit 8e6d33a7 authored by Matija Obreza's avatar Matija Obreza

Fixed URL shortener bug: 'columns' cookie is no longer required

parent bbfd3c93
......@@ -166,7 +166,7 @@ public class ExplorerController extends BaseController implements InitializingBe
public String viewFiltered(HttpServletResponse response, ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "filter", required = true, defaultValue = "{}") String jsonFilter,
@RequestParam(value = "columns", required = true, defaultValue = "") String[] columns,
@CookieValue(value = "columns", defaultValue = "") String[] cookieColumns) throws IOException {
@CookieValue(value = "columns", required=false) String[] cookieColumns) throws IOException {
String[] selectedFilters = null;
......@@ -206,7 +206,7 @@ public class ExplorerController extends BaseController implements InitializingBe
if (_logger.isDebugEnabled()) {
_logger.debug("Got: " + accessions);
}
model.addAttribute("availableColumns", validDisplayColumns);
model.addAttribute("selectedColumns", cleanupDisplayColumns(columns, cookieColumns, response));
......@@ -578,8 +578,8 @@ public class ExplorerController extends BaseController implements InitializingBe
}
@RequestMapping(value = "/explore/overview")
public String overview(ModelMap model, @RequestParam(value = "filter", required = false, defaultValue = "{}") String jsonFilter) throws IOException,
SearchException {
public String overview(ModelMap model, @RequestParam(value = "filter", required = false, defaultValue = "{}") String jsonFilter)
throws IOException, SearchException {
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
String[] selectedFilters = appliedFilters.getFilterNames();
......@@ -639,14 +639,19 @@ public class ExplorerController extends BaseController implements InitializingBe
@RequestMapping(value = "/explore/shorten-url", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Object getBriefURL(@RequestParam(value = "filter", required = false, defaultValue = "") String jsonFilter,
@RequestParam(value = "page", required = false, defaultValue = "1") int page, @CookieValue(value = "columns") String columns) throws IOException,
URISyntaxException {
@RequestParam(value = "page", required = false, defaultValue = "1") int page, @CookieValue(required = false, value = "columns") String columns)
throws IOException, URISyntaxException {
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
URI longUrl = new URIBuilder(baseUrl).setPath("/explore").addParameter("filter", appliedFilters.toString())
.addParameter("page", Integer.toString(page)).addParameter("columns", columns).build();
URIBuilder uriBuilder = new URIBuilder(baseUrl).setPath("/explore").addParameter("filter", appliedFilters.toString()).addParameter("page",
Integer.toString(page));
if (StringUtils.isNotBlank(columns)) {
uriBuilder.addParameter("columns", columns);
}
URI longUrl = uriBuilder.build();
final String shortenedUrl = urlShortenerService.shortenUrl(longUrl.toURL());
return new Object() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment