Friday, April 12, 2024

Re: Help to undrerstand how to use domino-jackson and the annotation JSONMapper

Aren't you supposed to directly use the generated class rather than using GWT.create() ? (unless you also added a <replace-with> in your gwt.xml)
https://dominokit.com/solutions/domino-jackson/v1/docs/getting-started/quick-start

On Friday, April 12, 2024 at 1:20:27 PM UTC+2 tenti...@gmail.com wrote:
I'm upgrading a old project and i want to replace the old gwt-jackson (https://dominokit.com/solutions/domino-jackson/v1)  with the domino-jackson project (https://github.com/DominoKit/domino-jackson).

It should be a simple transiction, but i cannot understand how to let the GWT compilation "see" the implementations classes of the ObjectMapper interface.

Here the "old" code from gwt-jackson

public static interface AltriMetadatiDTOMapper extends com.github.nmorel.gwtjackson.client.ObjectMapper<Map<String,List<MetadatoDTOGWT>>> {} 

 ... 

 AltriMetadatiDTOMapper altriMetadatiDTOMapper = GWT.create(AltriMetadatiDTOMapper.class); String jsonAltriMetadati = altriMetadatiDTOMapper.write(object);

Here the "new" code from domino-jackson

@org.dominokit.jackson.annotation.JSONMapper public interface AltriMetadatiDTOMapper extends org.dominokit.jackson.ObjectMapper<Map<String,List<MetadatoDTOGWT>>> {}

 ... 

 AltriMetadatiDTOMapper altriMetadatiDTOMapper = GWT.create(AltriMetadatiDTOMappe.class); String jsonAltriMetadati = altriMetadatiDTOMapper.write(object);

but it give to me this error

[ERROR] Errors in 'xxx.java' [INFO] [ERROR] Line 662: Rebind result 'xxx.AltriMetadatiDTOMapper' must be a class

Did anyone know what i'm doing wrong ?

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/2deba265-8fee-4643-8677-9236c83ae253n%40googlegroups.com.

Re: Really need help getting CodeServer to run with Java 11 and GWT 2.10

Thomas, Marco showed me a project that made me see one thing I hadn't thought about, which was configured the same in the archetype project. It's regarding the sources.

In my project, I only have one jar that contain both classes and source files for those jar files that are needed, i.e. no sources-jar anywhere. This was a long time ago, but I think it was because we also needed to include things like .properties-files for i18n which are in submodules as well, so we use the <resources> tags to define them.

In any case - this apparently works fine for the compile, but could this be a reason for CodeServer not finding the class files? On the other hand, it doesn't find Lombok either which worked before, and I don't have any lombok sources.jar in my repo. Perhaps it doesn't need the Lombok sources since it's just annotations? 

On Friday 12 April 2024 at 11:20:01 UTC+2 Thomas Broyer wrote:
On Friday, April 12, 2024 at 7:50:42 AM UTC+2 Mathias wrote:
-My dependencies should be ok since i can build it with the plugin, so i'm a bit at a loss as to how make this work.

Dependencies for gwt:compile and gwt:codeserver aren't the same: https://tbroyer.github.io/gwt-maven-plugin/codeserver.html
You might have to either adjust the <scope> of dependencies (e.g. from provided to compile) or adjust the gwt:codeserver's classpathScope (e.g. from runtime to compile+runtime or compile)
 
as a final aside:
The "neither a gwt-lib or jar" warning messages in the error log below - i still get it if i add the gwt-lib type to the dependency, and the archetype project prints the same error when created.

Note that it's an info, not a warning 😉

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/a1d39578-5eff-4ede-9e2f-12d73422c98en%40googlegroups.com.

Re: Really need help getting CodeServer to run with Java 11 and GWT 2.10

Thanks! That's a great resource and got me to see one thing I'd missed.

On Friday 12 April 2024 at 15:11:45 UTC+2 Marco Tenti (IoProgrammo88) wrote:
This project has many good examples to check out https://github.com/NaluKit/nalu-examples, it help me a lot.

Il giorno venerdì 12 aprile 2024 alle 14:39:16 UTC+2 Mathias ha scritto:
Hey Jens, thanks for replying!

re. the gwt-type:

1. I only have one maven module that contains the entry point. the "gwt client" module
2. All dependencies are either on third-party such as Lombok, or my own other modules that only contain java classes and are built as jar-files.
3. I added the "type" gwt-lib to the dependencies in the "gwt client" pom, but I didn't do anything to the pom files in the jar modules that the gwt client depend on. I mean, Lombok doesn't have a packaging <packaging>gwt-lib</packaging> in its pom, either. 

On Friday 12 April 2024 at 11:15:38 UTC+2 Jens wrote:
A full example for multiple maven modules (more than just three) can be found here: https://github.com/tbroyer/gwt-maven-plugin/tree/main/src/it/e2e

You have to add <packaging>gwt-lib</packaging> to your own maven library modules that contain a module.gwt.xml file. Maybe you forgot that?

-- J.

Mathias schrieb am Freitag, 12. April 2024 um 07:50:42 UTC+2:
I really could use some help getting my project up for development after moving to gwt 2.10 and Java 11.
I can unfortunately nolonger use the GWT intellij plugin i've loved and used for 12 years apparently, and i'm struggling a bit to get the codeserver running for my project.

CURRENT STATUS:
My project is over 12 years, but i migrated it from the old gwt mojo plugin to the new tbroyer one last year.
It builds into a war fine and deploys on tomcat. Prior to the migration to GWT 2.10 (with new Jetty) and Java 11, i could run it with the GWT Intellij plugin, which I've loved and used for those same 12 years. 
But now the plugin unfortunately doesn't work, and from what I can tell due to the JettyLauncher, (I get lots of classnotfounds for for example javax.sql.DataSource)  it's kind of impossible to make it run? So I thought I'd try what people have been saying, move to the manual thing with server and code server, even though it's a more cumbersome setup.

As part of trying to get this show on the road, i created an archetype project and got codeserver and server running according to the new v2 tutorial. This works fine.

PROBLEM:
Basically i can't get the codeserver to run. My project is pretty large so my "webclient" module that contains my gwt client has a bunch of dependencies on my own child modules, and a couple of third-party ones such as Lombok.


When i try the codeserver with this command (from the tutorial)
 mvn gwt:codeserver -pl webclient -am

,where the webclient is the module containing the gwt code and entry point, standing in the root dir of my project,
,i get page up and page down filled with missing dependencies from stuff and "did you forget to inherit"-errors. (see error extract at the bottom)

-I'm not sure if this has something to do with the "workdir", the directory i stand in when i try to start the codeserver as described above, some dependency declaration i'm missing or something else.

-My dependencies should be ok since i can build it with the plugin, so i'm a bit at a loss as to how make this work.

-Help would be much appreciated, right now i can't develop and rolling our project back to 2.8 and Java 8 wouldn't be great and take time. Man how I wish that the intellij plugin had just kept working.

