This may not be the most elegant approach to adding our feature, to plug in but it does give you a map of the places in the source code where a new feature can be plugged in. It would be nice if eventually, we could come up with a way to do this exclusively with Guice and a small change to the web.xml file in the gadgets web.xml.
First we move into the feature directory:
Create a new directory named * learning* and put three files into it.
This creates our client code and defines three methods in the client. For now they are simple stubs to keep life simple.
This file names your feature and defines the source files to be loaded to provision the feature.
Then edit the file features.txt and add a line:
There is a way to update features.txt using a script, but for now, lets just plug in directly.
once it compiles and installs, start Jetty again
And navigate to http://localhost:8080/samplecontainer/samplecontainer.html
You should see the “Social Hello World” gadget. Now lets edit this file:
And add two lines:
When you change the gadget code you need to make sure that you trill get a fresh copy of the code. Given that different browsers and different browsers settings reload various bits at different time, you may need one or more of these:
- Press Refresh in the Browser
- Press the “Reset All” button
- Clear the browser history if all else fails and your changes don’t seem to be getting reloaded
When you have everything working, you should see the popup loaded as follows: