cxbrooks / test

Second test for bugzilla to git
0 stars 0 forks source link

RESTfulModelExporter #315

Open cxbrooks opened 12 years ago

cxbrooks commented 12 years ago

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

cxbrooks commented 12 years ago

RESTfulModelExporter

Version 2:

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