as a final aside:
The "neither a gwt-lib or jar" warning messages in the error log below - i still get it if i add the gwt-lib type to the dependency, and the archetype project prints the same error when created.

Extract from the error log:

[INFO] Ignoring com.myproject:generalcommons:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webshared:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webmaps:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webshared:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Turning off precompile in incremental mode.
[INFO] Super Dev Mode starting up
[INFO]    workDir: /Users/mathias/.projects/myproject/target/gwt/codeserver
[INFO]    [WARN] Deactivated PrecompressLinker
[INFO] 19:00:51.710 [main] INFO org.eclipse.jetty.util.log - Logging initialized @778ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO] 19:00:51.714 [main] DEBUG org.eclipse.jetty.http.PreEncodedHttpField - HttpField encoders loaded: [org.eclipse.jetty.http.Http1FieldPreEncoder]
[INFO]    Loading Java files in com.myproject.client.
[INFO]    Tracing compile failure path for type 'com.myproject.client.domain.group.GroupDragDropLayout'
[INFO]       [ERROR] Errors in 'file:/Users/mathias/.projects/myproject/webgwtcommons/src/main/java/com/myproject/client/domain/group/GroupDragDropLayout.java'
[INFO]          [ERROR] Line 18: The import lombok cannot be resolved
[INFO]          [ERROR] Line 7: The import com.myproject.common cannot be resolved
[INFO]          [ERROR] Line 32: Getter cannot be resolved to a type
[INFO]          [ERROR] Line 114: CSConstants cannot be resolved to a variable
[INFO]    Tracing compile failure path for type 'com.google.gwt.validation.client.impl.ConstraintFinderImpl'
[INFO]       [ERROR] Errors in 'jar:file:/Users/mathias/.m2/repository/org/gwtproject/gwt-user/2.10.0/gwt-user-2.10.0.jar!/com/google/gwt/validation/client/impl/ConstraintFinderImpl.java'
[INFO]          [ERROR] Line 38: No source code is available for type javax.validation.metadata.ElementDescriptor.ConstraintFinder; did you forget to inherit a required module?
[INFO]          [ERROR] Line 70: No source code is available for type javax.validation.metadata.ConstraintDescriptor<T>; did you forget to inherit a required module?
[INFO]          [ERROR] Line 99: No source code is available for type javax.validation.groups.Default; did you forget to inherit a required module?
[INFO]          [ERROR] Line 88: No source code is available for type javax.validation.metadata.Scope; did you forget to inherit a required module?
[INFO]       [ERROR] Errors in 'jar:file:/Users/mathias/.m2/repository/org/gwtproject/gwt-user/2.10.0/gwt-user-2.10.0.jar!/com/google/gwt/validation/client/impl/metadata/BeanMetadata.java'

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/c22d7880-e7f7-44ac-b6f2-465f95b203bdn%40googlegroups.com.

Re: Really need help getting CodeServer to run with Java 11 and GWT 2.10

This project has many good examples to check out https://github.com/NaluKit/nalu-examples, it help me a lot.

Il giorno venerdì 12 aprile 2024 alle 14:39:16 UTC+2 Mathias ha scritto:
Hey Jens, thanks for replying!

re. the gwt-type:

1. I only have one maven module that contains the entry point. the "gwt client" module
2. All dependencies are either on third-party such as Lombok, or my own other modules that only contain java classes and are built as jar-files.
3. I added the "type" gwt-lib to the dependencies in the "gwt client" pom, but I didn't do anything to the pom files in the jar modules that the gwt client depend on. I mean, Lombok doesn't have a packaging <packaging>gwt-lib</packaging> in its pom, either. 

On Friday 12 April 2024 at 11:15:38 UTC+2 Jens wrote:
A full example for multiple maven modules (more than just three) can be found here: https://github.com/tbroyer/gwt-maven-plugin/tree/main/src/it/e2e

You have to add <packaging>gwt-lib</packaging> to your own maven library modules that contain a module.gwt.xml file. Maybe you forgot that?

-- J.

Mathias schrieb am Freitag, 12. April 2024 um 07:50:42 UTC+2:
I really could use some help getting my project up for development after moving to gwt 2.10 and Java 11.
I can unfortunately nolonger use the GWT intellij plugin i've loved and used for 12 years apparently, and i'm struggling a bit to get the codeserver running for my project.

CURRENT STATUS:
My project is over 12 years, but i migrated it from the old gwt mojo plugin to the new tbroyer one last year.
It builds into a war fine and deploys on tomcat. Prior to the migration to GWT 2.10 (with new Jetty) and Java 11, i could run it with the GWT Intellij plugin, which I've loved and used for those same 12 years. 
But now the plugin unfortunately doesn't work, and from what I can tell due to the JettyLauncher, (I get lots of classnotfounds for for example javax.sql.DataSource)  it's kind of impossible to make it run? So I thought I'd try what people have been saying, move to the manual thing with server and code server, even though it's a more cumbersome setup.

As part of trying to get this show on the road, i created an archetype project and got codeserver and server running according to the new v2 tutorial. This works fine.

PROBLEM:
Basically i can't get the codeserver to run. My project is pretty large so my "webclient" module that contains my gwt client has a bunch of dependencies on my own child modules, and a couple of third-party ones such as Lombok.


When i try the codeserver with this command (from the tutorial)
 mvn gwt:codeserver -pl webclient -am

,where the webclient is the module containing the gwt code and entry point, standing in the root dir of my project,
,i get page up and page down filled with missing dependencies from stuff and "did you forget to inherit"-errors. (see error extract at the bottom)

-I'm not sure if this has something to do with the "workdir", the directory i stand in when i try to start the codeserver as described above, some dependency declaration i'm missing or something else.

-My dependencies should be ok since i can build it with the plugin, so i'm a bit at a loss as to how make this work.

-Help would be much appreciated, right now i can't develop and rolling our project back to 2.8 and Java 8 wouldn't be great and take time. Man how I wish that the intellij plugin had just kept working.

as a final aside:
The "neither a gwt-lib or jar" warning messages in the error log below - i still get it if i add the gwt-lib type to the dependency, and the archetype project prints the same error when created.

Extract from the error log:

[INFO] Ignoring com.myproject:generalcommons:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webshared:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webmaps:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webshared:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Turning off precompile in incremental mode.
[INFO] Super Dev Mode starting up
[INFO]    workDir: /Users/mathias/.projects/myproject/target/gwt/codeserver
[INFO]    [WARN] Deactivated PrecompressLinker
[INFO] 19:00:51.710 [main] INFO org.eclipse.jetty.util.log - Logging initialized @778ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO] 19:00:51.714 [main] DEBUG org.eclipse.jetty.http.PreEncodedHttpField - HttpField encoders loaded: [org.eclipse.jetty.http.Http1FieldPreEncoder]
[INFO]    Loading Java files in com.myproject.client.
[INFO]    Tracing compile failure path for type 'com.myproject.client.domain.group.GroupDragDropLayout'
[INFO]       [ERROR] Errors in 'file:/Users/mathias/.projects/myproject/webgwtcommons/src/main/java/com/myproject/client/domain/group/GroupDragDropLayout.java'
[INFO]          [ERROR] Line 18: The import lombok cannot be resolved
[INFO]          [ERROR] Line 7: The import com.myproject.common cannot be resolved
[INFO]          [ERROR] Line 32: Getter cannot be resolved to a type
[INFO]          [ERROR] Line 114: CSConstants cannot be resolved to a variable
[INFO]    Tracing compile failure path for type 'com.google.gwt.validation.client.impl.ConstraintFinderImpl'
[INFO]       [ERROR] Errors in 'jar:file:/Users/mathias/.m2/repository/org/gwtproject/gwt-user/2.10.0/gwt-user-2.10.0.jar!/com/google/gwt/validation/client/impl/ConstraintFinderImpl.java'
[INFO]          [ERROR] Line 38: No source code is available for type javax.validation.metadata.ElementDescriptor.ConstraintFinder; did you forget to inherit a required module?
[INFO]          [ERROR] Line 70: No source code is available for type javax.validation.metadata.ConstraintDescriptor<T>; did you forget to inherit a required module?
[INFO]          [ERROR] Line 99: No source code is available for type javax.validation.groups.Default; did you forget to inherit a required module?
[INFO]          [ERROR] Line 88: No source code is available for type javax.validation.metadata.Scope; did you forget to inherit a required module?
[INFO]       [ERROR] Errors in 'jar:file:/Users/mathias/.m2/repository/org/gwtproject/gwt-user/2.10.0/gwt-user-2.10.0.jar!/com/google/gwt/validation/client/impl/metadata/BeanMetadata.java'

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/bf5a8493-8af2-4814-8d1f-1ee7a50eab4en%40googlegroups.com.

Re: Really need help getting CodeServer to run with Java 11 and GWT 2.10

Hey Jens, thanks for replying!

re. the gwt-type:

1. I only have one maven module that contains the entry point. the "gwt client" module
2. All dependencies are either on third-party such as Lombok, or my own other modules that only contain java classes and are built as jar-files.
3. I added the "type" gwt-lib to the dependencies in the "gwt client" pom, but I didn't do anything to the pom files in the jar modules that the gwt client depend on. I mean, Lombok doesn't have a packaging <packaging>gwt-lib</packaging> in its pom, either. 

On Friday 12 April 2024 at 11:15:38 UTC+2 Jens wrote:
A full example for multiple maven modules (more than just three) can be found here: https://github.com/tbroyer/gwt-maven-plugin/tree/main/src/it/e2e

You have to add <packaging>gwt-lib</packaging> to your own maven library modules that contain a module.gwt.xml file. Maybe you forgot that?

-- J.

Mathias schrieb am Freitag, 12. April 2024 um 07:50:42 UTC+2:
I really could use some help getting my project up for development after moving to gwt 2.10 and Java 11.
I can unfortunately nolonger use the GWT intellij plugin i've loved and used for 12 years apparently, and i'm struggling a bit to get the codeserver running for my project.

CURRENT STATUS:
My project is over 12 years, but i migrated it from the old gwt mojo plugin to the new tbroyer one last year.
It builds into a war fine and deploys on tomcat. Prior to the migration to GWT 2.10 (with new Jetty) and Java 11, i could run it with the GWT Intellij plugin, which I've loved and used for those same 12 years. 
But now the plugin unfortunately doesn't work, and from what I can tell due to the JettyLauncher, (I get lots of classnotfounds for for example javax.sql.DataSource)  it's kind of impossible to make it run? So I thought I'd try what people have been saying, move to the manual thing with server and code server, even though it's a more cumbersome setup.

As part of trying to get this show on the road, i created an archetype project and got codeserver and server running according to the new v2 tutorial. This works fine.

PROBLEM:
Basically i can't get the codeserver to run. My project is pretty large so my "webclient" module that contains my gwt client has a bunch of dependencies on my own child modules, and a couple of third-party ones such as Lombok.


When i try the codeserver with this command (from the tutorial)
 mvn gwt:codeserver -pl webclient -am

,where the webclient is the module containing the gwt code and entry point, standing in the root dir of my project,
,i get page up and page down filled with missing dependencies from stuff and "did you forget to inherit"-errors. (see error extract at the bottom)

-I'm not sure if this has something to do with the "workdir", the directory i stand in when i try to start the codeserver as described above, some dependency declaration i'm missing or something else.

-My dependencies should be ok since i can build it with the plugin, so i'm a bit at a loss as to how make this work.

-Help would be much appreciated, right now i can't develop and rolling our project back to 2.8 and Java 8 wouldn't be great and take time. Man how I wish that the intellij plugin had just kept working.

as a final aside:
The "neither a gwt-lib or jar" warning messages in the error log below - i still get it if i add the gwt-lib type to the dependency, and the archetype project prints the same error when created.

Extract from the error log:

[INFO] Ignoring com.myproject:generalcommons:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webshared:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webmaps:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webshared:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Turning off precompile in incremental mode.
[INFO] Super Dev Mode starting up
[INFO]    workDir: /Users/mathias/.projects/myproject/target/gwt/codeserver
[INFO]    [WARN] Deactivated PrecompressLinker
[INFO] 19:00:51.710 [main] INFO org.eclipse.jetty.util.log - Logging initialized @778ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO] 19:00:51.714 [main] DEBUG org.eclipse.jetty.http.PreEncodedHttpField - HttpField encoders loaded: [org.eclipse.jetty.http.Http1FieldPreEncoder]
[INFO]    Loading Java files in com.myproject.client.
[INFO]    Tracing compile failure path for type 'com.myproject.client.domain.group.GroupDragDropLayout'
[INFO]       [ERROR] Errors in 'file:/Users/mathias/.projects/myproject/webgwtcommons/src/main/java/com/myproject/client/domain/group/GroupDragDropLayout.java'
[INFO]          [ERROR] Line 18: The import lombok cannot be resolved
[INFO]          [ERROR] Line 7: The import com.myproject.common cannot be resolved
[INFO]          [ERROR] Line 32: Getter cannot be resolved to a type
[INFO]          [ERROR] Line 114: CSConstants cannot be resolved to a variable
[INFO]    Tracing compile failure path for type 'com.google.gwt.validation.client.impl.ConstraintFinderImpl'
[INFO]       [ERROR] Errors in 'jar:file:/Users/mathias/.m2/repository/org/gwtproject/gwt-user/2.10.0/gwt-user-2.10.0.jar!/com/google/gwt/validation/client/impl/ConstraintFinderImpl.java'
[INFO]          [ERROR] Line 38: No source code is available for type javax.validation.metadata.ElementDescriptor.ConstraintFinder; did you forget to inherit a required module?
[INFO]          [ERROR] Line 70: No source code is available for type javax.validation.metadata.ConstraintDescriptor<T>; did you forget to inherit a required module?
[INFO]          [ERROR] Line 99: No source code is available for type javax.validation.groups.Default; did you forget to inherit a required module?
[INFO]          [ERROR] Line 88: No source code is available for type javax.validation.metadata.Scope; did you forget to inherit a required module?
[INFO]       [ERROR] Errors in 'jar:file:/Users/mathias/.m2/repository/org/gwtproject/gwt-user/2.10.0/gwt-user-2.10.0.jar!/com/google/gwt/validation/client/impl/metadata/BeanMetadata.java'

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/50f03456-de14-4c00-b959-b16716f45f5en%40googlegroups.com.

