root / docs / source / webclient.rst @ 97672e7c
History | View | Annotate | Download (7.1 kB)
1 | ebfb9e9d | Christos Stathis | Pithos+ Web Client |
---|---|---|---|
2 | ebfb9e9d | Christos Stathis | ================== |
3 | ebfb9e9d | Christos Stathis | |
4 | ebfb9e9d | Christos Stathis | Introduction |
5 | ebfb9e9d | Christos Stathis | ------------ |
6 | ebfb9e9d | Christos Stathis | |
7 | ebfb9e9d | Christos Stathis | Document Revisions |
8 | ebfb9e9d | Christos Stathis | ^^^^^^^^^^^^^^^^^^ |
9 | ebfb9e9d | Christos Stathis | |
10 | ebfb9e9d | Christos Stathis | ===================== ===================================== |
11 | ebfb9e9d | Christos Stathis | Revision Description |
12 | ebfb9e9d | Christos Stathis | ===================== ===================================== |
13 | 97672e7c | Christos Stathis | 0.1 (Apr 09, 2012) Initial release. |
14 | ebfb9e9d | Christos Stathis | ===================== ===================================== |
15 | ebfb9e9d | Christos Stathis | |
16 | ebfb9e9d | Christos Stathis | Build instructions |
17 | ebfb9e9d | Christos Stathis | ------------------ |
18 | 95f0eec3 | Christos Stathis | prerequisites: git, jdk 1.6, ant |
19 | 95f0eec3 | Christos Stathis | |
20 | 95f0eec3 | Christos Stathis | First get the source from the git repository |
21 | 95f0eec3 | Christos Stathis | |
22 | 95f0eec3 | Christos Stathis | git clone https://code.grnet.gr/git/pithos-web-client |
23 | 95f0eec3 | Christos Stathis | |
24 | 95f0eec3 | Christos Stathis | cd pithos-web-client |
25 | 95f0eec3 | Christos Stathis | |
26 | 95f0eec3 | Christos Stathis | Edit the file runtime.properties and set the loginUrl and cloudbar properties to the correct values eg. |
27 | 95f0eec3 | Christos Stathis | |
28 | 95f0eec3 | Christos Stathis | loginUrl=https://accounts.staging.okeanos.grnet.gr/im/login?next=https%3A//pithos.staging.okeanos.grnet.gr/ui |
29 | 95f0eec3 | Christos Stathis | |
30 | 95f0eec3 | Christos Stathis | CLOUDBAR_ACTIVE_SERVICE = cloud; |
31 | 95f0eec3 | Christos Stathis | |
32 | 95f0eec3 | Christos Stathis | CLOUDBAR_LOCATION = https://accounts.staging.okeanos.grnet.gr/static/im/cloudbar/ |
33 | 95f0eec3 | Christos Stathis | |
34 | 95f0eec3 | Christos Stathis | CLOUDBAR_SERVICES = https://accounts.staging.okeanos.grnet.gr/im/get_services |
35 | 95f0eec3 | Christos Stathis | |
36 | 95f0eec3 | Christos Stathis | CLOUDBAR_MENU = https://accounts.staging.okeanos.grnet.gr/im/get_menu |
37 | 95f0eec3 | Christos Stathis | |
38 | 95f0eec3 | Christos Stathis | Then run ant |
39 | 95f0eec3 | Christos Stathis | |
40 | 95f0eec3 | Christos Stathis | ant |
41 | 95f0eec3 | Christos Stathis | |
42 | 95f0eec3 | Christos Stathis | cd bin/www/gr.grnet.pithos.web.Pithos |
43 | 95f0eec3 | Christos Stathis | |
44 | 95f0eec3 | Christos Stathis | This folder contains the "binaries" (html and javascript actually). Those files should be put somewhere to be served by the web server. |
45 | 95f0eec3 | Christos Stathis | For deploying to pithos.dev.grnet.gr, upload everything to /var/www/pithos_web_client where they are served under /ui. |
46 | 95f0eec3 | Christos Stathis | |
47 | 95f0eec3 | Christos Stathis | Important reminder: Due to Same-Origin-Policy the web client should be served under the same domain as the API. |
48 | ebfb9e9d | Christos Stathis | |
49 | ebfb9e9d | Christos Stathis | Technology and tools |
50 | ebfb9e9d | Christos Stathis | -------------------- |
51 | 97672e7c | Christos Stathis | Pithos+ web client is a gwt application. It is written in Java and compiled to javascript that runs in the browser. More info about gwt can be found here http://developers.google.com/web-toolkit/ |
52 | ebfb9e9d | Christos Stathis | |
53 | ebfb9e9d | Christos Stathis | General architecture |
54 | ebfb9e9d | Christos Stathis | -------------------- |
55 | ebfb9e9d | Christos Stathis | |
56 | 97672e7c | Christos Stathis | The web client does an adaptation of the container/object server-side data model to the more user-friendly folder/file data model. The client uses the API to retrieve info about the containers and objects from the server and displays them in a tree-like structure. It uses two special gwt widgets, CellTree (https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCellWidgets#celltree) and CellTable (https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCellTable) for the folder tree and filelist accordingly. The CellTree widget initiates calls to the API at the beginning and each time a subtree is expanded in order to fetch all info needed to display the subfolders. That way the datamodel is controlled by the widget. |
57 | 97672e7c | Christos Stathis | |
58 | ebfb9e9d | Christos Stathis | Authentication |
59 | ebfb9e9d | Christos Stathis | -------------- |
60 | ebfb9e9d | Christos Stathis | |
61 | 95f0eec3 | Christos Stathis | Authentication is provided by an external service. Upon loading the web client checks for the existence of the authentication cookie named '_pithos2_a'. If the cookie is present then it is parsed for the username and authentication token. The format of the cookie content is |
62 | 95f0eec3 | Christos Stathis | |
63 | 95f0eec3 | Christos Stathis | username|token |
64 | 95f0eec3 | Christos Stathis | |
65 | 95f0eec3 | Christos Stathis | These username and token are used for every request to the server. If at any time, the client receives an HTTP 401 (Unauthorized) which means that the token has expired, then the user is informed and redirected to the login page. |
66 | 95f0eec3 | Christos Stathis | |
67 | 95f0eec3 | Christos Stathis | If the auth cookie is not present in the first place then the user is immediately redirected to the login page. |
68 | 95f0eec3 | Christos Stathis | |
69 | 95f0eec3 | Christos Stathis | The login page url is defined in the runtime.properties file and it must end with a 'next=' url parameter. The value of the parameter will be determined automatically. If the parameter is not present then the login page will not be able to redirect back to the client after a successful login and the use will end up at her profile page. |
70 | 95f0eec3 | Christos Stathis | |
71 | ebfb9e9d | Christos Stathis | API Usage |
72 | ebfb9e9d | Christos Stathis | --------- |
73 | ebfb9e9d | Christos Stathis | |
74 | ebfb9e9d | Christos Stathis | Initialization |
75 | ebfb9e9d | Christos Stathis | ^^^^^^^^^^^^^^ |
76 | 97672e7c | Christos Stathis | Upon loading, the web client performs the following steps: |
77 | 95f0eec3 | Christos Stathis | |
78 | 95f0eec3 | Christos Stathis | Ckeck if the user is authenticated (auth cookie present) |
79 | 95f0eec3 | Christos Stathis | |
80 | 95f0eec3 | Christos Stathis | The application page is constructed |
81 | 95f0eec3 | Christos Stathis | |
82 | 95f0eec3 | Christos Stathis | Requests the server for the user account and files. This is done in various stages. First a request is made for the user account data |
83 | 95f0eec3 | Christos Stathis | |
84 | 95f0eec3 | Christos Stathis | GET /v1/username?format=json |
85 | 95f0eec3 | Christos Stathis | |
86 | 95f0eec3 | Christos Stathis | If there is a container named 'pithos' and a container named 'trash' then it proceeds to the folder tree construction. Otherwise the missing containers will be created with a request |
87 | 95f0eec3 | Christos Stathis | |
88 | 95f0eec3 | Christos Stathis | PUT /v1/username/pithos |
89 | 95f0eec3 | Christos Stathis | |
90 | 95f0eec3 | Christos Stathis | PUT /v1/username/trash |
91 | ebfb9e9d | Christos Stathis | |
92 | ebfb9e9d | Christos Stathis | Constructing the folder tree |
93 | ebfb9e9d | Christos Stathis | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
94 | 9d31e44f | Christos Stathis | The folder tree displays in a tree structure all the user 's containers (including trash). For each container a request is made |
95 | ebfb9e9d | Christos Stathis | |
96 | 9d31e44f | Christos Stathis | GET /v1/username/pithos?format=json&delimiter=/&prefix= |
97 | 95f0eec3 | Christos Stathis | |
98 | 9d31e44f | Christos Stathis | to get the first level of folders (either actual objects with application/folder content type or virtual prefixes). The home folder (pithos) is always displayed first, selected and expanded and the trash container is always last. |
99 | ebfb9e9d | Christos Stathis | |
100 | 9d31e44f | Christos Stathis | Due to the pithos container being programmatically selected and expanded at the beginning, additional requests |
101 | 9d31e44f | Christos Stathis | |
102 | 9d31e44f | Christos Stathis | GET /v1/username/pithos?format=json&delimiter=/&prefix=pithos_subfolder1 |
103 | 9d31e44f | Christos Stathis | |
104 | 9d31e44f | Christos Stathis | are made to server to fetch details of the subfolders. We need to know if a subfolder has its own subfolders so that we display the cross sign next to it. |
105 | 9d31e44f | Christos Stathis | |
106 | 9d31e44f | Christos Stathis | Constructing the "Shared by me" tree |
107 | ebfb9e9d | Christos Stathis | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
108 | 9d31e44f | Christos Stathis | My shared tree construction is a bit more complicated. All files that are shared individualy (not through sharing their parent folder) are displayed directly in the root of the tree (inside the 'Shared by me' folder). |
109 | 9d31e44f | Christos Stathis | |
110 | 9d31e44f | Christos Stathis | All shared folders are displayed in tree structure under the root. |
111 | 9d31e44f | Christos Stathis | |
112 | 9d31e44f | Christos Stathis | The above means that the client has to make a series of requests to collect all shared items and display them accordingly. |
113 | 9d31e44f | Christos Stathis | |
114 | 9d31e44f | Christos Stathis | First a |
115 | 9d31e44f | Christos Stathis | |
116 | 9d31e44f | Christos Stathis | GET /v1/username/container?format=json&delimiter=/&prefix= |
117 | 9d31e44f | Christos Stathis | |
118 | 9d31e44f | Christos Stathis | is made for each container. If the container is shared it is added to the tree (under "Shared by me") and the client continues to the next container (this has to be re-visited because it was based that due to the permission inheritance the subfolders are also shared. Since the inheritance has been removed this is no longer valid). |
119 | 9d31e44f | Christos Stathis | |
120 | 9d31e44f | Christos Stathis | If the container is not shared we have to go deeper to find possible shared subfolders and files. So we examine each file in the folder and if shared we add it in the "Shared by me" folder and we also do a nested iteration getting each subfolder |
121 | 9d31e44f | Christos Stathis | |
122 | 9d31e44f | Christos Stathis | GET /v1/username/container?format=json&delimiter=/&prefix=subfolder |
123 | 9d31e44f | Christos Stathis | |
124 | 9d31e44f | Christos Stathis | and this is done recursively until all shared folders have been collected. |
125 | 9d31e44f | Christos Stathis | |
126 | 9d31e44f | Christos Stathis | Constructing the "Shared by others" tree |
127 | 9d31e44f | Christos Stathis | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
128 | 9d31e44f | Christos Stathis | The "Shared by others" tree has the additional complication that we need to get the users that share objects with us and display them as a first level of subfolders. |
129 | 9d31e44f | Christos Stathis | |
130 | 9d31e44f | Christos Stathis | GET /v1?format=json |
131 | 9d31e44f | Christos Stathis | |
132 | 9d31e44f | Christos Stathis | For each of the users we do an additional |
133 | 9d31e44f | Christos Stathis | |
134 | 9d31e44f | Christos Stathis | GET /v1/username?format=json |
135 | 9d31e44f | Christos Stathis | |
136 | 9d31e44f | Christos Stathis | to get the containers shared by the user and for each container we do the same sequence of requests as in the "Shared by me case". The difference no is that we don't need to check if the container/folder/file is shared because all requests with a different username always return only object that are visible to the logged-on user. |
137 | ebfb9e9d | Christos Stathis | |
138 | ebfb9e9d | Christos Stathis | Constructing the Groups tree |
139 | ebfb9e9d | Christos Stathis | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
140 | ebfb9e9d | Christos Stathis | |
141 | 9d31e44f | Christos Stathis | The groups tree is contructed with the initial request for the user account data which returns the groups defined be the user along with their members. |
142 | 9d31e44f | Christos Stathis | |
143 | ebfb9e9d | Christos Stathis | File sharing |
144 | ebfb9e9d | Christos Stathis | ^^^^^^^^^^^^ |
145 | ebfb9e9d | Christos Stathis | |
146 | ebfb9e9d | Christos Stathis | File uploading |
147 | ebfb9e9d | Christos Stathis | ^^^^^^^^^^^^^^ |
148 | 9d31e44f | Christos Stathis | File uploading is done using the plupload http://www.plupload.com/ plugin. |
149 | ebfb9e9d | Christos Stathis | |
150 | ebfb9e9d | Christos Stathis | File Copy/Cut/Paste operations |
151 | ebfb9e9d | Christos Stathis | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |