Tuesday, December 3, 2024

Re: GWT history with push state

I'm finally getting around to replacing these calls with Elemental2.

To replace the JSNI method:

public static native void initialise() /*-{
$wnd.onpopstate = $entry(function(e) {
@com.blah.YourClass::yourMethodThatListensForUrlChange()();
});
}-*/;

I would have thought it would be:

public static void initialise() {
DomGlobal.window.onpopstate.onInvoke(event -> {
// Do something
});
}

However, that doesn't compile, as onInvoke takes a @JsFunction, not a @FunctionalInterface.  So, I have to do something like this:

public static void initialise() {
DomGlobal.window.addEventListener("popstate", event -> {
// Do something
});
}

Is this correct?

On Friday, 16 October 2020 at 3:40:39 pm UTC+11 Craig Mitchell wrote:
As Tomas said, not directly with History.  It's simple JSNI though:

public static native void updateURL(String newUrl) /*-{
    $wnd.history.pushState(newUrl, "", newUrl);
}-*/;

public static native void initialise() /*-{
$wnd.onpopstate = $entry(function(e) {
@com.blah.YourClass::yourMethodThatListensForUrlChange()();
});
}-*/;

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/59a9c005-54fe-445f-9d35-d554d5b9039fn%40googlegroups.com.

Re: Chrome SecurityError: Failed to execute 'pushState' on 'History'

Apologies, just saw this:  https://github.com/google/elemental2?tab=readme-ov-file#gwt

Added:  <inherits name="elemental2.dom.Dom"/>

And it's working great!
On Wednesday, 4 December 2024 at 2:45:36 pm UTC+11 Craig Mitchell wrote:
A little off topic, however, I just tried to use elemental2-dom, without any success.

I add the lib to my client module:

<dependency>
  <groupId>com.google.elemental2</groupId>
  <artifactId>elemental2-dom</artifactId>
  <version>1.2.3</version>
</dependency>

And then try to use it:

DomGlobal.history.pushState(myUrl, "", myUrl);

And got the error:

[ERROR] Line 190: No source code is available for type elemental2.dom.DomGlobal; did you forget to inherit a required module?

So, I added:

<inherits name="elemental2.dom.DomGlobal"/>

to my gwt.xml, and got the error:

[ERROR] Unable to find 'elemental2/dom/DomGlobal.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

Any idea what I'm doing wrong?

Thanks.

On Wednesday, 4 December 2024 at 5:05:41 am UTC+11 Colin Alworth wrote:
First... you should update this to use jsinterop - consider just adding elemental2-dom to your project and calling DomGlobal.history.pushState(new Object(), "", historyRewrite); in plain Java?

To answer the question more directly, you probably need to change "window" to "$wnd" to access the actual outer window. Your current code, as written, is technically attempting to change the URL of the iframe that the app is loaded in.
On Tuesday, December 3, 2024 at 11:43:00 AM UTC-6 Lonzak wrote:
I successfully updated GWT from 2.10.1 to 2.12.1.
In Firefox everything works perfectly however not in chrome based browsers. When I try to
execute the following code:

public static native int setHistory(String historyRewrite) /*-{

window.history.pushState({}, '', historyRewrite);

}-*/;


Error:
SEVERE: (SecurityError) : Failed to execute 'pushState' on 'History': A history state object with URL 'https://company.url/home' cannot be created in a document
with origin 'https://company.url' and URL 'about:blank'.
com.google.gwt.core.client.JavaScriptException: (SecurityError) : Failed to execute 'pushState' on 'History': A history state object with URL
'https://company.url/home' cannot be created in a document with origin 'https://company.url' and URL 'about:blank'.

If I revert to GWT it works again.
Any idea what changed (and how to fix it)?
Is the script maybe loaded before the document is fully loaded?

Thanks!

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/6fa5c58f-2e1b-43dc-8ae9-0ea90e945d83n%40googlegroups.com.

Re: Chrome SecurityError: Failed to execute 'pushState' on 'History'

A little off topic, however, I just tried to use elemental2-dom, without any success.