Re: Really need help getting CodeServer to run with Java 11 and GWT 2.10

Fair enough mate, I just remarked on it since when I built the archetype from scratch and saw that, my first thought was "huh wonder why that is, surely it won't work now since it doesn't pull in the classes from shared", but it did :) 

On Friday 12 April 2024 at 11:20:01 UTC+2 Thomas Broyer wrote:
On Friday, April 12, 2024 at 7:50:42 AM UTC+2 Mathias wrote:
-My dependencies should be ok since i can build it with the plugin, so i'm a bit at a loss as to how make this work.

Dependencies for gwt:compile and gwt:codeserver aren't the same: https://tbroyer.github.io/gwt-maven-plugin/codeserver.html
You might have to either adjust the <scope> of dependencies (e.g. from provided to compile) or adjust the gwt:codeserver's classpathScope (e.g. from runtime to compile+runtime or compile)
 
as a final aside:
The "neither a gwt-lib or jar" warning messages in the error log below - i still get it if i add the gwt-lib type to the dependency, and the archetype project prints the same error when created.

Note that it's an info, not a warning 😉

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/023512cf-2680-4f82-937e-ef853cb1e422n%40googlegroups.com.

Help to undrerstand how to use domino-jackson and the annotation JSONMapper

I'm upgrading a old project and i want to replace the old gwt-jackson (https://dominokit.com/solutions/domino-jackson/v1)  with the domino-jackson project (https://github.com/DominoKit/domino-jackson).

It should be a simple transiction, but i cannot understand how to let the GWT compilation "see" the implementations classes of the ObjectMapper interface.

Here the "old" code from gwt-jackson

public static interface AltriMetadatiDTOMapper extends com.github.nmorel.gwtjackson.client.ObjectMapper<Map<String,List<MetadatoDTOGWT>>> {} 

 ... 

 AltriMetadatiDTOMapper altriMetadatiDTOMapper = GWT.create(AltriMetadatiDTOMapper.class); String jsonAltriMetadati = altriMetadatiDTOMapper.write(object);

Here the "new" code from domino-jackson

@org.dominokit.jackson.annotation.JSONMapper public interface AltriMetadatiDTOMapper extends org.dominokit.jackson.ObjectMapper<Map<String,List<MetadatoDTOGWT>>> {}

 ... 

 AltriMetadatiDTOMapper altriMetadatiDTOMapper = GWT.create(AltriMetadatiDTOMappe.class); String jsonAltriMetadati = altriMetadatiDTOMapper.write(object);

but it give to me this error

[ERROR] Errors in 'xxx.java' [INFO] [ERROR] Line 662: Rebind result 'xxx.AltriMetadatiDTOMapper' must be a class

Did anyone know what i'm doing wrong ?

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/bc645145-3583-48ea-a757-ec2a2ad700c5n%40googlegroups.com.

Re: Really need help getting CodeServer to run with Java 11 and GWT 2.10



On Friday, April 12, 2024 at 7:50:42 AM UTC+2 Mathias wrote:
-My dependencies should be ok since i can build it with the plugin, so i'm a bit at a loss as to how make this work.

Dependencies for gwt:compile and gwt:codeserver aren't the same: https://tbroyer.github.io/gwt-maven-plugin/codeserver.html
You might have to either adjust the <scope> of dependencies (e.g. from provided to compile) or adjust the gwt:codeserver's classpathScope (e.g. from runtime to compile+runtime or compile)
 
as a final aside:
The "neither a gwt-lib or jar" warning messages in the error log below - i still get it if i add the gwt-lib type to the dependency, and the archetype project prints the same error when created.

Note that it's an info, not a warning 😉

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/22b7fe06-6d3e-4215-979f-da5477c44508n%40googlegroups.com.

Re: Really need help getting CodeServer to run with Java 11 and GWT 2.10

A full example for multiple maven modules (more than just three) can be found here: https://github.com/tbroyer/gwt-maven-plugin/tree/main/src/it/e2e

You have to add <packaging>gwt-lib</packaging> to your own maven library modules that contain a module.gwt.xml file. Maybe you forgot that?

-- J.

Mathias schrieb am Freitag, 12. April 2024 um 07:50:42 UTC+2:
I really could use some help getting my project up for development after moving to gwt 2.10 and Java 11.
I can unfortunately nolonger use the GWT intellij plugin i've loved and used for 12 years apparently, and i'm struggling a bit to get the codeserver running for my project.

CURRENT STATUS:
My project is over 12 years, but i migrated it from the old gwt mojo plugin to the new tbroyer one last year.
It builds into a war fine and deploys on tomcat. Prior to the migration to GWT 2.10 (with new Jetty) and Java 11, i could run it with the GWT Intellij plugin, which I've loved and used for those same 12 years. 
But now the plugin unfortunately doesn't work, and from what I can tell due to the JettyLauncher, (I get lots of classnotfounds for for example javax.sql.DataSource)  it's kind of impossible to make it run? So I thought I'd try what people have been saying, move to the manual thing with server and code server, even though it's a more cumbersome setup.

As part of trying to get this show on the road, i created an archetype project and got codeserver and server running according to the new v2 tutorial. This works fine.

PROBLEM:
Basically i can't get the codeserver to run. My project is pretty large so my "webclient" module that contains my gwt client has a bunch of dependencies on my own child modules, and a couple of third-party ones such as Lombok.


When i try the codeserver with this command (from the tutorial)
 mvn gwt:codeserver -pl webclient -am

,where the webclient is the module containing the gwt code and entry point, standing in the root dir of my project,
,i get page up and page down filled with missing dependencies from stuff and "did you forget to inherit"-errors. (see error extract at the bottom)

-I'm not sure if this has something to do with the "workdir", the directory i stand in when i try to start the codeserver as described above, some dependency declaration i'm missing or something else.

-My dependencies should be ok since i can build it with the plugin, so i'm a bit at a loss as to how make this work.

-Help would be much appreciated, right now i can't develop and rolling our project back to 2.8 and Java 8 wouldn't be great and take time. Man how I wish that the intellij plugin had just kept working.

as a final aside:
The "neither a gwt-lib or jar" warning messages in the error log below - i still get it if i add the gwt-lib type to the dependency, and the archetype project prints the same error when created.

Extract from the error log:

[INFO] Ignoring com.myproject:generalcommons:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webshared:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webmaps:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webshared:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Turning off precompile in incremental mode.
[INFO] Super Dev Mode starting up
[INFO]    workDir: /Users/mathias/.projects/myproject/target/gwt/codeserver
[INFO]    [WARN] Deactivated PrecompressLinker
[INFO] 19:00:51.710 [main] INFO org.eclipse.jetty.util.log - Logging initialized @778ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO] 19:00:51.714 [main] DEBUG org.eclipse.jetty.http.PreEncodedHttpField - HttpField encoders loaded: [org.eclipse.jetty.http.Http1FieldPreEncoder]
[INFO]    Loading Java files in com.myproject.client.
[INFO]    Tracing compile failure path for type 'com.myproject.client.domain.group.GroupDragDropLayout'
[INFO]       [ERROR] Errors in 'file:/Users/mathias/.projects/myproject/webgwtcommons/src/main/java/com/myproject/client/domain/group/GroupDragDropLayout.java'
[INFO]          [ERROR] Line 18: The import lombok cannot be resolved
[INFO]          [ERROR] Line 7: The import com.myproject.common cannot be resolved
[INFO]          [ERROR] Line 32: Getter cannot be resolved to a type
[INFO]          [ERROR] Line 114: CSConstants cannot be resolved to a variable
[INFO]    Tracing compile failure path for type 'com.google.gwt.validation.client.impl.ConstraintFinderImpl'
[INFO]       [ERROR] Errors in 'jar:file:/Users/mathias/.m2/repository/org/gwtproject/gwt-user/2.10.0/gwt-user-2.10.0.jar!/com/google/gwt/validation/client/impl/ConstraintFinderImpl.java'
[INFO]          [ERROR] Line 38: No source code is available for type javax.validation.metadata.ElementDescriptor.ConstraintFinder; did you forget to inherit a required module?
[INFO]          [ERROR] Line 70: No source code is available for type javax.validation.metadata.ConstraintDescriptor<T>; did you forget to inherit a required module?
[INFO]          [ERROR] Line 99: No source code is available for type javax.validation.groups.Default; did you forget to inherit a required module?
[INFO]          [ERROR] Line 88: No source code is available for type javax.validation.metadata.Scope; did you forget to inherit a required module?
[INFO]       [ERROR] Errors in 'jar:file:/Users/mathias/.m2/repository/org/gwtproject/gwt-user/2.10.0/gwt-user-2.10.0.jar!/com/google/gwt/validation/client/impl/metadata/BeanMetadata.java'

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/d19e5ae9-95d2-4b29-aa0f-495d9e520141n%40googlegroups.com.

Thursday, April 11, 2024

Really need help getting CodeServer to run with Java 11 and GWT 2.10

I really could use some help getting my project up for development after moving to gwt 2.10 and Java 11.
I can unfortunately nolonger use the GWT intellij plugin i've loved and used for 12 years apparently, and i'm struggling a bit to get the codeserver running for my project.

CURRENT STATUS:
My project is over 12 years, but i migrated it from the old gwt mojo plugin to the new tbroyer one last year.
It builds into a war fine and deploys on tomcat. Prior to the migration to GWT 2.10 (with new Jetty) and Java 11, i could run it with the GWT Intellij plugin, which I've loved and used for those same 12 years. 
But now the plugin unfortunately doesn't work, and from what I can tell due to the JettyLauncher, (I get lots of classnotfounds for for example javax.sql.DataSource)  it's kind of impossible to make it run? So I thought I'd try what people have been saying, move to the manual thing with server and code server, even though it's a more cumbersome setup.

As part of trying to get this show on the road, i created an archetype project and got codeserver and server running according to the new v2 tutorial. This works fine.

PROBLEM:
Basically i can't get the codeserver to run. My project is pretty large so my "webclient" module that contains my gwt client has a bunch of dependencies on my own child modules, and a couple of third-party ones such as Lombok.


When i try the codeserver with this command (from the tutorial)
 mvn gwt:codeserver -pl webclient -am

,where the webclient is the module containing the gwt code and entry point, standing in the root dir of my project,
,i get page up and page down filled with missing dependencies from stuff and "did you forget to inherit"-errors. (see error extract at the bottom)

-I'm not sure if this has something to do with the "workdir", the directory i stand in when i try to start the codeserver as described above, some dependency declaration i'm missing or something else.

-My dependencies should be ok since i can build it with the plugin, so i'm a bit at a loss as to how make this work.

-Help would be much appreciated, right now i can't develop and rolling our project back to 2.8 and Java 8 wouldn't be great and take time. Man how I wish that the intellij plugin had just kept working.

as a final aside:
The "neither a gwt-lib or jar" warning messages in the error log below - i still get it if i add the gwt-lib type to the dependency, and the archetype project prints the same error when created.

Extract from the error log:

[INFO] Ignoring com.myproject:generalcommons:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webshared:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webmaps:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Ignoring com.myproject:webshared:jar:1.0-SNAPSHOT; neither a gwt-lib or jar:sources; Did you forget to use <type>gwt-lib</type> in the dependency declaration?
[INFO] Turning off precompile in incremental mode.
[INFO] Super Dev Mode starting up
[INFO]    workDir: /Users/mathias/.projects/myproject/target/gwt/codeserver
[INFO]    [WARN] Deactivated PrecompressLinker
[INFO] 19:00:51.710 [main] INFO org.eclipse.jetty.util.log - Logging initialized @778ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO] 19:00:51.714 [main] DEBUG org.eclipse.jetty.http.PreEncodedHttpField - HttpField encoders loaded: [org.eclipse.jetty.http.Http1FieldPreEncoder]
[INFO]    Loading Java files in com.myproject.client.
[INFO]    Tracing compile failure path for type 'com.myproject.client.domain.group.GroupDragDropLayout'
[INFO]       [ERROR] Errors in 'file:/Users/mathias/.projects/myproject/webgwtcommons/src/main/java/com/myproject/client/domain/group/GroupDragDropLayout.java'
[INFO]          [ERROR] Line 18: The import lombok cannot be resolved
[INFO]          [ERROR] Line 7: The import com.myproject.common cannot be resolved
[INFO]          [ERROR] Line 32: Getter cannot be resolved to a type
[INFO]          [ERROR] Line 114: CSConstants cannot be resolved to a variable
[INFO]    Tracing compile failure path for type 'com.google.gwt.validation.client.impl.ConstraintFinderImpl'
[INFO]       [ERROR] Errors in 'jar:file:/Users/mathias/.m2/repository/org/gwtproject/gwt-user/2.10.0/gwt-user-2.10.0.jar!/com/google/gwt/validation/client/impl/ConstraintFinderImpl.java'
[INFO]          [ERROR] Line 38: No source code is available for type javax.validation.metadata.ElementDescriptor.ConstraintFinder; did you forget to inherit a required module?
[INFO]          [ERROR] Line 70: No source code is available for type javax.validation.metadata.ConstraintDescriptor<T>; did you forget to inherit a required module?
[INFO]          [ERROR] Line 99: No source code is available for type javax.validation.groups.Default; did you forget to inherit a required module?
[INFO]          [ERROR] Line 88: No source code is available for type javax.validation.metadata.Scope; did you forget to inherit a required module?
[INFO]       [ERROR] Errors in 'jar:file:/Users/mathias/.m2/repository/org/gwtproject/gwt-user/2.10.0/gwt-user-2.10.0.jar!/com/google/gwt/validation/client/impl/metadata/BeanMetadata.java'

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/6e506cf5-c02f-4647-974e-da2ad6728727n%40googlegroups.com.

