Open cxbrooks opened 12 years ago
RESTfulModelExporter
Actor similar to HTMLModelExporter, but would generate content specific to the request
Define RESTful naming strategy. Comments from Prof. Lee below. e.g. /myService to run whole model and exporter all contents, /myService/graph1 would produce HTML for only graph1 /myService/graph2
It would implement the WebExporter interface (take a look at ExportHTMLAction). Class diagram in /org/ptolemy/ptango/doc
First version outputs complete page, second will output elements Version 1:
Input port for the URL
Output port – would output HTML similar HTMLModelExporter - outputs complete web page
Version 2:
Input port for the URL
Output port for scripts, type array of XMLToken. These are assumed to go in the
of the destination page. Duplicate scripts are assumed to be deleted by the HTMLPageAssemblerOutput port for content, type array of XMLToken. Ideally a set of named
Interesting questions: Run the model every time or not? RESTful API for running the model? For first case, can run model every time like HTMLModelExporter
Is developing a RESTful API a research contribution?
Anything related to the location-aware stuff that is a research contribution? Use location as a context for user preferences?
Hi Roxana - we can probably just use the actor's getFullName() method and replace periods with slashes. Not sure what to do if name has a slash in it? Other special prohibited characters?
-----Original Message----- From: Edward A. Lee [mailto:eal@ eecs.berkeley.edu] Sent: Wednesday, July 04, 2012 8:14 AM To: Latronico Elizabeth (CR/RTC3.1-NA) Cc: ptango@ chess.eecs.berkeley.edu Subject: Re: [Ptango] Refactored WebExporter and WebExportable
We have StringUtilities.sanitizeName() that takes a string and returns a string that is a legal Java identifier. I think this will work for removing any special characters in names...
So I think the RESTful URI should be the full name with slashes replacing periods and each name being sanitized.
Edward
On 7/3/12 6:33 AM, Latronico Elizabeth (CR/RTC3.1-NA) wrote:
Yes, I think we can eliminate HttpCompositeServiceProvider and replace it with a combination of those new actors. I'd also like to have an actor similar to HTMLModelExporter that would offer a RESTful API to the referenced model. It would let users make GET and possibly POST requests to individual actors in the referenced model. For example, a GET request to the top-level would return a web page with the whole model, same as HTMLModelExporter: http://localhost:8080/top
Then, a GET request to an actor of this model would return just the content for this actor, e.g. http://localhost:8080/top/SequencePlotter1 would return the graph for SequencePlotter1
I think we are pretty close - HttpActor already outputs the getRequestURI and postRequestURI, so the new actor would have input ports for these. The referenced model could use WebExport attributes to determine which actors are GET-able (and POST-able?) If a user makes a request to an actor without a WebExport attribute (maybe we don't want to allow GETs and POSTs to everything), the new actor could return a "not found" message. Finally we need a RESTful naming scheme for how to address actors - maybe the Ptolemy full name with slashes instead of periods. There are probably some special characters to watch out for.
Best, Beth
-----Original Message----- From: Edward A. Lee [mailto:eal@ eecs.berkeley.edu] Sent: Saturday, June 30, 2012 7:05 PM To: Latronico Elizabeth (CR/RTC3.1-NA) Cc: ptango@ chess.eecs.berkeley.edu Subject: Re: [Ptango] Refactored WebExporter and WebExportable
Looks interesting!
On this:
On 6/28/12 11:03 AM, Latronico Elizabeth (CR/RTC3.1-NA) wrote:
HttpCompositeServiceProvider isn't properly refactored yet, so demos /org/ptolemy/ptango/demo/webserver/MultiplyService.xml and RoomTemperatureService.xml will not run. However, this class should compile with no errors.
Do we need HttpCompositeServiceProvider now? It seems it combines many different functions together that I would think we would want to separate into different actors. My goal was to show that that these demos could be done with HttpActor, HTMLModelExporter, RunCompositeActor, and my previous propososal for a template-driven web page constructor.
Edward
Note: the issue was created automatically with bugzilla2github tool
Original bug ID: BZ#517 From: Elizabeth Latronico <beth@berkeley.edu> Reported version: 9.1.devel CC: ptango@chess.eecs.berkeley.edu
Blocker for: BZ#515