Have you ever seen some html content in a Liferay page and wondered what JSP rendered that content? You can use JSP Spy to find out. If you have heard enough, just to the How to use it section.
For those that are interested, this repo contains:
- An OSGi HTTP Whiteboard servlet filter that is specially crafted HT: @rotty3000 to intercept every JSP include dispatch in the Liferay framework and injects some inert HTML markup.
- Some small configuration that is required for Liferay Portal.
- A simple WebExtension that listens to Elements panel selection and displays the estimated JSP that rendered that node. This is not going to be correct 100% of the time and may require a little sleuthing through the nearby DOM. I hope to improve this and am welcoming contributions.
In order to use this the following 3 things are needed
- Set the following in your
portal-ext.properties
include-and-override=portal-developer.properties
direct.servlet.context.enabled=false
- Build and deploy the jsp-spy module
- Build the Chrome extension
- Install the Chrome Extension in developer module.
- Clone this Git repository
- Install blade and yarn if you don't have them already.
- Make sure you are using Java 1.8.x, you can check by running
java -version
. - Run
blade server init
- Run
blade server run
- Run
blade deploy
- Run
cd modules/jsp-spy-extension
- Run
yarn install
- Run
yarn dev chrome
- If you are using Chrome, go to chrome://extensions
- Enable developer mode (right hand side)
- Select "load unpacked" and browse to
modules/jsp-spy-extension/dist/chrome
folder - Open portal page, then open Chrome Devtools
Cmd+Option+I
- Use element selection to select a DOM element on the page
- On Elements Sidebar click the JSP Spy pane.