Skip to content

Commit

Permalink
Merge pull request #443 from EBISPOT/issue-417
Browse files Browse the repository at this point in the history
issue-417: set content-type header for search, select and suggest
  • Loading branch information
serjoshua authored Jul 27, 2023
2 parents b068bac + 2d89f00 commit ffc591b
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ public void search(
responseObj.put("response", responseBody);

response.getOutputStream().write(gson.toJson(responseObj).getBytes(StandardCharsets.UTF_8));
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.flushBuffer();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
Expand All @@ -27,8 +28,6 @@
import java.util.function.Function;
import java.util.stream.Collectors;

import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;

@Controller
public class V1SelectController {

Expand All @@ -40,7 +39,7 @@ public class V1SelectController {
@Autowired
private OlsSolrClient solrClient;

@RequestMapping(path = "/api/select", produces = {APPLICATION_JSON_VALUE}, method = RequestMethod.GET)
@RequestMapping(path = "/api/select", produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET)
public void select(
@RequestParam("q") String query,
@RequestParam(value = "ontology", required = false) Collection<String> ontologies,
Expand Down Expand Up @@ -205,6 +204,7 @@ public void select(
responseObj.put("highlighting", highlighting);

response.getOutputStream().write(gson.toJson(responseObj).getBytes(StandardCharsets.UTF_8));
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.flushBuffer();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.apache.solr.client.solrj.util.ClientUtils;
import org.apache.solr.common.SolrDocument;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
Expand All @@ -21,8 +22,6 @@
import java.nio.charset.StandardCharsets;
import java.util.*;

import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;

@Controller
public class V1SuggestController {

Expand All @@ -34,7 +33,7 @@ public class V1SuggestController {
@Autowired
private OlsSolrClient solrClient;

@RequestMapping(path = "/api/suggest", produces = {APPLICATION_JSON_VALUE}, method = RequestMethod.GET)
@RequestMapping(path = "/api/suggest", produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET)
public void suggest(
@RequestParam("q") String query,
@RequestParam(value = "ontology", required = false) Collection<String> ontologies,
Expand Down Expand Up @@ -106,6 +105,7 @@ public void suggest(
responseObj.put("response", responseBody);

response.getOutputStream().write(gson.toJson(responseObj).getBytes(StandardCharsets.UTF_8));
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.flushBuffer();
}

Expand Down
23 changes: 0 additions & 23 deletions frontend/ols/asset-manifest.json

This file was deleted.

Binary file removed frontend/ols/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion frontend/ols/index.html

This file was deleted.

Binary file removed frontend/ols/logo192.png
Binary file not shown.
Binary file removed frontend/ols/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions frontend/ols/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/ols/robots.txt

This file was deleted.

0 comments on commit ffc591b

Please sign in to comment.