Re: Deploying symbolMaps in a production build

2017-11-15 Thread Thomas Broyer
The gwt-site-webapp also has such configuration; it's used for the 
menu/navigation at http://www.gwtproject.org

https://gwt.googlesource.com/gwt-site-webapp (see pom.xml and *.gwt.xml files)

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying symbolMaps in a production build

2017-11-15 Thread Ignacio Baca Moreno-Torres
https://github.com/ibaca/rxcanvas-gwt 😅

On Thursday, November 16, 2017 at 12:08:44 AM UTC+1, Ignacio Baca 
Moreno-Torres wrote:
>
> FYI this project is a working example of deploying a gwt app with source 
> maps. The pom is configured to included both the source map and the java 
> sources. I use site.sh to deploy as a github page.
>
> On Wednesday, November 15, 2017 at 9:40:26 PM UTC+1, AJ wrote:
>>
>> Thanks Colin.
>> That look like exactly what I need.
>> This will be a 'production' url we use to debug the issue and then 
>> re-deploy the 'real' build once we have stepped the code and found the 
>> offending null point.
>>
>> Nice to know about the stack trace.
>>
>> Thank you very much for the very detailed reply.
>>
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying symbolMaps in a production build

2017-11-15 Thread Ignacio Baca Moreno-Torres
FYI this project is a working example of deploying a gwt app with source 
maps. The pom is configured to included both the source map and the java 
sources. I use site.sh to deploy as a github page.

On Wednesday, November 15, 2017 at 9:40:26 PM UTC+1, AJ wrote:
>
> Thanks Colin.
> That look like exactly what I need.
> This will be a 'production' url we use to debug the issue and then 
> re-deploy the 'real' build once we have stepped the code and found the 
> offending null point.
>
> Nice to know about the stack trace.
>
> Thank you very much for the very detailed reply.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying symbolMaps in a production build

2017-11-15 Thread AJ
Thanks Colin.
That look like exactly what I need.
This will be a 'production' url we use to debug the issue and then 
re-deploy the 'real' build once we have stepped the code and found the 
offending null point.

Nice to know about the stack trace.

Thank you very much for the very detailed reply.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying symbolMaps in a production build

2017-11-15 Thread Colin Alworth
Symbol maps are distinct from source maps, the serve different purposes. 
Sourcemaps, when deployed with your actual source, allow the browser to ask 
the server for your Java source, so you can see if when you debug - this 
may not be something most production applications want their customers to 
be able to find.

In contrast, symbol maps are used by the server, so when the client sends 
the server a stack trace, it can figure out what that stack trace should 
have looked like in Java (see 
com.google.gwt.core.server.StackTraceDeobfuscator). This will work without 
enabling sourcemaps.

The "// #sourceURL=" is used to say to the browser "pretend that this 
string you are eval()ing is actually a file with this name and path". If 
used in conjunction with sourcemaps, then *if you have deployed sourcemaps*, 
viewing the source in your browser will show all Java classes.

To turn on production sourcemaps, add this to your .gwt.xml file (assuming 
the CrossSiteIframeLinker, which it appears you are using) if you just want 
them always on (assumes one permutation):

  

If you have more than one permutation, you'll want to set up a pattern in 
here, based on the docs in CrossSiteIframeLinker.gwt.xml:
  

This only adds the missing "// #sourceMappingURL=" to your output, but the 
sourcemaps has to actually be there for you to use it, and in the right 
place - using those custom URL features will help you change where it goes. 

Keep in mind that your webserver will not serve any content in WEB-INF/, so 
you'll need to build those somewhere else for the client to see it (see the 
-deploy flag). You would also need to add all of your java sources, and 
they are also expected to be found in the same directory as the sourcemap 
file, and remember that this may allow your users to see the app's sources.



On Tuesday, November 14, 2017 at 7:34:40 AM UTC-6, AJ wrote:
>
> Hello,
> I have an issue that only manifests in a deployed GWT application and so 
> am trying to enable source maps in the production build.
>
> I have added...
>
> 
> 
>
> ...to the project.ui.xml file and have passed -saveSource to the compiler
>
> In my war I see the WEB-INF/deploy/ProjectName/symbolMaps folder
>  containing 1A2B3C.symbolMap and 1A2B3C_sourceMap0.json
>
> My understanding is that I need to have the following comment at the 
> bottom of the various generated javascript files which are pulled in by the 
> bootstrap code
> //# sourceMappingURL=myUrl
>
> so I should see that at the bottom of 1A2B3C.cache.js found in the project 
> folder of the war (same folder as myProject.nocache.js)
>
> What I see at the end of that file is...
>
> //# sourceURL=Utmc-0.js
>
> ... and this is what is delivered in chrome devtools when I try to find 
> the source
>
> Has anyone else tried this and, if so, 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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic values in json parsing with GWT

2017-11-15 Thread Thomas Broyer


On Wednesday, November 15, 2017 at 11:19:56 AM UTC+1, Jens wrote:
>
>
> Thanks for the early response. Can you give an example of getData(String 
>> key) method.
>>
>
> Sure, assuming your values are only strings you can do
>
> public native String getData(String key) /*-{
>   return this.data[key];
> }-*/;
>
> If your values can also be number, boolean, JS Object you need additional 
> methods, possibly also doing some type checking. 
>
> Given that JSNI won't work in future GWT I would really take a look at 
> jsinterop.base.JsPropertyMap which is a generic class to work on JavaScript 
> objects.
>
> https://github.com/google/jsinterop-base/blob/master/java/jsinterop/base/JsPropertyMap.java
>

@JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL)
public class Result {
  String[] columns; // or JsArrayLike
  JsPropertyMap data;
}

That should be enough (and much much simpler/shorter than with JSNI).

Migrating a JSNI getData(String):String to JsInterop would be quite easy 
too:

@JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL)
public class Result {
  @JsProperty public native String[] getColumns();
  @JsOverlay public String getData(String key) {
return getData().get(key);
  }
  @JsProperty private native JsPropertyMap getData();
}



-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic values in json parsing with GWT

2017-11-15 Thread Kirill Prazdnikov
JSNI is not recommended. 

If you can assign types, go with JsInterop, if not -> then you have a map 
String->?

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic values in json parsing with GWT

2017-11-15 Thread Abhishek Banerjee
Thanks a bunch!!

On Wednesday, 15 November 2017 15:49:56 UTC+5:30, Jens wrote:
>
>
> Thanks for the early response. Can you give an example of getData(String 
>> key) method.
>>
>
> Sure, assuming your values are only strings you can do
>
> public native String getData(String key) /*-{
>   return this.data[key];
> }-*/;
>
> If your values can also be number, boolean, JS Object you need additional 
> methods, possibly also doing some type checking. 
>
> Given that JSNI won't work in future GWT I would really take a look at 
> jsinterop.base.JsPropertyMap which is a generic class to work on JavaScript 
> objects.
>
> https://github.com/google/jsinterop-base/blob/master/java/jsinterop/base/JsPropertyMap.java
>
> -- 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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic values in json parsing with GWT

2017-11-15 Thread Jens


> Thanks for the early response. Can you give an example of getData(String 
> key) method.
>

Sure, assuming your values are only strings you can do

public native String getData(String key) /*-{
  return this.data[key];
}-*/;

If your values can also be number, boolean, JS Object you need additional 
methods, possibly also doing some type checking. 

Given that JSNI won't work in future GWT I would really take a look at 
jsinterop.base.JsPropertyMap which is a generic class to work on JavaScript 
objects.
https://github.com/google/jsinterop-base/blob/master/java/jsinterop/base/JsPropertyMap.java

-- 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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic values in json parsing with GWT

2017-11-15 Thread Abhishek Banerjee
Thanks for the early response. Can you give an example of getData(String 
key) method.

On Wednesday, 15 November 2017 14:49:56 UTC+5:30, Jens wrote:
>
> You can use JSONObject, a custom JavaScriptObject with JSNI getColumns() 
> and getData(String key) methods or use JsPropertyMap from jsinterop.base 
> library.
>
> -- 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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic values in json parsing with GWT

2017-11-15 Thread Jens
You can use JSONObject, a custom JavaScriptObject with JSNI getColumns() 
and getData(String key) methods or use JsPropertyMap from jsinterop.base 
library.

-- 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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Dynamic values in json parsing with GWT

2017-11-15 Thread Abhishek Banerjee


I have a json response like this

{"columns": ["a", "b", "c"], "data": {"a": "some value", "b": "some value", 
"c": "some value"}}

Now here whatever values columns have the same values are used as keys in 
data object. I have to parse this json in GWT client side. As far as I know 
JSNI requires fixed json objects. Is there any way to parse 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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.