Skip to content

Commit

Permalink
Ajout des redirections pour 3 services + maj images du Dockerfile ver…
Browse files Browse the repository at this point in the history
…s java 17
  • Loading branch information
julg committed Feb 19, 2024
1 parent 160ba4f commit c29d2f5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###
# Image pour la compilation
FROM maven:3-eclipse-temurin-11 as build-image
FROM maven:3-eclipse-temurin-17 as build-image
WORKDIR /build/
# Installation et configuration de la locale FR
RUN apt update && DEBIAN_FRONTEND=noninteractive apt -y install locales
Expand Down Expand Up @@ -28,7 +28,7 @@ RUN mvn --batch-mode -e \
###
# Image pour le module theses-export

FROM eclipse-temurin:11-jre as api-export-image
FROM eclipse-temurin:17-jre as api-export-image
WORKDIR /app/
COPY --from=build-image /build/target/*.jar /app/theses-api-export.jar
ENTRYPOINT exec java $JAVA_OPTS -jar /app/theses-api-export.jar
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package fr.abes.theses.export.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.URI;

@Slf4j
@RestController
@RequestMapping("/")
public class RedirectionController {

@Value("${racine}")
String racine;

@GetMapping(value = "{nnt}.xml")
public ResponseEntity<Void> redirectXML(@PathVariable String nnt){

return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY).location(URI.create(racine + "/api/v1/theses/export/xml/" + nnt)).build();
}

@GetMapping(value = "{nnt}.rdf")
public ResponseEntity<Void> redirectRDF(@PathVariable String nnt){

return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY).location(URI.create(racine + "/api/v1/theses/export/rdf/" + nnt)).build();
}

@GetMapping(value = "{nnt}.tefudoc")
public ResponseEntity<Void> redirectTefudoc(@PathVariable String nnt){

return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY).location(URI.create(racine + "/api/v1/theses/export/tefudoc/" + nnt)).build();
}
}
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ spring.datasource.hikari.readOnly=true
path.xsls=

logging.level.fr.abes=
racine=

0 comments on commit c29d2f5

Please sign in to comment.