Re: Debugging the GWT application running in maven, version 2.11

The most up-to-date tutorial is https://www.gwtproject.org/gettingstarted-v2.html

It uses maven to setup a best-practice GWT project which should consist of three modules. One module that contains your GWT code and basically represents your UI, one module that contains your server side code that will become a *.war file and will be deployed to a servlet container and finally a shared project which allows you to share some common code between the UI and your server. You don't have to use maven, but at least you can use the tutorial to get an idea on how a project layout should be.

To debug your UI you have to use the browser dev tools and set breakpoints in the browser. To debug your server side code you would do it as with any other Java application and activate the Java Wire Debug Protocol (JWDP) on the JVM that runs the servlet container.

-- J.

Ayush Rawat schrieb am Donnerstag, 11. April 2024 um 09:08:26 UTC+2:
Recently I got a project on GWT. Had no idea what is this thing. Slowly figured out things here and there. There aren't many sources to lean from. I mostly went through ChatGPT and took help from it. It made me a demo project for login page, sign up page and connecting it to the mysql database. I worked on client-side, server-side and shared files.

In this project I made login page, sign up page, user entity, user service, user service async, user service implementation. As of now my frontend is working fine but can't able to connect it to the database. I am using Intellij Idea Ultimate version, and there is no way I can debug this code. 

Will this community help me to figure this out by sharing resources and you thoughts about this demo project. It's my third day working on this task, and I can't see things moving. I really need your suggestions guys,  if needed can share my code in zip file.

Also how can I debug this?

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/5ca25e42-280a-4840-871f-58cc1de7510dn%40googlegroups.com.

Wednesday, April 10, 2024

Debugging the GWT application running in maven, version 2.11

Recently I got a project on GWT. Had no idea what is this thing. Slowly figured out things here and there. There aren't many sources to lean from. I mostly went through ChatGPT and took help from it. It made me a demo project for login page, sign up page and connecting it to the mysql database. I worked on client-side, server-side and shared files.

In this project I made login page, sign up page, user entity, user service, user service async, user service implementation. As of now my frontend is working fine but can't able to connect it to the database. I am using Intellij Idea Ultimate version, and there is no way I can debug this code. 

Will this community help me to figure this out by sharing resources and you thoughts about this demo project. It's my third day working on this task, and I can't see things moving. I really need your suggestions guys,  if needed can share my code in zip file.

Also how can I debug this?

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/7c5e8dd1-4a99-41a2-864e-75b31ba1d945n%40googlegroups.com.

Re: How to unescape a JSONString?

Sorry, figured it out.  I needed a namespace:

@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public class RTCPeerConnection {
  public RTCPeerConnection(JavaScriptObject iceServersJsoArray) {
    super();
  }
  public native void close();
}

Now working great!  🙂

On Wednesday 10 April 2024 at 7:27:42 pm UTC+10 Craig Mitchell wrote:
You weren't kidding.  I checked the compiled JS, and there it is (with some smarts to minimise the JS it looks like):
    this.a = new U2b(d,c,(n = {
        iceServers: m
    },
    new RTCPeerConnection(n)));

Thanks for letting me know about JsonUtils.safeEval(...)  That is a better option.

I never had much luck with JsInterop.  I just tried it again, trying to map the RTCPeerConnection, but it doesn't work giving me "TypeError: Cannot read properties of undefined" when I try to instanciate it.  I also can't debug it, as I can't step into the constructor to see what's going wrong.

This was my failed attempt:

@JsType(isNative = true)
public class RTCPeerConnection {
  @JsConstructor
  public RTCPeerConnection(JavaScriptObject iceServersJsoArray) {
    super();
  }
  public native void close();
}


On Sunday 7 April 2024 at 4:20:48 am UTC+10 Thomas Broyer wrote:
There's no escaping. You have a string value, it stays a string value. If its content is JSON representing an array and you want that array, then indeed you have to parse the JSON.

It looks like there's a major misunderstanding about what GWT does with your code, and/or possibly where/when the code runs or something.
GWT "only" translates the Java syntax to JS (and also optimizes everything), and therefore comes with a library of classes that emulates the Java runtime core classes so they can also be translated the same way as your code. JSNI is an escape hatch to be able to "put JS syntax inside your Java syntax", but that's all.
In other words, if you have a string "[ 42, true, null ]" in a variable (that you retrieved from your server), if you call that method, it's exactly equivalent to this JS:
var iceServersJson = "[ 42, true, null ]";
var peerConnectionConfig = {
  iceServers: iceServersJson
};
i.e. the peerConnectionConfig object has an iceServers property whose value is just the iceServersJson string value.
GWT won't "magically" generate JS code at runtime replacing the value as-is to form some new JS each time, i.e. it won't become:
var peerConnectionConfig = {
  iceServers: [ 42, true, null ]
};
No, really, that Java/JSNI function is transformed to this JS function:
function createPeerConnection(iceServersJson) {
  var peerConnectionConfig = {
    iceServers: iceServersJson
  };
  return new RTCPeerConnection(peerConnectionConfig);
}
and then at one point you call it. It's your job to give it either a string value or parse the string value as JSON and passe the result.

Kudos to resurrecting a 15 years old post though! 🤣

BTW, you may want to prefer JsonUtils.safeEval(iceServersJson) here: https://www.gwtproject.org/javadoc/latest/com/google/gwt/core/client/JsonUtils.html (and actually you may want to move to using JsInterop rather than JSNI, and maybe Elemental 2)

On Saturday, April 6, 2024 at 8:01:13 AM UTC+2 ma...@craig-mitchell.com wrote:
I ran into this.  GWT is too smart sometimes.  :)

For my example, I was querying an API for WebRTC ICE servers, which returned a string which was a JSON array.

When I had:

private static native JavaScriptObject createPeerConnection(String iceServersJson) /*-{
  var peerConnectionConfig = {
    iceServers: iceServersJson
  };
  return new RTCPeerConnection(peerConnectionConfig);
}-*/;

GWT excaped the quotes, so iceServers switched from an array, to just a string, exactly like I asked it to.

So, really, I needed what Thomas suggested:

