Skip to content

Commit

Permalink
corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
khergalant committed Sep 4, 2024
1 parent 7fc5857 commit 737cb15
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,24 @@ public class LaunchAppConfig implements ApplicationListener<ContextRefreshedEven
@Value("${limesurvey.path:}")
private transient String urlLS;

@Value("#{'${ws.apogee.header.etudiantMetier}'.split('" + ConstanteUtils.WS_APOGEE_HEADER_DELIMITER + "')}")
@Value("#{'${ws.apogee.header.etudiantMetier:}'.split('" + ConstanteUtils.WS_APOGEE_HEADER_DELIMITER + "')}")
private List<String> wsApogeeHeaderEtudiantMetier;

@Value("#{'${ws.apogee.header.pj}'.split('" + ConstanteUtils.WS_APOGEE_HEADER_DELIMITER + "')}")
@Value("#{'${ws.apogee.header.pedagogiqueMetier:}'.split('" + ConstanteUtils.WS_APOGEE_HEADER_DELIMITER + "')}")
private List<String> wsApogeeHeaderPedagogiqueMetier;

@Value("#{'${ws.apogee.header.opiMetier:}'.split('" + ConstanteUtils.WS_APOGEE_HEADER_DELIMITER + "')}")
private List<String> wsApogeeHeaderOpiMetier;

@Value("#{'${ws.apogee.header.pjOpiMetier:}'.split('" + ConstanteUtils.WS_APOGEE_HEADER_DELIMITER + "')}")
private List<String> wsApogeeHeaderPjOpiMetier;

@Value("#{'${ws.apogee.header.pj:}'.split('" + ConstanteUtils.WS_APOGEE_HEADER_DELIMITER + "')}")
private List<String> wsApogeeHeaderPj;

@Value("#{'${ws.apogee.header.checkInes:}'.split('" + ConstanteUtils.WS_APOGEE_HEADER_DELIMITER + "')}")
private List<String> wsApogeeHeaderCheckInes;

@Override
public void onApplicationEvent(final ContextRefreshedEvent event) {
preprocessLimesurvey();
Expand Down Expand Up @@ -224,8 +236,12 @@ private void preprocessConfigUrlServicesLocation() {
/* On tente d'ajouter les headers de services eventuellement contenus dans le fichier de properties
* (on peut aussi les ajouter directement dans le fichierconfigUrlServices) */
addWsApoHeader(ConstanteUtils.WS_APOGEE_SERVICE_ETUDIANT_METIER, wsApogeeHeaderEtudiantMetier);

addWsApoHeader(ConstanteUtils.WS_APOGEE_SERVICE_PEDAGOGIQUE_METIER, wsApogeeHeaderPedagogiqueMetier);
addWsApoHeader(ConstanteUtils.WS_APOGEE_SERVICE_OPI_METIER, wsApogeeHeaderOpiMetier);
addWsApoHeader(ConstanteUtils.WS_APOGEE_SERVICE_PJ_OPI_METIER, wsApogeeHeaderPjOpiMetier);
addWsApoHeader(ConstanteUtils.WS_APOGEE_SERVICE_PJ, wsApogeeHeaderPj);
addWsApoHeader(ConstanteUtils.WS_APOGEE_SERVICE_CHECKINES, wsApogeeHeaderCheckInes);

} catch (final Exception e) {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,24 @@ public class SiScolRestUtils {

/**
* @param path
* @param service
* @param mapGetParameter
* @return l'uri du service demandé
* @return le path formaté
*/
public static URI getURIForService(final String path, final String service, final MultiValueMap<String, String> mapGetParameter) {
private static String formatPath(final String path) {
String finalPath = path;
if (!finalPath.endsWith("/")) {
finalPath = finalPath + "/";
}
return UriComponentsBuilder.fromUriString(finalPath).path(service).queryParams(mapGetParameter).build().encode().toUri();
return finalPath;
}

/**
* @param path
* @param service
* @param mapGetParameter
* @return l'uri du service demandé
*/
public static URI getURIForService(final String path, final String service, final MultiValueMap<String, String> mapGetParameter) {
return UriComponentsBuilder.fromUriString(formatPath(path)).path(service).queryParams(mapGetParameter).build().encode().toUri();
}

/**
Expand Down Expand Up @@ -96,7 +104,12 @@ public static String getSubServiceWhithoutSlash(final String service, final Stri
*/
public static URI getURIForService(final String path, final String service, final Long offset, final Long limit, final MultiValueMap<String, String> mapGetParameter) {
final String myService = service + "/" + ConstanteUtils.PEGASE_OFFSET_PARAM + "/" + offset + "/" + ConstanteUtils.PEGASE_LIMIT_PARAM + "/" + limit;
return UriComponentsBuilder.fromUriString(path).path(myService).queryParams(mapGetParameter).build().encode().toUri();
/* Ajout d'un slash à la fin du path */
String finalPath = path;
if (!finalPath.endsWith("/")) {
finalPath = finalPath + "/";
}
return UriComponentsBuilder.fromUriString(formatPath(path)).path(myService).queryParams(mapGetParameter).build().encode().toUri();
}

/**
Expand All @@ -106,7 +119,7 @@ public static URI getURIForService(final String path, final String service, fina
* @return l'uri du service demandé
*/
public static URI getURIForService(final String path, final List<String> params) {
return UriComponentsBuilder.fromUriString(path).path(String.join("/", params)).build().encode().toUri();
return UriComponentsBuilder.fromUriString(formatPath(path)).path(String.join("/", params)).build().encode().toUri();
}

/**
Expand All @@ -115,7 +128,7 @@ public static URI getURIForService(final String path, final List<String> params)
* @return l'uri du service demandé
*/
public static URI getURIForService(final String path, final String service) {
return UriComponentsBuilder.fromUriString(path).path(service).build().encode().toUri();
return UriComponentsBuilder.fromUriString(formatPath(path)).path(service).build().encode().toUri();
}

/**
Expand Down

0 comments on commit 737cb15

Please sign in to comment.