I add the lib to my client module:

<dependency>
  <groupId>com.google.elemental2</groupId>
  <artifactId>elemental2-dom</artifactId>
  <version>1.2.3</version>
</dependency>

And then try to use it:

DomGlobal.history.pushState(myUrl, "", myUrl);

And got the error:

[ERROR] Line 190: No source code is available for type elemental2.dom.DomGlobal; did you forget to inherit a required module?

So, I added:

<inherits name="elemental2.dom.DomGlobal"/>

to my gwt.xml, and got the error:

[ERROR] Unable to find 'elemental2/dom/DomGlobal.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

Any idea what I'm doing wrong?

Thanks.

On Wednesday, 4 December 2024 at 5:05:41 am UTC+11 Colin Alworth wrote:
First... you should update this to use jsinterop - consider just adding elemental2-dom to your project and calling DomGlobal.history.pushState(new Object(), "", historyRewrite); in plain Java?

To answer the question more directly, you probably need to change "window" to "$wnd" to access the actual outer window. Your current code, as written, is technically attempting to change the URL of the iframe that the app is loaded in.
On Tuesday, December 3, 2024 at 11:43:00 AM UTC-6 Lonzak wrote:
I successfully updated GWT from 2.10.1 to 2.12.1.
In Firefox everything works perfectly however not in chrome based browsers. When I try to
execute the following code:

public static native int setHistory(String historyRewrite) /*-{

window.history.pushState({}, '', historyRewrite);

}-*/;


Error:
SEVERE: (SecurityError) : Failed to execute 'pushState' on 'History': A history state object with URL 'https://company.url/home' cannot be created in a document
with origin 'https://company.url' and URL 'about:blank'.
com.google.gwt.core.client.JavaScriptException: (SecurityError) : Failed to execute 'pushState' on 'History': A history state object with URL
'https://company.url/home' cannot be created in a document with origin 'https://company.url' and URL 'about:blank'.

If I revert to GWT it works again.
Any idea what changed (and how to fix it)?
Is the script maybe loaded before the document is fully loaded?

Thanks!

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/9bd9ceb5-0340-4b89-a2a0-cc1ac0644659n%40googlegroups.com.

Re: Chrome SecurityError: Failed to execute 'pushState' on 'History'

First... you should update this to use jsinterop - consider just adding elemental2-dom to your project and calling DomGlobal.history.pushState(new Object(), "", historyRewrite); in plain Java?

To answer the question more directly, you probably need to change "window" to "$wnd" to access the actual outer window. Your current code, as written, is technically attempting to change the URL of the iframe that the app is loaded in.
On Tuesday, December 3, 2024 at 11:43:00 AM UTC-6 Lonzak wrote:
I successfully updated GWT from 2.10.1 to 2.12.1.
In Firefox everything works perfectly however not in chrome based browsers. When I try to
execute the following code:

public static native int setHistory(String historyRewrite) /*-{

window.history.pushState({}, '', historyRewrite);

}-*/;


Error:
SEVERE: (SecurityError) : Failed to execute 'pushState' on 'History': A history state object with URL 'https://company.url/home' cannot be created in a document
with origin 'https://company.url' and URL 'about:blank'.
com.google.gwt.core.client.JavaScriptException: (SecurityError) : Failed to execute 'pushState' on 'History': A history state object with URL
'https://company.url/home' cannot be created in a document with origin 'https://company.url' and URL 'about:blank'.

If I revert to GWT it works again.
Any idea what changed (and how to fix it)?
Is the script maybe loaded before the document is fully loaded?

Thanks!

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/823d20ba-4973-436d-813d-815ec143a792n%40googlegroups.com.

Chrome SecurityError: Failed to execute 'pushState' on 'History'

I successfully updated GWT from 2.10.1 to 2.12.1.
In Firefox everything works perfectly however not in chrome based browsers. When I try to
execute the following code:

public static native int setHistory(String historyRewrite) /*-{

window.history.pushState({}, '', historyRewrite);

}-*/;


