java - Serving different CSS based on user ID - spring mvc -


i have web app developed spring-mvc. every company have admin able edit backgrounds, fonts , colors. app should store color settings( in database or in css file ?) , should use preferred css users belonging same company. different companies see different css.

what best approach achieve that: serving different css based on user id.

you can try code csscontroller mapping method serving css

@requestmapping(value = "/mycustom.css")     public @responsebody     byte[] getmessages(final httpsession session,  final principal principal) {         stringbuffer sb = new stringbuffer("");         sb.append("/* css*/");         return sb.tostring().getbytes(charset.forname("iso-8859-1"));  } 

and optionnaly @cacheable if need access db build css.to not have fetch data on every page.

and include :

<link href="/mycustom.css" rel="stylesheet"> 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -