Debug vaadin applications on the client side - debugging

I am on an update from vaadin 6 to vaadin 7 and I am trying to find a way to debug the project on the client side. I have tried to launch the debug procedure , but with no effect. I am using Windows 8 and when trying to install the gwt-plugin I see the message:
"The installation of this software is not allowed on this machine".
Therefore I want at least to be able to send messages in the debug window, as with VConsole in vaadin 6. Strangely this deprecated in vaadin 7 class does not respond in vaadin 7 project in my working environment, namely I cannot see the messages anywhere. Any possible reason of that?
It is proposed though to use Logger instead, but I still cannot understand two things:
1) How should the logging.properties look like?
2) Where I see the output of logging messages?
Any other sugesstions would be appreciated.

VConsole.log - whilst deprecated in Vaadin 7- still works. Two things to bear in mind
1) The webapp cannot be in "production" mode - i.e. the productionMode in web.xml must be set to false
2) Typically, you need to be in Debug mode - i.e. add the debug parameter to the request URL in the browser e.g. http://localhost:8080/my-application?debug
See this page in Vaadin Book for more details.
The debug logging will appear in the debug window that appears inside your application. It should also appear in the javascript console of the browser.

Related

Undefined route brings list of avalaible routes in production env

I realized my first WebApp with Vaadin 14 and deployed it to Tomcat 9 on the production server.
So far everything is working great, but when I'm using a non-existing route in the client browser the system responds with a plain text list of all available routes and shows even the following line on the bottom:
"This detailed message is only shown when running in development mode."
I have created the WAR-file with "-pProduction" and the startup-log of Tomcat does not show any dev-mode-message.
Any ideas what happens here? Thanks for reading my first question on this platform!
I worked my way through the Vaadin docs and tried the following entry in application.properties:
vaadin.productionMode=true
But nothing changed?
This is a known vulnetability CVE-2021-31413 in Vaadin 14.6.1 and older versions. The resolution is to update the Vaadin version to 14.6.2. The latest version is 14.9.1 as of writing this. Naturally I recommend that.
https://vaadin.com/security/cve-2021-31412

What is the replacement for setLogoutURL method in vaadin 8

Our vaadin 6 application runs in a browser pop up window provided by another web app. However, that web app is not aware of when our application is completed so the responsibility to close the browser pop up is on us. We did that in the vaadin 6 by using setLogoutURL method to redirect to another servlet after vaadin application is closed and run JS command window.close() from that servlet. I didn't find similar concept of setLogoutURL in vaadin 8. What is the replacement for that in the same scenario? Basically, I am looking for a hook that can run a JS command to close the browser pop up after vaadin UI is properly closed. I am assuming the following code will not work.
myUI.close();
JavaScript.getCurrent().execute("window.close()");
// let this thread go back to vaadin framework here
Because the close() and execute() may be in a race.
In Vaadin 8 the best practice for logout procedure is indeed different. You should invalidate http session via Vaadin session and after use set location with logout url.
vaadinSession.getSession().invalidate();
ui.getPage().setLocation("");
I found that the solution given in Answer 1 is not completely correct. When running the code given in the solution, an internal error occurs. The following code will work, basically not invalidate the session but only setLocation.
ui.getPage().setLocation("page1");
ui.close();
So the replacement of vaadin 6 setLogoutURL() is ui.getPage().setLocation("page1") in vaadin 8.

Why when I return back from login to I get an ERROR with the sample app?

This is in regards to the sample: msal-web-sample-0.1.0
I am using tomcat 9 and maven to build and run the msal-web-sample code. It is building fine and running, loading spring, etc. I am able to go out and get a username and passowrd login. However, when it tries to return back to my system (https://localhost:8443/msal4jsample/secure/aad) it just has a bit "ERROR PAGE!" heading with Home Page link going back to the main tomcat page.
In the tomcat runtime it has:
2021-06-29 15:28:06.108 ERROR 6360 --- [io-8443-exec-10] o.s.b.w.servlet.support.ErrorPageFilter : Cannot forward to error page for request [/secure/aad] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false
Of course, that doesn't apply to my setup.
I see the get in the logs returning back OK and don't see any errors on startup. I am at a loss as to where to go from here. Any thoughts?
Also, is there a non-spring implementation that can be used with java but still using MSAL?
Thanks
Alan
Please share additional information about the error. Do you have trouble regrading AAD? Check your environmental settings (Tomcat) if this isn't the case.

Webstorm 11 build-in server returns 404

My default port for build-in server is 63342:
Also I've got JetBrains browser plugin installed
I just added Javascript debug configuration:
But getting this 404 error in borwser:
How to fix that?
p.s
Also I probably should point that I am trying to debug angular2 application it it makes any difference.
Just 1 idea - I can see that your actual project path (ng2-intro-my) differs from the one in URL (ng2intro). This may be the issue

Grails message.properties changes not taking effect in deployed application

I have a really annoying problem with a deployed Grails application on tomcat 7
I created a tool in my website that basically allows the site admin to edit message.properties files so that he can change the messages for a certain language as he desire.
All the changes are saved successfully to the file he edited.
In development, while running the website from STS (Soring Source Tools Suite; somethng like eclips) I just refresh the website in the browser and I see the changes instantly, all the changes that made to the message.properties file for the selected language is taking effect correctly.
But in the deployed application (same code same config no errors) the admin do the same thing, edit the resources in the same way as before, the message.properties file is saved with the new values correctly, but, I dont see the changes in the browser, unless I restarted tomcat, or after number of hours!
I've disabled the tomcat 7 caching, and I still face the same problem.
I've spent more than 4 days googling, but all the results are not related to my problem, and most of them are related to hibernate caching.
So, my question simply is as follows:
I want to go to a message.properties file in my deployed grails application, lets say message_en.properties, change lets say default.welcome.message=Welcome to default.welcome.message=Hello, World!
And then open any browser, and see Hello, World! instead of Welcome
Thanks in advance for any help =')
As they say, some big questions have a very simple answer!
Depending on a post I found, in my resources editor tool, I added this code in my action with other few changes in the bootstarp (see link at the end of the answer):
def messageSource
def saveMessageResources={
.
.
.
//my action logic
.
.
.
messageSource.clearCache()
}
and it worked :)
References: http://jira.grails.org/browse/GPAPPENGINE-44
Deployed application will not pick up changes until you restart it. Changes are reloaded on-thy-fly only in development mode for your convenience. It is called "hot-deployment" because only parts that are changed (messages.properties in your case) are applied.
If you want to edit messages in deployed application you can apply alternative solution - localisation plugin that keeps your messages in database.

Resources