THttpServer class Sergey Linev (GSI). Some history Development was inspired by JSRootIO why not achieve similar functionality with online ROOT application?

Slides:



Advertisements
Similar presentations
Certification Test Tool Jon Wheeler Test Lead Microsoft Corporation.
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Internet of Things with Intel Edison Web controller
WebRTC & SIP E-SBC PBX Companion
JMeter Workshop Friday 1 December 2006 Anthony Colebourne IT Services The University of Manchester.
Cloud Computing Lecture #7 Introduction to Ajax Jimmy Lin The iSchool University of Maryland Wednesday, October 15, 2008 This work is licensed under a.
The World Wide Web and the Internet Dr Jim Briggs 1WUCM1.
How Clients and Servers Work Together. Objectives Learn about the interaction of clients and servers Explore the features and functions of Web servers.
Microsoft ® Official Course Interacting with the Search Service Microsoft SharePoint 2013 SharePoint Practice.
1 Web Services Visual C# 2008 Step by Step Chapter 30.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
W3af LUCA ALEXANDRA ADELA – MISS 1. w3af  Web Application Attack and Audit Framework  Secures web applications by finding and exploiting web application.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Web Servers Web server software is a product that works with the operating system The server computer can run more than one software product such as .
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
A Scalable Application Architecture for composing News Portals on the Internet Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta Famagusta.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
ASP.NET  ASP.NET is a web development platform, which provides a programming model, a comprehensive software infrastructure and various services required.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
1 John Magee 9 November 2012 CS120 Lecture 17a: Publishing Web pages.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
CSCI 6962: Server-side Design and Programming Web Services.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
SUSE Linux Enterprise Desktop Administration Chapter 12 Administer Printing.
Web Server Administration Web Services XML SOAP. Overview What are web services and what do they do? What is XML? What is SOAP? How are they all connected?
JavaScript ROOT Bertrand Bellenot (CERN) Sergey Linev (GSI)
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
CS4273: Distributed System Technologies and Programming Lecture 13: Review.
Certification Test Tool Sarat Manni Test Lead Microsoft Corporation.
Enabling High-Quality Printing in Web Applications
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
1 Chapter Overview Creating Drive and Folder Shares Using Distributed File System Installing Network Printers Administering Network Printers Managing Share.
JavaScript - A Web Script Language Fred Durao
THttpServer for ROOT Bertrand Bellenot, CERN Sergey Linev, GSI Darmstadt
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Introduction to Taverna Online and Interaction service Aleksandra Pawlik University of Manchester.
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Web Services An Introduction Copyright © Curt Hill.
Institute for the Protection and Security of the Citizen HAZAS – Hazard Assessment ECCAIRS Technical Course Provided by the Joint Research Centre - Ispra.
S.Linev: Go4 - J.Adamczewski, H.G.Essel, S.Linev ROOT 2005 New development in Go4.
Module 5: Managing Content. Overview Publishing Content Executing Reports Creating Cached Instances Creating Snapshots and Report History Creating Subscriptions.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Introducing the Microsoft® .NET Framework
ASP.NET Forms.
JavaScript and Ajax (Ajax Tutorial)
How to link a test to a launcher (in this case a shell launcher)
Section 13 - Integrating with Third Party Tools
Data Virtualization Tutorial… CORS and CIS
Distributed object monitoring for ROOT analyses with Go4 v.3
3D graphics in JavaScript ROOT
MapServer In its most basic form, MapServer is a CGI program that sits inactive on your Web server. When a request is sent to MapServer, it uses.
Testing REST IPA using POSTMAN
AJAX Robin Burke ECT 360.
How to add MVE link to z/OSMF?
PHP and Forms.
How to add MVE link to z/OSMF?
How to add MVE link to z/OSMF?
Message Passing Systems
Presentation transcript:

THttpServer class Sergey Linev (GSI)

Some history Development was inspired by JSRootIO why not achieve similar functionality with online ROOT application? first tests with external web servers introducing THttpServer class in ROOT ends up in rewriting JavaScript code available since mid 2014 in the ROOT5 and ROOT THttpServer class, ROOT Workshop2

Simple example { // http server with port 8080 THttpServer* serv = new THttpServer(" // Create histogram, accessible via gROOT TH1F *hpx = new TH1F("hpx","This is the px distribution",100,-4,4); // run event loop while (!gSystem->ProcessEvents()) { hpx->FillRandom("gaus", 1000); } THttpServer class, ROOT Workshop3

hsimple.C screenshot THttpServer class, ROOT Workshop4 o root [0] new THttpServer(“ o root [1].x $ROOTSYS/tutorials/hsimple.C

THttpServer functionality access to application objects o files, canvases, histograms via gROOT o objects could be registered directly serv->Register(“/graphs”, gr); deliver objects data in different formats o binary, JSON, XML, image o also access to objects members execution of objects methods user interface with JavaScript ROOT THttpServer class, ROOT Workshop5

Civetweb as http server Works on many platforms o Linux, Mac, Windows, Android,... Implements major HTTP standards o HTTP digest authorization, HTTPS/SSL, Websockets,... Several threads to handle incoming requests Single source file Open source, MIT license Encapsulated in TCivetweb class THttpServer class, ROOT Workshop6

threads safety THttpServer class, ROOT Workshop7 Application main thread THttpServer - collect requests - process requests TRootSniffer - find object per name - produce reply Running code: { // create objects while (true) { gSystem->ProcessEvents(); // modify objects... } civetweb thread1 - process input request - submit it to THttpServer - wait for result and send http civetweb thread2 - process input request - submit it to THttpServer - wait for result and send http civetweb thread3 - process input request - submit it to THttpServer - wait for result and send http Objects access ONLY from main thread

TRootSniffer Core functionality of THttpServer Always works in main application thread Explore and access objects hierarchy Produces different representation of the objects Best place for implementing user code THttpServer class, ROOT Workshop8

FastCGI support FastCGI is a binary protocol for interfacing interactive programs with a web server Allows to reuse web server functionality o authorization o security o firewall o caching o... Implemented in TFastCGI class THttpServer class, ROOT Workshop9

Application process FastCGI protocol THttpServer class, ROOT Workshop10 Application main thread THttpServer - collect requests - process requests TRootSniffer - find object per name - produce reply Running code: { // create objects while (true) { gSystem->ProcessEvents(); // modify objects... } FastCGI thread1 - process input request - submit to THttpServer - wait for result and send FastCGI thread2 - process input request - submit to THttpServer - wait for result and send FastCGI thread3 - process input request - submit to THttpServer - wait for result and send Apache FastCGI proxy http server http

TBufferJSON Developed for THttpServer o but can be used independently Works similar to TBufferXML class but o works only in one direction: object -> JSON o map major ROOT containers in JS Array o allows conversion of objects members o produces human-readable objects representation no special ROOT overhead as in XML can be used not only in JavaScript Produced JSON could be directly used in JSROOT for drawing Let keep complex ROOT I/O on the server side o no need for binary I/O in JavaScript o custom streamer can be equip with special calls (see TCanvas) o no need for custom streamers in JavaScript THttpServer class, ROOT Workshop11

JSON examples THttpServer class, ROOT Workshop12 { "_typename" : "TAttText", "fTextAngle" : 0, "fTextSize" : 5.0e-02, "fTextAlign" : 11, "fTextColor" : 1, "fTextFont" : 62 } { "_typename": "TH1F", "fUniqueID": 0, "fBits": , "fName": "hpx", "fTitle": "This is the px distribution", "fLineColor": 602, "fLineStyle": 1, "fLineWidth": 1, "fFillColor": 48, "fFillStyle": 1001, "fMarkerColor": 1, "fMarkerStyle": 1, "fMarkerSize": 1, "fNcells": 102, "fXaxis": { "_typename": "TAxis", "fUniqueID": 0, "fBits": , "fName": "xaxis",...

http requests Every registered object has its own URL o like Following requests are implemented: o root.json object data in JSON format (TBufferJSON) o root.bin object data in binary format (TBufferFile) o root.xml object data in XML format (TBufferXML) o root.png object drawing on TCanvas o exe.jsonobjects method execution o exe.binobjects method execution, result in binary form o item.jsonextra objects properties, configured on the server o cmd.jsonexecution registered to server commands o h.jsonobjects hierarchy description o h.xml objects hierarchy in XML Data can be compressed providing.gz extension THttpServer class, ROOT Workshop13

http requests examples Object in JSON format o Compact and compressed JSON o Object member (fTitle) in JSON format o Object as image o Executing object method o THttpServer class, ROOT Workshop14

Objects method execution With exe.json or exe.bin requests o also exe.txt for debug purposes Method arguments specified as URL parameters One could choose method prototype One could post ROOT object as argument o in binary or XML format Best way to access custom functionality via http o but access should be granted (default off) Used for remote TTree::Draw() calling o method =Draw& prototype ="Option_t*"& opt ="px:py>>h1"& _ret_object_ =h1 method =Draw& prototype ="Option_t*"& opt ="px:py>>h1"& _ret_object_ =h THttpServer class, ROOT Workshop15

Remote TTree::Draw THttpServer class, ROOT Workshop16

Access control By default server started in read-only mode o only objects data can be accessed o methods can not be executed One could allow access to objects, folders or methods serv->Restrict("/hpx", "allow=admin"); // allow full access for user with 'admin' account serv->Restrict("/hpx", "allow=all"); // allow full access for all users serv->Restrict("/hpx", "allow_method=Rebin"); // allow only Rebin method Based on authorized user names o either htdigest of civetweb o or user name provided by FastCGI One could disable read-only mode completely o serv->SetReadOnly(kFALSE); of course, not recommended THttpServer class, ROOT Workshop17

Command interface Simple way to trigger action from web browser Bool_t flag = kFALSE;... serv->RegisterCommand(“/flip”,”flag=!flag;”); Appear as button in web GUI o activated by mouse click Works also in read-only server mode o access also can be restricted for specific users One could register commands with arguments o argument will be interactively requested in browser Command can be invoked directly with request o THttpServer class, ROOT Workshop18

Equip user application with http Level 0: do nothing o just create THttpServer instance Level 1: register user objects Level 2: add several commands Level 3: support user classes o write JavaScript code o set autoload properties o subclass TRootSniffer (to explore user collections) o example – go4 classes THttpServer class, ROOT Workshop19

Alternatives to web browser? THttpServer class, ROOT Workshop20 Application main thread THttpServer - collect requests - process requests TRootSniffer - find object per name - produce reply Running code: { // create objects while (true) { gSystem->ProcessEvents(); // modify objects... } civetweb thread1 - process input request - submit to THttpServer - wait for result and send http civetweb thread3 - process input request - submit to THttpServer - wait for result and send http shell scripts civetweb thread2 - process input request - submit to THttpServer - wait for result and send http go4 GUI* * see also talk of Joern Adamczewski-Musch later today web browser

Useful links THttpServer manual o o Class documentation for: o o o Several tutorials: o $ROOTSYS/tutorials/http Application snapshots: o THttpServer class, ROOT Workshop21