Skip to content

Commit

Permalink
gestion favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
khergalant committed Feb 14, 2024
1 parent f472859 commit a0b3221
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
16 changes: 16 additions & 0 deletions src/main/java/fr/univlorraine/ecandidat/AppServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,22 @@
*/
package fr.univlorraine.ecandidat;

import java.io.File;
import java.io.Serializable;
import java.util.Base64;
import java.util.Locale;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;

import org.apache.commons.io.FileUtils;
import org.atmosphere.cpr.ApplicationConfig;
import org.jsoup.nodes.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.vaadin.server.BootstrapFragmentResponse;
Expand All @@ -38,11 +42,13 @@
import com.vaadin.spring.server.SpringVaadinServlet;

import fr.univlorraine.ecandidat.utils.ConstanteUtils;
import fr.univlorraine.ecandidat.utils.MethodUtils;

/**
* Servlet principale.
* @author Adrien Colson
*/
@Configuration
@SuppressWarnings("serial")
@WebServlet(value = ConstanteUtils.SERVLET_ALL_MATCH,
asyncSupported = true,
Expand Down Expand Up @@ -99,6 +105,16 @@ public void modifyBootstrapPage(final BootstrapPageResponse response) {
head.appendElement("meta").attr("name", "viewport").attr("content", "width=device-width, initial-scale=1");
head.appendElement("meta").attr("name", "apple-mobile-web-app-capable").attr("content", "yes");
head.appendElement("meta").attr("name", "apple-mobile-web-app-status-bar-style").attr("content", "black");
final File fileExternal =
MethodUtils.getExternalResource(applicationContext.getEnvironment().getProperty("external.ressource"), ConstanteUtils.EXTERNAL_RESSOURCE_IMG_FOLDER, ConstanteUtils.EXTERNAL_RESSOURCE_IMG_FAV_FILE);
if (fileExternal != null) {
try {
final byte[] fileContent = FileUtils.readFileToByteArray(fileExternal);
final String encodedString = Base64.getEncoder().encodeToString(fileContent);
head.getElementsByAttributeValue("rel", "icon").attr("href", "data:image/x-icon;base64," + encodedString);
} catch (final Exception e) {
}
}
}

/** @see com.vaadin.server.BootstrapListener#modifyBootstrapFragment(com.vaadin.server.BootstrapFragmentResponse) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public KeyGenerator keyGenerator() {
sbKey.append("#" + param.toString());
}
}
System.out.println(sbKey.toString());
return sbKey.toString();
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ public class CandidatRest {
@Resource
private transient UserController userController;

/**
* sonde liveness
*/
@RequestMapping(value = "/liveness/{test}", method = RequestMethod.GET)
public String sondeLiveness(@PathVariable final String test) {
//return "OK";
System.out.println(test);
return test;
}

/**
* valide le compte
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ private void addMentionCnil() {

/** Met a jour la mention CNIL */
private void updateMentionCnil() {
System.out.println("1 " + configController.getConfigEtab());
final String mentionCnil = configController.getConfigEtab().getCnil();
if (StringUtils.isNotBlank(mentionCnil)) {
labelCnil.setValue(mentionCnil);
Expand Down

0 comments on commit a0b3221

Please sign in to comment.