37 lines
1.3 KiB
Java
37 lines
1.3 KiB
Java
package com.mycompany.myapp.web.rest.util;
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
/**
|
|
* Utility class for HTTP headers creation.
|
|
*
|
|
*/
|
|
public class HeaderUtil {
|
|
|
|
public static HttpHeaders createAlert(String message, String param) {
|
|
HttpHeaders headers = new HttpHeaders();
|
|
headers.add("X-sampleApplicationApp-alert", message);
|
|
headers.add("X-sampleApplicationApp-params", param);
|
|
return headers;
|
|
}
|
|
|
|
public static HttpHeaders createEntityCreationAlert(String entityName, String param) {
|
|
return createAlert("sampleApplicationApp." + entityName + ".created", param);
|
|
}
|
|
|
|
public static HttpHeaders createEntityUpdateAlert(String entityName, String param) {
|
|
return createAlert("sampleApplicationApp." + entityName + ".updated", param);
|
|
}
|
|
|
|
public static HttpHeaders createEntityDeletionAlert(String entityName, String param) {
|
|
return createAlert("sampleApplicationApp." + entityName + ".deleted", param);
|
|
}
|
|
|
|
public static HttpHeaders createFailureAlert(String entityName, String errorKey, String defaultMessage) {
|
|
HttpHeaders headers = new HttpHeaders();
|
|
headers.add("X-sampleApplicationApp-error", "error." + errorKey);
|
|
headers.add("X-sampleApplicationApp-params", entityName);
|
|
return headers;
|
|
}
|
|
}
|