SpringBoot2 how can I load newly added resources when running - spring

I'm working on a web program.
In a controller, I create a picture using JfreeChart and save in /resources/image/.
But I can't load it on the web page immediately yet I can see the file under the directory. About 10s later, it can be loaded.
I'm not sure if I need to refresh resources in my code, And how should I refresh if needed.

Related

How we can refresh page until certain text is appeared on UI using karate framework?

Scenario is as below:
Upload file in s3 bucket.
Open the application
Refresh page till the data from uploaded file is appeared on UI
I have tried refresh(), waitUntilText, waitUntil till text is appeared. However, its not working. The text is appeared after some time (which is not consistent to provide delay) and need to refresh the page to have check is the data is updated on UI under certain web element.

How to avoid downloading js files and authentication ember SPA

We have an ember single page application. On a specific page, while clicking on a hyperlink, I want to open a specific route in the new window.
The problem here is, it starts downloading all the js files (main.js) and authenticating the session and then only it is loading the route. This is taking too much time and giving a poor user experience. Since the hyperlink can be clicked only when the user is already logged in, is there a way to avoid downloading all the js files and authentication in ember? Something like a child window of the current window, so that the route will be loaded immediately.
is there a way to avoid downloading all the js files
They should be cached by the browser unless you have your server set headers to not cache your JS files.
But maybe the files are loaded from cache but the delay you are experiencing is the parsing and execution of your scripts. This cannot be avoided with a SPA.
You could shorten the perceived delay by using server side rendering via FastBoot. This will mean the route is immediately rendered, but the user won't be able to interact with it fully until all of the client-side scripts have been executed.
authentication in ember
I don't think this adds much delay as it should just be checking a cookie or HTTP header as you are already authenticated in another window.
Something like a child window of the current window, so that the route will be loaded immediately.
As you have a SPA, you should try to avoid opening a new window as everything is already loaded in the current one. And the user can easily return to the previous page via the browser back button and this too should be almost instantaneous.
Is there a particular business reason why it has to be in a new window?

Switching between views in Ionic2 is too slow

I'm building an Ionic application, I have built 50% of the project, and at first I used the sidemenu template that is auto generated with ionic start MyProject sidemenu, and then I added my own pages and components after that.
In the browser view the app was great, then I deployed my application to an android device, with the deployment being successfully When I start the application I felt that the application was slow, but when I switch to a some view, it took 5-10 seconds to open the new page.
I watched the traffic between the server side and the application, and observed that the application is not switching to the new page until the request is back and the view is rendered!
any help?
Try switching to your views first and then using the ionViewWillEnter() or another built in ionic API for the application lifecycle.
ionViewWillEnter will pull the data everytime the view loads, where
ionViewDidLoad will pull the page on first load only.
ionViewDidLoad() {
console.log('ionViewDidLoad SplashPage');
}
You do not state which version of ionic you are using but in ionic 3 if you create your pages with the terminal using
ionic g page MyPage
It will automatically create the page as a module. This allows for lazy loading. You can read more on it here form ionic's official blog post.
Its hard to say exactly why the view is only loading after it hits the server as you have not added your navigational code. There could be a code block that waits for a server response before pushing to the next page.
If your view is depended on received data from the server then your request should be in a new Promise allowing you to add conditionals for before and/or after the data has been touched.

liferay pages cached when working offline

In liferay application, we have page loaded from actionurl. Once after page is loaded, in browser we are setting work offline.
If we copy the "actionurl" of the loaded page and tried accessing on another tab, still page is getting loaded. This page is getting loaded from cache. From developer tool, we could see page loaded with label "cached".
How to prevent this?.
setting browser.cache.disabled=true - is not working in the above case.
Try this, in portlet.xml under portlet-class and init-param add:
<expiration-cache>0</expiration-cache>
This would set a cache that is always expired.

Firefox extension inject script before loading any page

I've written an Firefox extension to inject some script and css to all web pages loaded while this extension is installed.
Up to now, everything works fine. As soon I open a new page it loads en the script and css are injected. But what I want is that the extension is loaded before the page.
Example; I'm loading the twitter intent page. With my extension I'm customising this page. Right now I first see the twitter page, then the extension is loaded and my changes to the intent page are implemented.
What I want is the opposite. I first want to load everything from the extension, so as soon as the twitter page loads it is directly visible with my custom changes implemented trough my extension.
Currently I'm using the following lines to implement the scripts/styles. Although I've got the "contentScriptWhen" set to start, this won't fix my problem..
include: '*',
contentScriptFile: [data.url('jq.js'), data.url('js.js')],
contentStyleFile: data.url("css.css"),
contentScriptWhen: 'start',
I've 'solved' this problem. I'm loading the Twitter Intent (TI) page in the background as soon my index page is loaded.
While the TI page is loaded, it closes again. The page is in cache now, next time TI is loaded everything is instant correctly.
You can find more about background loading here: developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/tabs
In this fiddle is shown how I did the trick; FIDDLE
You can also start by preventing the document from getting parsed then on the side fetch the same document, make any modifications on the fetched document and inject it in the page. Here is what I currently use https://stackoverflow.com/a/36097573/6085033

Resources