Error:
SEVERE: (SecurityError) : Failed to execute 'pushState' on 'History': A history state object with URL 'https://company.url/home' cannot be created in a document
with origin 'https://company.url' and URL 'about:blank'.
com.google.gwt.core.client.JavaScriptException: (SecurityError) : Failed to execute 'pushState' on 'History': A history state object with URL
'https://company.url/home' cannot be created in a document with origin 'https://company.url' and URL 'about:blank'.

If I revert to GWT it works again.
Any idea what changed (and how to fix it)?
Is the script maybe loaded before the document is fully loaded?

Thanks!

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/c51129ca-0e5f-4b0e-9314-b326cff23aafn%40googlegroups.com.

Re: Servlet problem after upgrade

If you are using jakarta.servlet, you shouldn't need to do any bytecode fixing, provided you are depending on gwt-servlet-jakarta.jar and have changed your servlet implementation to extend from com.google.gwt.user.server.rpc.jakarta.RemoteServiceServlet.

If you aren't getting any error except 404, that suggests to me that the servlet isn't configured to be loaded at all - can you confirm that it is listed in the web.xml? If instead you are using annotations for discovery, confirm it is jakarta.servlet.annotation.WebServlet rather than javax, and consider adding some logging to verify that your servlet is having its constructor and init(config) method called at all. If not, something is probably misconfigured in how you are signaling to your servlet container how it should find and load the required servlets.

On Tuesday, December 3, 2024 at 6:04:49 AM UTC-6 dav...@googlemail.com wrote:
Thanks Shaik & Jens for your replies, but I've still got the same problem. To recap the project includes a servlet (yes it is gwt-rpc) that simply grabs the remote IP and makes it available to client code. If I browse to the servlet, I should get a 405 signifying that the servlet is running but GET is not supported; but I still get a 404.

Prompted by your replies, I saw I had neglected  to update the ant build file with gwt-servlet-jakarta.jar instead of gwt-servlet.jar, but nothing else you suggested seems to apply. The web.xml and <project>.gwt.xml files are unchanged  and nothing else on the production server (apache, tomcat) has changed.

I again tried replacing the server class with a byte enhanced version as I need to do with 2.10.0,  but although it does add a few bytes, still  I get the 404. Nothing in either apache or tomcat logs apart from the 404s and 405s

On Monday, 2 December 2024 at 14:41:12 UTC SHAIK FAYAZ wrote:

Almost path problem it would be or check the path names correctly


On Sun, Dec 1, 2024, 7:05 AM SHAIK FAYAZ <sfay...@gmail.com> wrote:

1. Check How the Servlet is Set Up
Look at the file where your servlet is connected to a URL, like web.xml or in your annotations (comments in the code). Make sure the URL path for your servlet is correct, so it gets triggered when you visit the right link.
2. Ensure You Updated All Java Imports
When you updated from version 2.10.0 to 2.12.1, you need to check if your code is using the updated jakarta.* package instead of javax.*. Some of the old names have changed, so make sure everything is up to date.
3. Make Sure Your Tomcat Version Works with the New Code
If you're using an older version of Tomcat (like version 9 or below), it may not work with the updated jakarta.* code. Make sure you're using Tomcat version 10 or higher, which supports this newer format.
4. Check if Your Servlet Supports GET or POST Methods
Earlier, you got a "405" error, which means the servlet was not set up to handle certain requests like GET. You need to make sure that your servlet is set up to handle the right type of requests.
5. Check Apache Proxy Settings
If you're using Apache to forward requests to Tomcat, make sure Apache is set up correctly so that it passes the requests properly. A wrong setting could cause the "404" error you're seeing now.
6. Look at Logs for Clues
Check both the Tomcat and Apache logs. They might give you more details about what's going wrong and help identify the issue.
7. Issues with Code Enhancers
If you're using tools that automatically modify your code (like Hibernate or other libraries), check to make sure they're compatible with the new version (2.12.1). These tools sometimes cause problems when you upgrade versions.


