I've simple SPA and I make log out on reloading. As I understand the disadvantage of NOT logging out on reloading is to reinitialization of the whole application.
Questions:
What are the disadvantages of NOT logging off at Single Page Application?
What is the best way to achive NOT loging of on reloading (F5)?
The advantage is that not logging off will avoid pissing off your users so much that they'll want to kill you :-). Seriously, if an application logged me off every time I refresh a page (or open a link in a new tab), I would never use that application again.
Well, don't do it. Make sure the authentication token is stored in a place surviving a refresh, i.e. not in some JS variable, but in a cookie or local storage, for example.
Related
I'm working with a project of patient queuing using JSP and Eclipse IDE. In it, I require a message to be conveyed between two different sessions of same website (i.e. the doctor's and compounder's homepage are alive).
As soon as the doctor finishes consulting a patient, a message is to be passed to the compounder's home page saying "To send new patient in".
I checked session creations and MVVM. But it doesn't satisfy me. Will anyone please help me out on this? I have tried an "auto refresh" inside JavaScript, but I ended up in an infinite loop.
This is a very broad topic. You can go about it in several ways and using several technologies (message queues/brokers, websocket, dwr, etc).
This is similar to building a chat application so maybe search for that online (again another broad topic).
If you want something very simple (and most of the times inefficient - but that depends on your requirements) you can go about it this way:
Have a simple database behind your application (an application wide thread-safe queue should work too but a database gives you persistance in case something happens to the application, like a server crash);
once the doctor finishes the consultation, his page saves an entry to the database, a flag basically;
The compounder's page has an Ajax request that from time to time (say 10 sec) looks for the flag in the database;
if the flag is found it displays a message on the compounder's page to send the next patient and then resets the flag
repeat step 2.
Those are broad steps to build something simple. As I said, not the most efficient way. Search for how to build a chat and you'll find better ways since a requirement for chat applications is to be fast and scalable.
I'm currently running a (free) Google App Engine instance which I need to restart manually.
However, in the 'instances' tab in my project it just gives me the options to 'view logs' or 'shutdown'.
Shutting down the instance is not an option because I do not want to manually re-deploy the application to google appspot. This is not an option because I need to do this from multiple locations (even on the road), and my project is located on a single desktop computer.
The reason I want to be able to restart the instance is because of the caching within my Java application. I cache certain users and data so that I only rarely have to call the datastore.
However, when I want to delete certain records from the datastore they still exist in the cache of my application. This means that the users can access data which was already deleted by hand.
I know it's possible to write a single-use admin application just to clear the cache, but that's not the way I wish to solve this problem. It should be easier than that.
Is there any way to restart a running instance, effectively rebooting my Java application, without re-deploying the entire application to google appspot?
Go to the Datastore viewer tab in your App Engine console. Click on "Flush memcache" button. Or, go to the Memcache viewer tab and click on "Flush cache" button.
If you want to restart your instance manually - shut it down. Then hit your website, and a new instance will be created automatically. There is no need to redeploy your app again.
The "Flush memcache" approach didn't work for me. I couldn't find where to shutdown a service either.
Instead, I found a way to delete the instance being served then hit the application's url. App engine would automatically create a new instance, which essentially would be a restart.
To delete an instance, do this:
From App engine dashboard, click "Instances" on the side menu. On the Instances page—below the graph—you would see a list of active instances, delete them, then hit your app's url.
I have a Google App Engine Application, and as part of that Application I have my standard HTML pages, Home, ContactUs, Testimonials, Pricing ETC ETC, when users click on "login" or go to a specific URL eg (www.diarybooker.com/demo) it loads the actual application.
All these standard HTML files are fairly static files though, with analytics and SEO etc in them, however in order to update these currently I need to release a new version of my application every time.
Can anyone offer any advice as to how I can JUST update the HTML without having to release a new version of my application (especially if I am in the middle of a development cycle and don't want to branch just to update a contact number or fix an SEO issue etc)
It is entirely possible that I am actually using the system incorrectly and that I should be re-wiring things better/differently, but I cant find any information about how this SHOULD be setup, and Im not even sure what to search for either, so if anyone can at least point me in the direction of some information on this, I would be very greatful!!
By way of an alternative example, I have a friend who is running www.wineathome.org.uk and if you click on "attend a tasting" it moves off into http://wineathomeuk.appspot.com. Clearly this is not very clean and is also not the way to make it work, I could embed the application in an iframe, but is that really the way to go?!
You have your application code in source control, right? I'd suggest that you create a deployment directory and clone into it the version of the application that you want to have running on AppEngine. Then, copy into the deployment directory the versions of the HTML files that you want updated. Deploy away.
That is the only strategy that's going to work for you. The GAE deployment tool only deals with your application as a whole.
Looks like you have a couple of issues going on.
On the first issue as #AdamCrossland states you can use source control. I use git and create branches for my application at different versions. If you do that you can merge your updated HTML back into an older branch then update your application from that branch. That way your only changing the HTML files and leaving the application in it's current state. App Engine deploy is intelligent and will only upload the modified files. Doing this from Eclipse is a bit more difficult than from the CLI IMO, but YMMV.
The other issue of a friend clicking on attend a tasting routing the url to appspot is a bit harder to deal with unless some code is provided. I would think it is because the code is doing a redirect to a hard coded URL. I have several application mapped to a domains and none of them route to appspot unless I forced it to in order to use some functionality like HTTPS which only works on appspot.com. I personally try to avoid iframes it opens up an avenue for exploits.
Given an java web application that is currently running in a server, will deploying the same app (giving it a new context name ie. /app-readonly) but provide it with a readonly db account the only thing I need to make a readonly version of a web application.
I would expect that this readonly version of the application will be able to view, search but any updates/creates that are triggerred from the screen will just return an error (which is fine). This is the simplest solution I can think of, without introducing a code change in order to give finer grain control on the application's user access control. At the moment the user access control only dictates what screens are accessible to a user. It is not complex in that it does not dictate what the user can do in a given accessible page.
Is this a correct approach or am I missing something?
That approach is good only if you specifically want to deploy a new web application.
In my view you should create read only user and give that user access limited to Search, view.
In this case user wont have the rights to perform insert, update.
This approach should be there within your project, who can access what ? If you have to deploy a new app for view only, IMHO you need to revisit your access control design.
I am truly struggling with this - i have checked all of the other Stack overflow pages and while this may seem like a duplicate question there are NO other answers I can find anywhere besides potentially using multiple modules (even though this does not seem correct)
All i want to do is have a set of static pages making up a website for my main page, the Login page (i plan to use RequestFactory to pull back the user permissions to display stuff for the app from here - somebody suggested in another post such as this to do it from a "Non-GWT" page - that doesn't sound correct to me), and then when the user logs in successfully he gets directed to the actual app with certain things being displayed based on his current permissions.
Now, i have implemented little test projects with multiple JSPs to do redirects using Window.Location.replace("...") but then I have no idea how to actually populate that particular page with what I want to be replaced.
From just 1 GWT app is it possible to have a full web page in static HTML files (or even JSPs i don't care), a Login Page, and the actual App.
And if this is so, How do you do this?
I use RootLayoutPanel.get() to load up my main App - how does it know which RootLayoutPanel to actually use - i've spent hours fighting with this and a lot of the tutorials / answers to the questions don't provide much depth as to how to actually go about implementing anything. There is obviously something i'm just missing
I want to do something exactly like the example in the showcase: https://www.blueworkslive.com/#!gettingStarted:overview
If you use chrome and check the tags every single page on there says GWT 2.4, so it's definitely not like one answer i came across saying "don't use GWT for the login". This seems like it should be something simple that I just... am not finding or honestly am not getting from any of the examples.
This is close to the last step of my project and any help on this would be greatly appreciated.
I'm using Apache Shiro with GAE, Objectify for a database and RequestFactory - there is only one main html page and the app is simply calling getRootLayoutPanel to load the app. not sure if any of that is useful.
implementing the page isn't the issue it's just the redirecting
To login on GAE, via Google account or federated login, you need to redirect your user to login page. Since you run GWT, which usually only has one page, you have two choices:
Do the normal redirect to login page - in this case browser will go to login page and you will loose GWT app state. After login, you can be redirected back to GWT app. As said - GWT app state will be lost. This is the simple way.
Open the login page in child window or iframe. Set destination URL to a page that closes the window (actually it must install a javascript parent hook, that destination page calls). When login is done, destination page calls JS hook, which notifies parent page thet login procedure is over, closes the child window/iframe and continues. This is more complex, some login pages do not like iframes (in case of OpenID login), but it retains your GWT app state.
To answer your question:
Yes it's possible to have multiple pages in a GWT project (GWT pages/modules and static files). Of course, as you navigate from page to page, you will loose app state. GWT module is only "active" as long as page is loaded in browser.