Skip to content

Commit 106e52e

Browse files
committed
returning content-type for robots.txt
1 parent dfe8b8b commit 106e52e

File tree

1 file changed

+15
-11
lines changed
  • curation-web/src/main/java/eu/clarin/cmdi/curation/web/controller

1 file changed

+15
-11
lines changed

curation-web/src/main/java/eu/clarin/cmdi/curation/web/controller/CurateCtl.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
import org.apache.commons.io.FileUtils;
1414
import org.springframework.beans.factory.annotation.Autowired;
1515
import org.springframework.http.MediaType;
16+
import org.springframework.http.ResponseEntity;
1617
import org.springframework.stereotype.Controller;
1718
import org.springframework.ui.Model;
1819
import org.springframework.web.bind.annotation.GetMapping;
1920
import org.springframework.web.bind.annotation.PostMapping;
2021
import org.springframework.web.bind.annotation.RequestMapping;
2122
import org.springframework.web.bind.annotation.RequestParam;
22-
import org.springframework.web.bind.annotation.ResponseBody;
2323
import org.springframework.web.multipart.MultipartFile;
2424

2525
import java.io.IOException;
@@ -233,15 +233,19 @@ private Path curate(Path inFilePath) {
233233
* @return the robots txt
234234
*/
235235
@GetMapping("/robots.txt")
236-
@ResponseBody
237-
public String getRobotsTxt() {
238-
return """
239-
User-agent: *
240-
Disallow: /download
241-
Disallow: /record
242-
243-
User-agent: CLARIN Linkchecker: https://www.clarin.eu/linkchecker
244-
Allow: /
245-
""";
236+
public ResponseEntity<String> getRobotsTxt() {
237+
return ResponseEntity
238+
.ok()
239+
.contentType(MediaType.TEXT_PLAIN)
240+
.body(
241+
"""
242+
User-agent: *
243+
Disallow: /download
244+
Disallow: /record
245+
246+
User-agent: CLARIN Linkchecker: https://www.clarin.eu/linkchecker
247+
Allow: /
248+
"""
249+
);
246250
}
247251
}

0 commit comments

Comments
 (0)