On Sun, Dec 1, 2024, 5:31 AM Jens <jens.ne...@gmail.com> wrote:
GWT doesn't really have any servlet magic so I doubt that the GWT upgrade has caused the issue. Are you double sure you haven't changed anything else except the GWT library? No Tomcat update? No Apache update? No update of Apache proxy rules? 

It sounds like your servlet is a GWT-RPC service because you used the Jakarta migration tool. If that is true you can now use gwt-servlet-jakarta.jar and skip the migration tool.

-- J.

dav...@googlemail.com schrieb am Samstag, 30. November 2024 um 17:27:59 UTC+1:
hi
I'm trying to upgrade from 2.10.0 to 2.12.1.

My app runs in tomcat / java 21 with apache using it as a proxy. It's mostly client code except for a servlet whose sole function is to grab the remote ip and make it available to client code. With the 2.10.0 setup I had to run the server class through the jakartaee migration tool to make it work. With everything ok, if you browse to the servlet you get a 405 as the GET method is not supported,  although that confirms the servlet is running.

With unchanged code everything compiles with 2.12.1,  but the servlet will not run. I've tried both the standard compiled class and its byte enhanced version. Both give a 404 and the ip is not available to client code. The client code itself otherwise runs as expected.

Any pointers towards a fix?


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/dda2b7e2-3565-4f79-ac99-b90f8cac9522n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/2550068c-b12a-441b-9595-ad51450f00d2n%40googlegroups.com.

Re: Servlet problem after upgrade

Thanks Shaik & Jens for your replies, but I've still got the same problem. To recap the project includes a servlet (yes it is gwt-rpc) that simply grabs the remote IP and makes it available to client code. If I browse to the servlet, I should get a 405 signifying that the servlet is running but GET is not supported; but I still get a 404.

Prompted by your replies, I saw I had neglected  to update the ant build file with gwt-servlet-jakarta.jar instead of gwt-servlet.jar, but nothing else you suggested seems to apply. The web.xml and <project>.gwt.xml files are unchanged  and nothing else on the production server (apache, tomcat) has changed.

I again tried replacing the server class with a byte enhanced version as I need to do with 2.10.0,  but although it does add a few bytes, still  I get the 404. Nothing in either apache or tomcat logs apart from the 404s and 405s

On Monday, 2 December 2024 at 14:41:12 UTC SHAIK FAYAZ wrote:

Almost path problem it would be or check the path names correctly


On Sun, Dec 1, 2024, 7:05 AM SHAIK FAYAZ <sfay...@gmail.com> wrote:

1. Check How the Servlet is Set Up
Look at the file where your servlet is connected to a URL, like web.xml or in your annotations (comments in the code). Make sure the URL path for your servlet is correct, so it gets triggered when you visit the right link.
2. Ensure You Updated All Java Imports
When you updated from version 2.10.0 to 2.12.1, you need to check if your code is using the updated jakarta.* package instead of javax.*. Some of the old names have changed, so make sure everything is up to date.
3. Make Sure Your Tomcat Version Works with the New Code
If you're using an older version of Tomcat (like version 9 or below), it may not work with the updated jakarta.* code. Make sure you're using Tomcat version 10 or higher, which supports this newer format.
4. Check if Your Servlet Supports GET or POST Methods
Earlier, you got a "405" error, which means the servlet was not set up to handle certain requests like GET. You need to make sure that your servlet is set up to handle the right type of requests.
5. Check Apache Proxy Settings
If you're using Apache to forward requests to Tomcat, make sure Apache is set up correctly so that it passes the requests properly. A wrong setting could cause the "404" error you're seeing now.
6. Look at Logs for Clues
Check both the Tomcat and Apache logs. They might give you more details about what's going wrong and help identify the issue.
7. Issues with Code Enhancers
If you're using tools that automatically modify your code (like Hibernate or other libraries), check to make sure they're compatible with the new version (2.12.1). These tools sometimes cause problems when you upgrade versions.


On Sun, Dec 1, 2024, 5:31 AM Jens <jens.ne...@gmail.com> wrote:
GWT doesn't really have any servlet magic so I doubt that the GWT upgrade has caused the issue. Are you double sure you haven't changed anything else except the GWT library? No Tomcat update? No Apache update? No update of Apache proxy rules? 

It sounds like your servlet is a GWT-RPC service because you used the Jakarta migration tool. If that is true you can now use gwt-servlet-jakarta.jar and skip the migration tool.

-- J.

dav...@googlemail.com schrieb am Samstag, 30. November 2024 um 17:27:59 UTC+1:
hi
I'm trying to upgrade from 2.10.0 to 2.12.1.

My app runs in tomcat / java 21 with apache using it as a proxy. It's mostly client code except for a servlet whose sole function is to grab the remote ip and make it available to client code. With the 2.10.0 setup I had to run the server class through the jakartaee migration tool to make it work. With everything ok, if you browse to the servlet you get a 405 as the GET method is not supported,  although that confirms the servlet is running.

With unchanged code everything compiles with 2.12.1,  but the servlet will not run. I've tried both the standard compiled class and its byte enhanced version. Both give a 404 and the ip is not available to client code. The client code itself otherwise runs as expected.

Any pointers towards a fix?


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/dda2b7e2-3565-4f79-ac99-b90f8cac9522n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/4b67b00a-18be-4a16-97cb-8caffdb80170n%40googlegroups.com.

Monday, December 2, 2024

Re: Firefox - mouse wheel

Yes, that old one. 

Well, there is some recent activity there, so I hope this maybe could be fixed.

Thx.




pá 29. 11. 2024 v 9:01 odesílatel Thomas Broyer <t.broyer@gmail.com> napsal:


On Friday, November 29, 2024 at 8:36:48 AM UTC+1 had...@digitech.cz wrote:
Thanks, 

I am using gwt-openlayers-client 1.1.0, not TDesjardins/gwt-ol.

The one released nearly 8 years ago‽

It apparently doesn't use mousewheel event itself either, like GWT-OL (and I see you opened an issue there)

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/307120d6-87b8-4c28-9fc1-2e68f88d9197n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/CAOvMoHWigrJwZ3hgQ2fSfaDBGujeK3%2BVx98o40N_kvqG8R6pgg%40mail.gmail.com.

Re: A GWT components library - how to organize for Uibinder use?

Not saying this is the correct way, but I just have my simple common widgets in the one package, and specialised widgets in their own package.  Ie:

<ui:UiBinder
  xmlns:ui="urn:ui:com.google.gwt.uibinder"
  xmlns:g="urn:import:com.google.gwt.user.client.ui"
  xmlns:w="urn:import:mypackage.widgets"
  xmlns:s="urn:import:
mypackage.widgets.special">

<w:Button ui:field="myButton" />
<w:Link ui:field="myLink" />
<s:SpecialWidget ui:field="mySpecialWidget" />

On Sunday, 1 December 2024 at 3:59:36 pm UTC+11 cbruno...@gmail.com wrote:
Thanks Jens. This is my first Java project where I am sole architect. I ended up doing what you recommended, although I moved the ui.xml and css files into a sub-package to keep the top level package as clutter free as possible. 



On Saturday, November 30, 2024 at 5:49:08 PM UTC-6 Jens wrote:
UiBinder is XML and you have to import the package as namespace in order to use the components. Personally I would not create another package with classes extending the implementation because both classes would be public and both can be used in UiBinder then. That is likely confusing. I would put all components in the same package. Package private classes supporting a component could have the component name as prefix so they form a group in your IDE through sorting.

-- J.

cbruno...@gmail.com schrieb am Freitag, 29. November 2024 um 20:20:57 UTC+1:
Hello,

Im creating a component library for GWT and I want to be able to use the components in UI binder. However, when implementing my components, each component gets its own package, containing styles, and package private classes needed to build the component. 

However, to use in Uibinder, I need to do something like <m:button.Button text="Click" />

where m points to the package with my components.

Whats is bugging me is the extra "button" in the declaration. Is there anyway to flatten this aside from creating another package with objects simply extending the implementation ?

Thanks

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/8d6bd10a-274a-4581-b01f-e6bf054d9cf9n%40googlegroups.com.