Message Boards

Get themeDisplay object from rest module

Nikita Laitinen, modified 3 Years ago.

Get themeDisplay object from rest module

Junior Member Posts: 44 Join Date: 12/18/19 Recent Posts
Hello! Could you help me please
I have a problem with getting themeDisplay object from rest liferay module.

@GET
@Path("/evening")
@Produces("text/plain")
public String helloevening() {
// Here I need to get themeDisplay object
return "Good evening!";
}

I need it to get analyticsScripts from the Configuration -> site settings ->  Advanced -> Analytics section. Get them all and return them as a response of rest call.
Any ideas?
​​​​​​​
Thank you!
thumbnail
Mohammed Yasin, modified 3 Years ago.

RE: Get themeDisplay object from rest module

Liferay Master Posts: 591 Join Date: 8/8/14 Recent Posts
Hi,
Can you pls let us know the reason for themeDisplay Object in Rest ? , Also if your looking for User or Request related objects you can check out the below link it might help you 
https://liferay.dev/blogs/-/blogs/rest-custom-context-providers
Nikita Laitinen, modified 3 Years ago.

RE: Get themeDisplay object from rest module

Junior Member Posts: 44 Join Date: 12/18/19 Recent Posts
the reason is following
User click on a button on the website and I want to get some script from Configuration -> site settings ->  Advanced -> Analytics section and paste it in the header section of HTML
 
thumbnail
Olaf Kock, modified 3 Years ago.

RE: Get themeDisplay object from rest module

Liferay Legend Posts: 6396 Join Date: 9/23/08 Recent Posts
Nikita Laitinen:

I have a problem with getting themeDisplay object from rest liferay module.
...
I need it to get analyticsScripts from the Configuration -> site settings ->  Advanced -> Analytics section. Get them all and return them as a response of rest call.

There's your actual question: You need the configuration values, not the ThemeDisplay.
I'd check the module that holds this configuration, see what's exported and what API is available.
You can either load the same configuration if everything is exported (e.g. by referencing it with the name it's registered) or access the API to query for the values you need.
ThemeDisplay is a concept for pages served by Liferay - and a REST call is not for a page, has no theme, etc - thus the subject clearly points to a XY-Problem that you shouldn't persue any longer.
Nikita Laitinen, modified 3 Years ago.

RE: Get themeDisplay object from rest module

Junior Member Posts: 44 Join Date: 12/18/19 Recent Posts
Good ideas!

I noticed that these scripts are loaded in html -> common -> themes - > top_js.jsp. The start point is layout object and I thought I can use ThemeDisplay to get layout and then achieve scripts like it is described in that file