How to create a new web resource


#1

I want to create a new web resource with the existing one in openGamma.
So with all the reources like localhost:8080/jax/timeseries/DBhts~124 , i want to add a web resource of my own.
May be something like
localhost:8080/jax/reports/
I saw the WebAllHistoricalTimeSeriesResource class file and was hoping to make something like that in example project.
Is this possible ?

Thanks
Vineeth


#2

I’ve added a page of documentation to address this
http://docs.opengamma.com/display/DOC/Writing+a+custom+Web+resource

Let me know if it helps or needs further detail.


#3

Hello @Stephen ,
According to the wiki , i created a new package and a class for handling my resource and placed it in OG-Example.

Class i wrote - https://gist.github.com/2360788

Then i extended WebsiteBasicsComponentFactory to create CustomBasicsComponentFactory.

CODE - https://gist.github.com/2360978

Config change - Made the following change in config/fullstack/example.ini
factory = com.opengamma.web.reports.CustomWebsiteBasicsComponentFactory

I ran ant build and then jetty-debug.
and i got the required result at localhost:8080/jax/reports

Let me know if there is a better way to do it.
Otherwise the wiki is just fine.

Thanks
Vineeth


#4

@Vineeth, the code you wrote is fine.

Personally, I would recommend writing a new component factory rather than subclassing the standard one. (Subclassing is useful when the change is a variation on existing functionality - in your case you are adding new/separate functionality so a new factory makes sense). Adding a new factory simply means adding a new section in the INI file that you have already changed.