JavaScriptObject iceServersObj = ((JSONArray)JSONParser.parseStrict(iceServersJson)).getJavaScriptObject();

private static native JavaScriptObject createPeerConnection(JavaScriptObject iceServersJson) /*-{
  var peerConnectionConfig = {
    iceServers: iceServersJson
  };
  return new RTCPeerConnection(peerConnectionConfig);
}-*/;

Now I'm telling GWT it's a JSO, and GWT knows not to escape it.

On Monday 9 November 2009 at 10:25:24 pm UTC+11 Thomas Broyer wrote:


On Nov 9, 11:47 am, peterk <peter.ke...@gmail.com> wrote:
> I'm having some trouble dealing with escaping and unescaping of Java
> strings for encoding in JSON.
>
> I use JSONString to encode a Java string and that seems to work ok.
> For example, newlines turn into \n, tabs turn into \t and so on.
>
> However, given this escaped sequence back, how to I turn this back
> into an unescaped javastring wheren \n is turned into a newline and so
> on?
>
> If I use stringvalue() on the JSONString it just gives back the same
> json encoded string with the \n and \t encoding etc.
>
> Anyone have any ideas? :)

JSONParser.parse? ;-)

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/934498d5-4a73-48bf-91d3-56ea22aea829n%40googlegroups.com.

Re: How to unescape a JSONString?

You weren't kidding.  I checked the compiled JS, and there it is (with some smarts to minimise the JS it looks like):
    this.a = new U2b(d,c,(n = {
        iceServers: m
    },
    new RTCPeerConnection(n)));

Thanks for letting me know about JsonUtils.safeEval(...)  That is a better option.

I never had much luck with JsInterop.  I just tried it again, trying to map the RTCPeerConnection, but it doesn't work giving me "TypeError: Cannot read properties of undefined" when I try to instanciate it.  I also can't debug it, as I can't step into the constructor to see what's going wrong.

This was my failed attempt:

@JsType(isNative = true)
public class RTCPeerConnection {
  @JsConstructor
  public RTCPeerConnection(JavaScriptObject iceServersJsoArray) {
    super();
  }
  public native void close();
}


On Sunday 7 April 2024 at 4:20:48 am UTC+10 Thomas Broyer wrote:
There's no escaping. You have a string value, it stays a string value. If its content is JSON representing an array and you want that array, then indeed you have to parse the JSON.

It looks like there's a major misunderstanding about what GWT does with your code, and/or possibly where/when the code runs or something.
GWT "only" translates the Java syntax to JS (and also optimizes everything), and therefore comes with a library of classes that emulates the Java runtime core classes so they can also be translated the same way as your code. JSNI is an escape hatch to be able to "put JS syntax inside your Java syntax", but that's all.
In other words, if you have a string "[ 42, true, null ]" in a variable (that you retrieved from your server), if you call that method, it's exactly equivalent to this JS:
var iceServersJson = "[ 42, true, null ]";
var peerConnectionConfig = {
  iceServers: iceServersJson
};
i.e. the peerConnectionConfig object has an iceServers property whose value is just the iceServersJson string value.
GWT won't "magically" generate JS code at runtime replacing the value as-is to form some new JS each time, i.e. it won't become:
var peerConnectionConfig = {
  iceServers: [ 42, true, null ]
};
No, really, that Java/JSNI function is transformed to this JS function:
function createPeerConnection(iceServersJson) {
  var peerConnectionConfig = {
    iceServers: iceServersJson
  };
  return new RTCPeerConnection(peerConnectionConfig);
}
and then at one point you call it. It's your job to give it either a string value or parse the string value as JSON and passe the result.

Kudos to resurrecting a 15 years old post though! 🤣

BTW, you may want to prefer JsonUtils.safeEval(iceServersJson) here: https://www.gwtproject.org/javadoc/latest/com/google/gwt/core/client/JsonUtils.html (and actually you may want to move to using JsInterop rather than JSNI, and maybe Elemental 2)

On Saturday, April 6, 2024 at 8:01:13 AM UTC+2 ma...@craig-mitchell.com wrote:
I ran into this.  GWT is too smart sometimes.  :)

For my example, I was querying an API for WebRTC ICE servers, which returned a string which was a JSON array.

When I had:

private static native JavaScriptObject createPeerConnection(String iceServersJson) /*-{
  var peerConnectionConfig = {
    iceServers: iceServersJson
  };
  return new RTCPeerConnection(peerConnectionConfig);
}-*/;

GWT excaped the quotes, so iceServers switched from an array, to just a string, exactly like I asked it to.

So, really, I needed what Thomas suggested:

JavaScriptObject iceServersObj = ((JSONArray)JSONParser.parseStrict(iceServersJson)).getJavaScriptObject();

private static native JavaScriptObject createPeerConnection(JavaScriptObject iceServersJson) /*-{
  var peerConnectionConfig = {
    iceServers: iceServersJson
  };
  return new RTCPeerConnection(peerConnectionConfig);
}-*/;

Now I'm telling GWT it's a JSO, and GWT knows not to escape it.

On Monday 9 November 2009 at 10:25:24 pm UTC+11 Thomas Broyer wrote:


On Nov 9, 11:47 am, peterk <peter.ke...@gmail.com> wrote:
> I'm having some trouble dealing with escaping and unescaping of Java
> strings for encoding in JSON.
>
> I use JSONString to encode a Java string and that seems to work ok.
> For example, newlines turn into \n, tabs turn into \t and so on.
>
> However, given this escaped sequence back, how to I turn this back
> into an unescaped javastring wheren \n is turned into a newline and so
> on?
>
> If I use stringvalue() on the JSONString it just gives back the same
> json encoded string with the \n and \t encoding etc.
>
> Anyone have any ideas? :)

JSONParser.parse? ;-)

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/1826a2dc-6c1b-4b0c-99de-d6f48828c18an%40googlegroups.com.

Monday, April 8, 2024

Re: [ANN] JRS gwt-time 1.4.22/2.0.10 release

Hi, 

I'm using gwt-time (great work by the way), and I noticed that the TZDB is not updated for Mexico (two years ago Mexico stopped using DST). Is there a way to manually update the TZDB? 

Thanks in advance.

On Sunday, October 30, 2022 at 10:29:50 AM UTC-6 foal wrote:
Hi,

JRS gwt-time 1.4.22/2.0.10 has been released.

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/9f58ed8c-132c-4aae-9330-a692a43ff84fn%40googlegroups.com.

Friday, April 5, 2024

Re: How to unescape a JSONString?

I ran into this.  GWT is too smart sometimes.  :)

For my example, I was querying an API for WebRTC ICE servers, which returned a string which was a JSON array.

When I had:

private static native JavaScriptObject createPeerConnection(String iceServersJson) /*-{
  var peerConnectionConfig = {
    iceServers: iceServersJson
  };
  return new RTCPeerConnection(peerConnectionConfig);
}-*/;

GWT excaped the quotes, so iceServers switched from an array, to just a string, exactly like I asked it to.

So, really, I needed what Thomas suggested:

JavaScriptObject iceServersObj = ((JSONArray)JSONParser.parseStrict(iceServersJson)).getJavaScriptObject();

private static native JavaScriptObject createPeerConnection(JavaScriptObject iceServersJson) /*-{
  var peerConnectionConfig = {
    iceServers: iceServersJson
  };
  return new RTCPeerConnection(peerConnectionConfig);
}-*/;

Now I'm telling GWT it's a JSO, and GWT knows not to escape it.

On Monday 9 November 2009 at 10:25:24 pm UTC+11 Thomas Broyer wrote:


On Nov 9, 11:47 am, peterk <peter.ke...@gmail.com> wrote:
> I'm having some trouble dealing with escaping and unescaping of Java
> strings for encoding in JSON.
>
> I use JSONString to encode a Java string and that seems to work ok.
> For example, newlines turn into \n, tabs turn into \t and so on.
>
> However, given this escaped sequence back, how to I turn this back
> into an unescaped javastring wheren \n is turned into a newline and so
> on?
>
> If I use stringvalue() on the JSONString it just gives back the same
> json encoded string with the \n and \t encoding etc.
>
> Anyone have any ideas? :)

JSONParser.parse? ;-)

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/a57c3d85-8385-4021-bdd9-0082f8deffa8n%40googlegroups.com.

Re: NoClassDefFoundError on a particular class while running gwt:codeserver



On Thursday, April 4, 2024 at 9:29:21 PM UTC+2 dja...@gmail.com wrote:
Hi,

I can't seem to be able to point out what dependency I am missing while trying to run my gwt application in Devmode with gwt:codeserver.
I can  build the program, compile it and deploy it without a problem. However when I am trying to run it in devmode I am having this error :
java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl

I have included all dependencies related to hibernate in my pom.xml with the right versions of dependency I believe. 
What am I missing?

If it builds but does not "run" then it's likely a dependency scoping issue: https://tbroyer.github.io/gwt-maven-plugin/codeserver.html
Your Hibernate dependencies have <scope>provided</scope> so I would bet on that.

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/9a51cfc3-3728-4b15-a971-f1408da29349n%40googlegroups.com.

Thursday, April 4, 2024

Re: Session Management problem in flask application

Thank you very much @Jens for more useful information

On Thursday, April 4, 2024 at 9:54:49 PM UTC+5:30 Jens wrote:
2)i wants to test my flask app in same browser but i wants to different user login and if  new user login then previous user don't logout automatically  

If you use Chrome or a Chrome based browser then you could also create two chrome profiles. Profiles are fully independent of each other and you can open two windows, one with profile A active and the other with profile B active. I regularly use that with the ARC browser (a Chrome based browser) to fully separate work and personal stuff within the same browser.

How do you want your app to work?

If you really want different users in different tabs within the same browser then you can only use session-id cookies if each logged in user has its own URL and the session-id cookie is limited to that URL. I think Google does this because Google Groups allows you to login with multiple accounts and then switch between them. But if you activate that feature then the URL is like groups.google.com/u/0/.. for the first user and groups.google.com/u/1/.. for the second user. That way they can have a different set of cookies for each URL path (= user). If you don't want that then you cannot use cookies and you must store the session-id in memory in your browser app and send it via HTTP Header manually. However doing so means that you are logged out as soon as you close the tab because the session-id is lost then.


-- J. 

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/96f36e62-3015-4a53-925f-de29932342f5n%40googlegroups.com.

Saturday, March 30, 2024

Re: Problem with GWT?

There really isn't enough information here to guess what is happen - what else could have changed, like server version or configuration, any errors in your browser dev tools console?

On Tuesday, March 26, 2024 at 2:57:37 PM UTC-5 germ...@gmail.com wrote:
When I access the web page, it remains blank. I tried different browsers, even on different computers, and they all showed the same problem. I am using the gwt-2.8.2 SDK Until a few days ago, was it working correctly? 
The curious thing is that the website works locally, that is, it is normally displayed in the browser, but when the project is uploaded it is not displayed. 
Please I need help on what can happen. Thank you so much

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/93114622-43f1-478c-96a2-15208b8c91f6n%40googlegroups.com.

Thursday, March 28, 2024

Re: i have applied below CSP policy and changed my GWT version to 2.8.2 after that i am getting below error for PRC call ( to read Database and populate the data in UI and save data to DB) and button click ( front validations , read data from DB ..et

See https://github.com/gwtproject/gwt/issues/9578

On Wednesday, March 27, 2024 at 8:23:13 AM UTC+1 paparao....@gmail.com wrote:
i have applied below CSP policy and changed my GWT version to 2.8.2
after that i am getting below error for PRC call ( to read Database and populate the data in UI and save data to DB) and button click ( front validations , read data from DB ..etc).

Error Details :
java.lang.Exception: com.google.gwt.core.client.JavaScriptException: (EvalError) : Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' https://salesiq.zoho.com https://js.zohocdn.com https://static.zohocdn.com https://css.zohocdn.com/salesiq/  'nonce-ByDmqt7tbtEnVEDxmZslig=='".

my current csp policy :
script-src 'self' https://salesiq.zoho.com https://js.zohocdn.com https://static.zohocdn.com https://css.zohocdn.com/salesiq/ 'nonce-ByDmqt7tbtEnVEDxmZslig=='; object-src 'self'; img-src https: 'self' data:

my current code to make RPC call : 

protected AsyncCallback<List<BillToCompany>> getTeamBillToCompaniesByUser()

{

final String methodName = "getTeamBillToCompaniesByUser: ";

GWTLOG.info(methodName + " started");

return new AsyncCallback<List<BillToCompany>>()

{

@Override

public void onFailure(Throwable caught)

{

Exception ex = new Exception(caught);

GWTLOG.info(methodName + "onFailure" + "caught:" + ex);

}

@Override

public void onSuccess(List<BillToCompany> result)

{

GWTLOG.info(methodName + "onSuccess: billingAccnId: " + billingAccnId);

updateBillToListBox(result, true); //boolean onload = true

}

};

}


based on browser console message error is with below code 


  msg = com_google_gwt_logging_client_TextLogFormatter_$format__Lcom_google_gwt_logging_client_TextLogFormatter_2Ljava_util_logging_LogRecord_2Ljava_lang_String_2(this.java_util_logging_Handler_formatter, record);
    val = record.java_util_logging_LogRecord_level.intValue__I();
    val >= (java_util_logging_Level_$clinit__V(),
    $intern_38) ? (window.console.error(msg),
    undefined) : val >= 900 ? (window.console.warn(msg),
   
undefined) : val >= 800 ? (window.console.info(msg),
    undefined) : (window.console.log(msg),
    undefined);
    $JsStackEmulator_stackDepth = JsStackEmulator_stackIndex - 1;

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/f03b64e4-b452-4b94-9e56-7863fc741203n%40googlegroups.com.