java - Liferay : How to get user profilePicURL without ThemeDisplay in serviceImpl classes? -


i want user's profilepicurl in web-service call.
i have userid of user.
this trying

public string getprofilepicurl(long userid) throws systemexception,         portalexception {     string url = "";      servicecontext servicecontext = servicecontextthreadlocal             .getservicecontext();     themedisplay themedisplay = servicecontext.getthemedisplay();      user user = userlocalserviceutil.getuser(userid);      try {         url = user.getportraiturl(themedisplay);     } catch (portalexception e) {         // todo auto-generated catch block         e.printstacktrace();     } {         return url;     } } 

when did system.out.println(themedisplay), came out null
i don't know other way of achieving this.

what should change ?

you can useuserconstants.getportraiturl(imagepath, male, portraitid); userconstants class of liferay.


Comments