SimpleServerApp in 3.1.0.M1 fails to auto discover context root

70 views
Skip to first unread message

Joanne

unread,
May 13, 2014, 4:37:54 PM5/13/14
to gran...@googlegroups.com
I have an application that can be deployed as a web server's root application or a regular one with an application name. The class SimpleServerApp.as in old graniteds version (for ex. 3.0.0GA ) was able to auto discover servername, port and context root correctly using URL with default constructor at the run time. However this is not the case any more in 3.1.0.M1; In order to make the app work as a root app, I have to create the serverApp object as new SimpleServerApp("", false, null, null), while for non-root application, it is new SimpleServerApp(null, false, null, null); The change requires me to exam if the application is running as a root app and construct SimpleServerApp object accordingly. Is there a better way to handle this situation? It will be nice if we can use same set of parameters for both cases. Thanks!

Joanne

William Drai

unread,
May 13, 2014, 4:42:18 PM5/13/14
to gran...@googlegroups.com
new SimpleServerApp() should work in both cases


2014-05-13 22:37 GMT+02:00 Joanne <fuy...@gmail.com>:
I have an application that can be deployed as a web server's root application or a regular one with an application name. The class SimpleServerApp.as in old graniteds version (for ex. 3.0.0GA ) was able to auto discover servername, port and context root correctly using URL with default constructor at the run time. However this is not the case any more in 3.1.0.M1; In order to make the app work as a root app, I have to create the serverApp object as new SimpleServerApp("", false, null, null), while for non-root application, it is new SimpleServerApp(null, false, null, null); The change requires me to exam if the application is running as a root app and construct SimpleServerApp object accordingly. Is there a better way to handle this situation? It will be nice if we can use same set of parameters for both cases. Thanks!

Joanne

--

---
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "Granite Data Services Forum".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse graniteds+...@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Joanne

unread,
May 13, 2014, 6:53:07 PM5/13/14
to gran...@googlegroups.com
My test shows that it does not work for the application deployed as a root application. Assuming the application url is "http://localhost:8080".  The URI created by graniteDS using default parameters is "http://localhost:8080{context.root}/graniteamf/amf.txt" which apparently is incorrect.

Joanne

unread,
May 14, 2014, 1:01:28 PM5/14/14
to gran...@googlegroups.com
When an app is deployed as a root application, SimpleServerApp class does not override the default "_contextRoot" value in "initialize" function, as the following condition does not stand due to negative index value, therefore the default "_contextRoot" value is used in the URI, which is "{context.root}" in 3.1.0.M1 and an empty string in 3.0.3.GA.

(_contextRoot == null || _contextRoot == DEFAULT_CONTEXT_ROOT) && idx2 > 0 && idx2 > idx

I hope this explained why using "new SimpleServerApp()" works in old graniteds version but not in 3.1.0M1. Any input is appreciated. Thanks!

William Drai

unread,
May 14, 2014, 5:12:05 PM5/14/14
to gran...@googlegroups.com
I've created a bug in JIRA: https://jira.granitedataservices.com/browse/GDS-1285

The workaround is quite simple: you can just use you own implementation of SimpleServerApp.

I say "tentative" because this bug has been caused by a fix of another bug so I'm not sure of anything, even with a bunch of unit tests.
I guess this 10 lines class will be fully fixed in GDS 14.1.3 in 2024 when GDS will have been ported to JavaScript version 14 or Dart version 5 ;)





Joanne

unread,
May 14, 2014, 8:12:21 PM5/14/14
to gran...@googlegroups.com
Thanks, this is good enough for now. Hopefully I will remember to come back to check out the permanent fix in 2024. LOL
Reply all
Reply to author
Forward
0 new messages