[DEV] better cache management
This commit is contained in:
parent
e421ead4ab
commit
a4f6dd5756
@ -25,6 +25,9 @@ public class Front {
|
||||
String extention = getExtension(filePathName);
|
||||
String mineType = null;
|
||||
System.out.println("try retrive : '" + filePathName + "' '" + extention + "'");
|
||||
CacheControl cc = new CacheControl();
|
||||
cc.setMaxAge(3600);
|
||||
cc.setNoCache(false);
|
||||
if (extention.length() !=0 && extention.length() <= 5) {
|
||||
if (extention.equalsIgnoreCase("jpg") || extention.equalsIgnoreCase("jpeg")) {
|
||||
mineType = "image/jpeg";
|
||||
@ -37,15 +40,23 @@ public class Front {
|
||||
} else if (extention.equalsIgnoreCase("webp")) {
|
||||
mineType = "image/webp";
|
||||
} else if (extention.equalsIgnoreCase("js")) {
|
||||
cc.setMaxAge(1);
|
||||
cc.setNoCache(true);
|
||||
mineType = "application/javascript";
|
||||
} else if (extention.equalsIgnoreCase("json")) {
|
||||
mineType = "application/json";
|
||||
cc.setMaxAge(1);
|
||||
cc.setNoCache(true);
|
||||
} else if (extention.equalsIgnoreCase("ico")) {
|
||||
mineType = "image/x-icon";
|
||||
} else if (extention.equalsIgnoreCase("html")) {
|
||||
mineType = "text/html";
|
||||
cc.setMaxAge(1);
|
||||
cc.setNoCache(true);
|
||||
} else if (extention.equalsIgnoreCase("css")) {
|
||||
mineType = "text/css";
|
||||
cc.setMaxAge(1);
|
||||
cc.setNoCache(true);
|
||||
} else {
|
||||
return Response.status(403).
|
||||
entity("Not supported model: '" + fileName + "'").
|
||||
@ -68,9 +79,6 @@ public class Front {
|
||||
ResponseBuilder response = Response.ok((Object)download);
|
||||
// use this if I want to download the file:
|
||||
//response.header("Content-Disposition", "attachment; filename=" + fileName);
|
||||
CacheControl cc = new CacheControl();
|
||||
cc.setMaxAge(60);
|
||||
cc.setNoCache(false);
|
||||
response.cacheControl(cc);
|
||||
response.type(mineType);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||
|
||||
export const environment = {
|
||||
const environment_local = {
|
||||
production: false,
|
||||
// URL of development API
|
||||
applName: "karideo",
|
||||
@ -19,7 +19,7 @@ export const environment = {
|
||||
apiMode: 'REWRITE'
|
||||
};
|
||||
|
||||
export const environment_kjlkjlkjlkj = {
|
||||
const environment_hybrid = {
|
||||
production: false,
|
||||
// URL of development API
|
||||
applName: "karideo",
|
||||
@ -28,9 +28,12 @@ export const environment_kjlkjlkjlkj = {
|
||||
karideo: 'http://192.168.1.156/karideo/api',
|
||||
karauth: 'http://192.168.1.156/karauth/api',
|
||||
},
|
||||
ssoSignIn: 'http://localhost:4200/signin/karideo-dev/',
|
||||
ssoSignUp: 'http://localhost:4200/signup/karideo-dev/',
|
||||
ssoSignOut: 'http://localhost:4200/signout/karideo-dev/',
|
||||
ssoSignIn: 'http://192.168.1.156/karso/signin/karideo-dev/',
|
||||
ssoSignUp: 'http://192.168.1.156/karso/signup/karideo-dev/',
|
||||
ssoSignOut: 'http://192.168.1.156/karso/signout/karideo-dev/',
|
||||
frontBaseUrl: '',
|
||||
apiMode: 'REWRITE'
|
||||
};
|
||||
|
||||
|
||||
export const environment = environment_hybrid;
|
Loading…
x
Reference in New Issue
Block a user