Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RESTfulModelExporter #314

Open
cxbrooks opened this issue Jul 19, 2012 · 1 comment
Open

RESTfulModelExporter #314

cxbrooks opened this issue Jul 19, 2012 · 1 comment
Assignees
Labels

Comments

@cxbrooks
Copy link
Member

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
Copy link
Member Author

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 HTMLPageAssembler

  • Output port for content, type array of XMLToken. Ideally a set of named

    s. If the user wants to include a script in the body, they must wrap it in a
    .

  • 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

@cxbrooks cxbrooks self-assigned this May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant