Wednesday, October 16, 2024

Re: Error : No project found - Running GWT in client mode only

I am trying to set up a project where I want to use the GWT app on the client side only that is going to interact with another remote server.

Which server is going to host the GWT compiled JavaScript / HTML / ...?
1. If you'll have your own server, just leave the architecture as is, and write your calls to the external server in the the client.
2. If you need to host it on the external server, again, just leave the  architecture as is, as you can just copy the compiled GWT code across when you are ready to deploy.  But, if this is the situation, it's a bit crazy to not just make the external server a GWT app.

On Tuesday 15 October 2024 at 4:54:10 am UTC+11 Mukeya Kassindye wrote:
I am trying to set up a project where I want to use the GWT app on the client side only that is going to interact with another remote server.
However, before I implement the CORS option, I just want to run the client only part by eliminating all the server side code and deleting their corresponding module.
The GWT project is generated with the Tbroyer archetypes modular web-app.
This is what I did so far :
- copied the webapp folder from the web-project-server/src/main to web-project-client/src/main
- deleted the web-project-server and web-project-shared folders.
- updated the web-project-client's packaging from gwt-app to war
- kept the main pom packaging to "pom" because, soon the client's project is going to  have another modules(maven).
- deleted all reference to the two modules in the main pom.xml file.

So, if I run mvn clean install I can see that a war file is generated that can be deployed let's say to a Jboss/ wildfly server app.

However, from the main folder where the main pom.xml file is, I have an error of No project found if I run mvn gwt:codeserver -pl *-client -am

is there any other tweak I should consider on both poms xml file?
Notice that, if the packaging is kept to gwt-app in the client module, codeserver/devmode runs without a problem but I will have no reference the webapp files (index.html, css) because they won't be referenced.

Please advise.

this the content of my main pom.xml file : 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>web-app</artifactId>
  <version>HEAD-SNAPSHOT</version>
  <packaging>pom</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.gwtproject</groupId>
        <artifactId>gwt</artifactId>
        <version>2.11.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <build>
    <plugins>
      <plugin>
        <groupId>net.ltgt.gwt.maven</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <inherited>false</inherited>
        <configuration>
          <moduleName>com.example.WebAppClient</moduleName>
          <launcherDir>${project.build.directory}/gwt/launcherDir</launcherDir>
          <!-- To be able to use gwt:devmode (useful on Windows where Ctrl+C won't kill gwt:codeserver)-->
          <warDir>${project.build.directory}/gwt/launcherDir</warDir>
          <devmodeArgs>
            <arg>-noserver</arg>
            <arg>-startupUrl</arg>
            <arg>app/index.html</arg>
          </devmodeArgs>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.12.1</version>
          <configuration>
            <release>11</release>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.2.5</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <version>3.4.0</version>
        </plugin>
        <plugin>
          <groupId>org.eclipse.jetty</groupId>
          <artifactId>jetty-maven-plugin</artifactId>
          <version>11.0.19</version>
        </plugin>
        <plugin>
          <groupId>net.ltgt.gwt.maven</groupId>
          <artifactId>gwt-maven-plugin</artifactId>
          <version>1.1.0</version>
          <extensions>true</extensions>
          <configuration>
            <sourceLevel>11</sourceLevel>
            <failOnError>true</failOnError>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <modules>
    <module>web-app-client</module>
  </modules>
</project>


and this is the content of my client module pom.xml file : 
<?xml version="1.0" encoding="UTF-8"?>
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>com.example</groupId>
    <artifactId>web-app</artifactId>
    <version>HEAD-SNAPSHOT</version>
  </parent>

  <artifactId>web-app-client</artifactId>
  <!-- <packaging>gwt-app</packaging> -->
  <packaging>war</packaging>

  <dependencies>
    <dependency>
      <groupId>org.gwtproject</groupId>
      <artifactId>gwt-user</artifactId>
    </dependency>
    <dependency>
      <groupId>org.gwtproject</groupId>
      <artifactId>gwt-dev</artifactId>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>net.ltgt.gwt.maven</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <configuration>
          <moduleName>com.example.WebAppClient</moduleName>
          <moduleShortName>app</moduleShortName>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


what am i missing?

--
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/7030870f-8897-4ead-9e04-47d4138ced21n%40googlegroups.com.

Monday, October 14, 2024

Re: Digest for google-web-toolkit@googlegroups.com - 1 update in 1 topic

Hi Mukeya,

I've never worked with the GWT archetype. But what is probably the case is that the archetype configuration needs the specific folders and setup it's defined. 
If you want to use a generated setup, it's best to follow the instructions of said setup.
So it's a bit like buying a toy car, removing the wheels and then complain about the fact that the car isn't rolling anymore.

In your case, based on the compiler error my guess would be that the compiler can't find the required ProjectName.gwt.xml or the accompanying ProjectName class is not present (or the ProjectName class does not implement EntryPoint)

If you only want the client side result, the tweaks you are making are not necessary anyway. The GWT client code gets compiled to html & javascript. So to start -> there is no need to run the result as a war. But since there is no runtime java code remaining if you want client code only, you should also just be able to take the generated html&javascript from the GWT compilation and with the root HTML file (and the external CSS if you have it) you can just zip it, and copy it over to your webserver. You can use the maven assembly plugin to generate the zip file.

In that case it doesn't matter if you have the whole generated structure from the archetype generation, but atleast you can be sure it works. You can always tweak that setup later, once you get more at home with the GWT plugin. 

rg,

Leon.





On Mon, Oct 14, 2024 at 10:56 PM <google-web-toolkit@googlegroups.com> wrote:
Mukeya Kassindye <djasy3@gmail.com>: Oct 14 10:54AM -0700

I am trying to set up a project where I want to use the GWT app on the
client side only that is going to interact with another remote server.
However, before I implement the CORS option, I just want to run the client
only part by eliminating all the server side code and deleting their
corresponding module.
The GWT project is generated with the Tbroyer archetypes modular web-app.
This is what I did so far :
- copied the webapp folder from the web-project-server/src/main to
web-project-client/src/main
- deleted the web-project-server and web-project-shared folders.
- updated the web-project-client's packaging from gwt-app to war
- kept the main pom packaging to "pom" because, soon the client's project
is going to have another modules(maven).
- deleted all reference to the two modules in the main pom.xml file.
 
So, if I run *mvn clean install *I can see that a war file is generated
that can be deployed let's say to a Jboss/ wildfly server app.
 
However, from the main folder where the main pom.xml file is, I have an
error of *No project found* if I run *mvn gwt:codeserver -pl *-client -am*
 
is there any other tweak I should consider on both poms xml file?
Notice that, if the packaging is kept to *gwt-app* in the client module,
codeserver/devmode runs without a problem but I will have no reference the
webapp files (index.html, css) because they won't be referenced.
 
Please advise.
 
this the content of my main pom.xml file :
 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>web-app</artifactId>
<version>HEAD-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gwtproject</groupId>
<artifactId>gwt</artifactId>
<version>2.11.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<moduleName>com.example.WebAppClient</moduleName>
<launcherDir>${project.build.directory}/gwt/launcherDir</
launcherDir>
<!-- To be able to use gwt:devmode (useful on Windows where
Ctrl+C won't kill gwt:codeserver)-->
<warDir>${project.build.directory}/gwt/launcherDir</warDir>
<devmodeArgs>
<arg>-noserver</arg>
<arg>-startupUrl</arg>
<arg>app/index.html</arg>
</devmodeArgs>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>11.0.19</version>
</plugin>
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1.0</version>
<extensions>true</extensions>
<configuration>
<sourceLevel>11</sourceLevel>
<failOnError>true</failOnError>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<modules>
<module>web-app-client</module>
</modules>
</project>
 
 
and this is the content of my client module pom.xml file :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
 
<parent>
<groupId>com.example</groupId>
<artifactId>web-app</artifactId>
<version>HEAD-SNAPSHOT</version>
</parent>
 
<artifactId>web-app-client</artifactId>
<!-- <packaging>gwt-app</packaging> -->
<packaging>war</packaging>
 
<dependencies>
<dependency>
<groupId>org.gwtproject</groupId>
<artifactId>gwt-user</artifactId>
</dependency>
<dependency>
<groupId>org.gwtproject</groupId>
<artifactId>gwt-dev</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<moduleName>com.example.WebAppClient</moduleName>
<moduleShortName>app</moduleShortName>
</configuration>
</plugin>
</plugins>
</build>
</project>
 
 
what am i missing?
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to google-web-toolkit+unsubscribe@googlegroups.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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CABjQu7TMhqTsRqCXKQYpKfnUgND5M1k%2Bxh8hBFf7g1_V1DpEyw%40mail.gmail.com.

Error : No project found - Running GWT in client mode only

I am trying to set up a project where I want to use the GWT app on the client side only that is going to interact with another remote server.
However, before I implement the CORS option, I just want to run the client only part by eliminating all the server side code and deleting their corresponding module.
The GWT project is generated with the Tbroyer archetypes modular web-app.
This is what I did so far :
- copied the webapp folder from the web-project-server/src/main to web-project-client/src/main
- deleted the web-project-server and web-project-shared folders.
- updated the web-project-client's packaging from gwt-app to war
- kept the main pom packaging to "pom" because, soon the client's project is going to  have another modules(maven).
- deleted all reference to the two modules in the main pom.xml file.

So, if I run mvn clean install I can see that a war file is generated that can be deployed let's say to a Jboss/ wildfly server app.

However, from the main folder where the main pom.xml file is, I have an error of No project found if I run mvn gwt:codeserver -pl *-client -am

is there any other tweak I should consider on both poms xml file?
Notice that, if the packaging is kept to gwt-app in the client module, codeserver/devmode runs without a problem but I will have no reference the webapp files (index.html, css) because they won't be referenced.

Please advise.

this the content of my main pom.xml file : 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>web-app</artifactId>
  <version>HEAD-SNAPSHOT</version>
  <packaging>pom</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.gwtproject</groupId>
        <artifactId>gwt</artifactId>
        <version>2.11.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <build>
    <plugins>
      <plugin>
        <groupId>net.ltgt.gwt.maven</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <inherited>false</inherited>
        <configuration>
          <moduleName>com.example.WebAppClient</moduleName>
          <launcherDir>${project.build.directory}/gwt/launcherDir</launcherDir>
          <!-- To be able to use gwt:devmode (useful on Windows where Ctrl+C won't kill gwt:codeserver)-->
          <warDir>${project.build.directory}/gwt/launcherDir</warDir>
          <devmodeArgs>
            <arg>-noserver</arg>
            <arg>-startupUrl</arg>
            <arg>app/index.html</arg>
          </devmodeArgs>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.12.1</version>
          <configuration>
            <release>11</release>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.2.5</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <version>3.4.0</version>
        </plugin>
        <plugin>
          <groupId>org.eclipse.jetty</groupId>
          <artifactId>jetty-maven-plugin</artifactId>
          <version>11.0.19</version>
        </plugin>
        <plugin>
          <groupId>net.ltgt.gwt.maven</groupId>
          <artifactId>gwt-maven-plugin</artifactId>
          <version>1.1.0</version>
          <extensions>true</extensions>
          <configuration>
            <sourceLevel>11</sourceLevel>
            <failOnError>true</failOnError>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <modules>
    <module>web-app-client</module>
  </modules>
</project>


and this is the content of my client module pom.xml file : 
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>com.example</groupId>
    <artifactId>web-app</artifactId>
    <version>HEAD-SNAPSHOT</version>
  </parent>

  <artifactId>web-app-client</artifactId>
  <!-- <packaging>gwt-app</packaging> -->
  <packaging>war</packaging>

  <dependencies>
    <dependency>
      <groupId>org.gwtproject</groupId>
      <artifactId>gwt-user</artifactId>
    </dependency>
    <dependency>
      <groupId>org.gwtproject</groupId>
      <artifactId>gwt-dev</artifactId>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>net.ltgt.gwt.maven</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <configuration>
          <moduleName>com.example.WebAppClient</moduleName>
          <moduleShortName>app</moduleShortName>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


what am i missing?

--
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/07799cc7-b5c4-4cc5-90d3-69e3007fb7edn%40googlegroups.com.

Wednesday, October 9, 2024

Re: java.time support

Hi Jasper,

besides the fact that you don't need to worry for java.util.Date until the year 292278994, there is always the possibility to implement your own value object for a Date in GWT.
You can also use 3 party custom Date implementations too, as long as you include the source for the GWT compiler, and as long as that implementation is based on GWT supported building blocks.

rg,

Leon.

Op woensdag 9 oktober 2024 om 18:26:28 UTC+2 schreef Colin Alworth:
On the server, java.util.Date is unaffected as Jens pointed out - it is not backed by a 32-bit int, but a 64-bit int. Your swing and web implementations will be able to use java.util.Date beyond 2038:

Here's plain Java, using jshell to demonstrate that this will work with much larger dates than a decade away:

jshell> new java.util.Date(Long.MAX_VALUE)
$1 ==> Sun Aug 17 01:12:55 CST 292278994


As he also pointed out, you _can_ use java.time using the linked package, but the java.time APIs are not very conducive to emulation in the browser, so any emulation will always be a subset of the full possible functionality that a regular JVM has.
On Wednesday, October 9, 2024 at 10:08:42 AM UTC-5 blackh...@gmail.com wrote:
So web is not going to be worried, but... :) 
We have user interfaces for both thick (swing) and web using dates and now we need to use java.util.Date as this is supported by GWT.
Is there a way to use anything else than java.util.Date that is supported by GWT? 

Op wo 9 okt 2024 om 16:51 schreef Jens <jens.ne...@gmail.com>:
Here is a link about the year 2038 problem: https://en.wikipedia.org/wiki/Year_2038_problem

Ah ok, thats where you are coming from.

JavaScript/ECMAScript defines that JavaScript Date supports exactly 100000000 days before and after unix epoch. This gives us a maximum year of 275760 that JavaScript Date can currently represent.

Java itself uses a long to represent millis since epoch in java.util.Date. Because long is 64 bit the maximum year that java.util.Date can represent is 292278994.

JavaScript: 275760
Java: 292278994

Since GWT emulates java.util.Date using native JavaScript Date the max year in GWT code is the one of JavaScript.

In any case year 2038 shouldn't be a problem, thats why I asked. You can easily verify it in browser console using

var millis = Date.parse("2040-06-01");
var date = new Date(millis);
console.log(date);

-- 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-tool...@googlegroups.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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/94413017-4940-4332-a8eb-64ee097baaf7n%40googlegroups.com.

Re: How to create Utilities method allow serizalization and deserialization request payload and response payload.

To reiterate, if performance isn't important, you will likely be far far better off writing a quick screen scraper (such as with selenium, etc). Even if it has to load the page, read 10 rows at a time, click next, wait 3s to load, repeat, it will probably take longer to write than to run.

If you have a specific question about part of the full payload, you should share the details you've worked out so far and the part of the payload you have the question about, but it isn't going to make sense to share the full contents on the mailing list and have us give you a strategy (as it will probably just be what has already been discussed). You may not have all of the details, but you have a lot more than we do, and you can very likely us that context to work out what the format is - consider comparing your guess of what the data is with what you see in the UI.

The order of the data is what the linked post/document suggests - read the payload backwards starting just before the string array. Nothing is jumbled, the order you read values (in reverse) is the order that the data was written, starting from the list that holds the objects. The request order isn't quite the same (the string table is part of the |-delimited array, with a count before the first string, then the payload values in order, rather than reverse), but it is close enough that once you work out the structure of any given type in either request or response, it will be the same for both.

If this is public data, also consider contacting the organization that makes it available, it's always possible they might be able to share more directly?

Finally, depending on the particulars of this, it might be possible to contract with me directly to help write this for you, if that makes sense. If so, please email me at colin@vertispan.com to discuss more.

On Wednesday, October 9, 2024 at 8:50:59 PM UTC-5 cuon...@gmail.com wrote:
Thank to Craig and Colin,

I spent all day to know the stackoverflow post and document Colin provided. Yeah, I know some (not all) rules of request payload, and I can use it to replace param. But the response deserialization is hard, you not mention in you answer, my goal still be parse the response receive from server. 

I need crawl 10000 users via GWT RPC, it is single-time crawl (I crawl it once) for my service. So, the performance is not important.

Again, I know some data from server (response2.png) I attached before, There is a Json, start with //OK, next is Array with 2045 elements (0-2044), element from 0 - 2041 is something to confusing, element 2042 is an array list, it is arranged in a jumble, maybe above data (element from 0-2041) contains order of this.

If you need the exactly response payload, please reply and I public it.
Vào lúc 11:13:42 UTC+7 ngày Thứ Tư, 9 tháng 10, 2024, Craig Mitchell đã viết:
I second what Colin says "Since you're scraping anyway, consider just scraping the results of the rendered page? This will likely take substantially more CPU time, but ridiculously less developer time to implement."

GWT RPC is not an API.  It will constantly change as the website updates.

I'd recommend either using a proper API (if one exists), or an off-the-shelf scraper tool.

On Wednesday 9 October 2024 at 4:40:08 am UTC+11 Colin Alworth wrote:
I'd suggest reading the stream reader/write subtypes of AbstractSerializationStream to understand what all of the values are for - in short, a gwt-rpc response is a payload and a string table, and the payloads elements will reference the string table. You cannot know what the structure is for certain without seeing the original Java types being serialized, but often you can make good guesses.

I'd also suggest reading stackoverflow posts and the like showing how to deserialize other payloads just from context - here's a post that breaks down a payload to understand its contents: https://stackoverflow.com/questions/35047102/serializing-rpc-gwt/35047887#35047887


In short though, your response value is _probably_ be a List of CourseMember types - knowing that class will help you. I can't easily guess more though, as the above doc says, the json array is read backwards, so the important details would be right before and after the string array - you have 1,7,2,1[...strings...] in the second image. From that I can say

1: if this was zero, it would be a null, since it is a positive number, read the (value - 1) entry from the string table, which is ArrayList, so: read a value of type ArrayList from the stream
7: the ArrayList has 7 items
2: first item in the arraylist - as above, if this was 0, it would be null, since it is positive, read the (value - 1) entry from the string table, and decode that type, so: read a CourseMember object from the payload
1: this is _probably_ the number 1 in the first field of the first CourseMember.
...

A parser continuing in this way, with knowledge of the structure of these types could be written to decode this payload. I don't know of an off-the-shelf tool that will do it for you in a truly automated way, but could consult to write one, or guide your project in implementing one by hand.

Since you're scraping anyway, consider just scraping the results of the rendered page? This will likely take substantially more CPU time, but ridiculously less developer time to implement.

On Tuesday, October 8, 2024 at 12:03:30 PM UTC-5 cuon...@gmail.com wrote:
Thank you because the detail response.

I want to crawl data on a public website, I opened devtools and saw that it was written by GWT RPC.

This is the body of request I saw: 

7|0|10|https://a.b.c.d/e|5C6CDB13D0FD25B266F3C36FA7FF6ED9|a1.a2.a3.DataService|getCourseMembers|java.lang.Long/4227064769|java.lang.String/2004016611|java.util.List|20204524|java.util.Arrays$ArrayList/2507071751|20241|1|2|3|4|3|5|6|7|5|TXbrzIAAA|8|9|1|6|10|

As you can see, no problem with that syntax, I can understand roughly, I know the method is getCourseMembers. I want to build a function should return above body, like: 
                  public static String getBodyEncoded(String methodName, ... String methodBody ...) or something similar, and return the body above to send to server.

I also want to know the last past of request syntax:
                 1|2|3|4|1|5|6|7|7|8|7|9|7|10|7|11|7|12|7|13|7|14|

The next is the response body. This is really the problem. A response is very long, I put it in attached files.

I saw a JsonArray with more than 2000 elements, and I cannot understand what are they. The only thing I understand is the 2042nd element, it contains an unorder list. Maybe some elements before contains data about the order.

I want to build a method to extract/deserialize this response.

I am a newbie, if my question can be completed, can you guide me with more details, please?
Java is good, but other languages are acceptable, I still can deploy it.

--
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/6f547d38-830d-4e2e-ba90-a16bfe6a781bn%40googlegroups.com.