Saturday, November 30, 2013

Re: NPAPI

I'm not familiar with Windows 8, but I believe you have to run Chrome outside "metro mode" to get plugins to work.

http://blog.chromium.org/2012/07/npapi-plug-ins-in-windows-8-metro-mode.html

On Friday, November 29, 2013 10:24:24 AM UTC-8, Joshua Zeidner wrote:
Hi Millie,

 I'm experiencing the same problem.  I'm on Windows 8.  Did you find a solution?

-jmz


On Saturday, November 9, 2013 2:48:53 PM UTC-8, Millie Smith wrote:
When I try to install the Chrome plugin for GWT, I get the following text in a popup: "NPAPI plugin is required by this app". All of the NPAPI installs look complicated. Is there an easy way to get this installed?
Also, when I installed the Firefox plugin, Firefox refused to start again without a complete "factory" reset. 

The Internet Explorer plugin works, so I'm developing in IE. 
I don't like IE.
Please stop the torture.

Any suggestions? :)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: JPA for GWT

Sounds nice, but if you want people to really use it, make sure it's "carried" by a company that will ensure future maintenance....
Example: maybe you make an awesome tool, but if you next year decide to changes jobs or not maintain it anymore, people are stuck with it and can't upgrade to newer gwt versions for example... (See many of the current gwt lib's out there).
So, for me: I would never use it until I have confidence in this.
Secondly: you should post this in the gwt contributor forum.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: RequestFactory + server side validation



On Saturday, November 30, 2013 6:41:44 PM UTC+1, Csaba Lép wrote:
Ok, i figured out, it not necessary any exception throwing, it's working automatically but only with the Default.class.
So, the second question is, how can is set up to working with any other group e.g. ServerGroup.class or something like this.

If you want to use any other group than Default unconditionally, then you can use a ServiceLayerDecorator and override the validate() method.

Otherwise (if you want different groups to be validated depending on, for example, the service method(s) being called), you'll have to do it in the service methods. In that case, it's like any other exception, not at all like the built-in validation.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: RequestFactory + server side validation

Ok, i figured out, it not necessary any exception throwing, it's working automatically but only with the Default.class.
So, the second question is, how can is set up to working with any other group e.g. ServerGroup.class or something like this.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: JsonpRequestBuilder only works across domains?

is here anything written, the callback function name has to start with "__gwt_jsonp__.I0.onSuccess"?!

In facts, the GWT functions "JsonRequestBuilder" and "RequestBuilder" does only work correctly if u'll use callback function names with the GOOGLE names/patterns!

Or in other words, everybody will say this both functions are incredible buggy just google means this is normal and a feature!


This BUG is described on www.inter-net.de (german), inclusive a gwt jsonp solution for all who dont like to use google function names!

I have read the article (I am german) and what it says it that JsonpRequestBuilder always uses "callback" as the GET parameter name. Yes thats true as it does so by default but you can always change that GET parameter name by calling JsonpRequestBuilder.setCallbackParam() and JsonpRequestBuilder.setFailureCallbackParam(). The value of these GET parameters shouldn't matter at all because as Thomas said the server just takes the value whatever it is and use it to wrap the JSON. So the value of that GET parameter is an implementation detail of GWT and it has chosen the mentioned format because you could have multiple JSONP request going on at the same time.

I think the main point is that you have missed setCallbackParam(). This method exists to consume services which do not expect the callback parameter to be named "callback".

I don't see any bug here.

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: JsonpRequestBuilder only works across domains?



On Friday, November 29, 2013 9:17:18 PM UTC+1, Magier Marantis wrote:

Am Dienstag, 26. Januar 2010 18:54:43 UTC+1 schrieb Thomas Broyer:

On Jan 26, 12:43 pm, "m.mil...@newelements.de"
<m.mil...@newelements.de> wrote:
> once again, i have to answer the question myself!
> at first: would anyone PLEASE write an guide for using the
> jsonprequestbuilder!!!! it´s damn annoing the find out everything by
> try and error.
>
> about my problem:
> the name of the callback method for the jsonp request changes whith
> every request.
> when you do the first request the name is: __gwt_jsonp__.I0.onSuccess
> for the second request: __gwt_jsonp__.I1.onSuccess
> for the third: __gwt_jsonp__.I2.onSuccess
> ...
>
> that definetly make sense, BUT is nowhere noted in the
> documentation!!!!!
> and - belive it or not - you can see this little change from one
> request to another very hard when you look at a couple of requests.

The javadoc for JsonpRequestBuilder starts with:
"""The server will receive a request including a callback url
parameter, which should be used to return the response as following:

<callback>(<json>);

where <callback> is the url parameter (see setCallbackParam
(String)),"""

It's clear to me that the URL will contain a query string with a
parameter like "callback=fnName" (where 'callback' is the value you
passed to setCallbackParam, and 'fnName' is the <callback>, i.e. the
function name to "call").
It even comes with an example of calling a GData API (with a link to
the GData API documentation that explains what "?alt=json-in-script"
means)

Maybe you should first read some doc about JSON-P, such as
http://en.wikipedia.org/wiki/JSON#JSONP

@Thomas Broyer

Learn2Read!

I'll try, I promise.
 
--------------------------------------------------------------------------------------------

The javadoc for JsonpRequestBuilder starts with:
"""The server will receive a request including a callback url
parameter, which should be used to return the response as following:

<callback>(<json>);

where <callback> is the url parameter (see setCallbackParam
(String)),"""

--------------------------------------------------------------------------------------------

is here anything written, the callback function name has to start with "__gwt_jsonp__.I0.onSuccess"?!


There's nothing about it because there shouldn't be anything about it; it's an implementation detail that you don't need to know as a user of JsonpRequestBuilder, and the server doesn't need to bother about: it should just take the name passed in the URL, whichever it is.

 

In facts, the GWT functions "JsonRequestBuilder" and "RequestBuilder" does only work correctly if u'll use callback function names with the GOOGLE names/patterns!

Or in other words, everybody will say this both functions are incredible buggy just google means this is normal and a feature!


This BUG is described on www.inter-net.de (german), inclusive a gwt jsonp solution for all who dont like to use google function names!

I don't read German so I relied on Google Translate, but nowhere in this article is it explained why this is a problem.

They talk about "standard JSONP", so let's go read what Wikipedia has to say about it: http://en.wikipedia.org/wiki/JSONP

 By convention, the browser provides the name of the callback function as a named query parameter value, typically using the name jsonp or callback as the named query parameter field name, in its request to the server, e.g.,

<script type="application/javascript"          src="http://server2.example.com/Users/1234?jsonp=parseResponse">  </script>  

In this example, the received payload would be:

parseResponse({"Name": "Foo", "Id": 1234, "Rank": 7});

This is exactly what the javadoc says: using setCallbackParam you configure the name of the parameter ("callback", "jsonp" or whatever the server expects), GWT then chooses the value of that parameter and the server si expected to just take that value and use it in the response (when Wikipedia says "the browser provides", it means the JavaScript code; with JsonpRequestBuilder, GWT provides the value and you don't have to care about it).

Now explain to me how this is specific to Google and why this is a bug.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Friday, November 29, 2013

Gwt Application Hosting in Linux with Apache tomcat

Hi

I am new to gwt .. i developed the gwt webapplication with mysql. In local machine i deployed the application and compile into war  and rename the file into tomcat
web apps folder its working fine in local but while deploy the files into hosting server i get this kind of Exception.but jsp page is working fine on hosting server ... 


The Requested URL /helloMVP/test was not found on this server .
<address>Apache/2.2.25(Unix)mod_ssl/2.2.25 openSSL/1.0.0-fips  mod_jk/1.2.37 mod_bwlimited/1.4 server at healthbis.net port 80</address>
The log error shows hellomvp/test file does not exist

Any help would be appreciated


Regards
Harsha Infotech...

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: IncompatibleRemoteServiceException after new deployment

Hi,

after new deployments, my users keep reporting "The call failed on the server"-errors. The server logs then contain SerializationExceptions. The client code only catches IncompatibleRemoteServiceException. What about SerializationExceptions? How do the two exception types relate to each other?

Magnus

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: JsonpRequestBuilder only works across domains?


Am Dienstag, 26. Januar 2010 18:54:43 UTC+1 schrieb Thomas Broyer:

On Jan 26, 12:43 pm, "m.mil...@newelements.de"
<m.mil...@newelements.de> wrote:
> once again, i have to answer the question myself!
> at first: would anyone PLEASE write an guide for using the
> jsonprequestbuilder!!!! it´s damn annoing the find out everything by
> try and error.
>
> about my problem:
> the name of the callback method for the jsonp request changes whith
> every request.
> when you do the first request the name is: __gwt_jsonp__.I0.onSuccess
> for the second request: __gwt_jsonp__.I1.onSuccess
> for the third: __gwt_jsonp__.I2.onSuccess
> ...
>
> that definetly make sense, BUT is nowhere noted in the
> documentation!!!!!
> and - belive it or not - you can see this little change from one
> request to another very hard when you look at a couple of requests.

The javadoc for JsonpRequestBuilder starts with:
"""The server will receive a request including a callback url
parameter, which should be used to return the response as following:

<callback>(<json>);

where <callback> is the url parameter (see setCallbackParam
(String)),"""

It's clear to me that the URL will contain a query string with a
parameter like "callback=fnName" (where 'callback' is the value you
passed to setCallbackParam, and 'fnName' is the <callback>, i.e. the
function name to "call").
It even comes with an example of calling a GData API (with a link to
the GData API documentation that explains what "?alt=json-in-script"
means)

Maybe you should first read some doc about JSON-P, such as
http://en.wikipedia.org/wiki/JSON#JSONP

@Thomas Broyer

Learn2Read!

--------------------------------------------------------------------------------------------

The javadoc for JsonpRequestBuilder starts with:
"""The server will receive a request including a callback url
parameter, which should be used to return the response as following:

<callback>(<json>);

where <callback> is the url parameter (see setCallbackParam
(String)),"""

--------------------------------------------------------------------------------------------

is here anything written, the callback function name has to start with "__gwt_jsonp__.I0.onSuccess"?!

In facts, the GWT functions "JsonRequestBuilder" and "RequestBuilder" does only work correctly if u'll use callback function names with the GOOGLE names/patterns!

Or in other words, everybody will say this both functions are incredible buggy just google means this is normal and a feature!


This BUG is described on www.inter-net.de (german), inclusive a gwt jsonp solution for all who dont like to use google function names!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: NPAPI

Hi Millie,

 I'm experiencing the same problem.  I'm on Windows 8.  Did you find a solution?

-jmz


On Saturday, November 9, 2013 2:48:53 PM UTC-8, Millie Smith wrote:
When I try to install the Chrome plugin for GWT, I get the following text in a popup: "NPAPI plugin is required by this app". All of the NPAPI installs look complicated. Is there an easy way to get this installed?
Also, when I installed the Firefox plugin, Firefox refused to start again without a complete "factory" reset. 

The Internet Explorer plugin works, so I'm developing in IE. 
I don't like IE.
Please stop the torture.

Any suggestions? :)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Thoughts on GWT 3.0 re: Java 8 and IE 8/9

This sounds very much like Wicket.  When we were evaluating frameworks to use, about 2.5 years ago, to update our app it boiled down to Wicket and GWT.  Wicket had the advantage that it allowed designers and coders to work better together (markup and code in separate source files).  GWT won out because we are largely Java developers and it looked like designing an app that always filled the screen (for desktop and tablets - but not phones) would be easier.

I never understood why there wasn't more of a convergence between Wicket and GWT.  When uibinder was introduced I was hoping it would be more HTML-ish, like Wicket

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Can't debug on MacOS X

I resolved this by installing a newer version (Kepler) of Eclipse.

On Tuesday, November 26, 2013 4:39:13 PM UTC-8, Mike Dee wrote:
Trying to test our app on a Mac and can't debug the app.  Upon launching the app in debug mode a "Problem Occured" dialog pops with with a message, "Launching myapphtml has encountered a problem.  An internal error occurred: "Launching myapp.html".  Clicking the Details button shows, "An internal erroro occurred during: "Launching myapp.html".  java.lang.NullPointerException.

This works fine on a Windows machine.

This is a fairly new Mac with Eclipse and GWT just installed: Mac OS 10.8.3, Java 7 rel 25, GWT 2.5.1.

Any ideas?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: What is the simplest way to show “loading indicator” during an RPC call in GWTP?

We do exactly what you describe and it works fine.  However, we don't use GWTP.  Our code looks very similar to yours.  The presenter (activity) initiates the query and invokes the dialog and hides it when the callback returns.

Maybe GWTP is doing something in the interim.

Mike

On Saturday, October 26, 2013 2:21:57 AM UTC-7, Tom wrote:

I am using GWTP to build my webapp. Here is my problem. I have a customer page (CustPresenter). When that page is visited, it will call & load Data from Database.

It may take a while to load all data, so I want my current Browser locked so that the user can not click any things while data has not finished downloading yet.

So here is what I am thinking. I want to show a DialogBox right before I make the RPC call & hide it when the call finishes. Look at the below code:

public class CustPresenter extends      Presenter<CustPresenter.MyView, CustPresenter.MyProxy> {        private DialogBox loadingDialogBox=new DialogBox();        @Inject DispatchAsync dispatchAsync;        @Override      public void prepareFromRequest(PlaceRequest request){           super.prepareFromRequest(request);           loadingDialogBox.show();           GetData getDataAction=new GetData();           dispatchAsync.execute(getDataAction, getDataCallback);        }        private AsyncCallback<GetDataResult> getDataCallback=new AsyncCallback<GetDataResult>(){            @Override          public void onFailure(Throwable caught) {              loadingDialogBox.hide();          }            @Override          public void onSuccess(GetVerbFromTripleResult result) {               //show data here (it may take long time)               loadingDialogBox.hide();          }     };  }  

However, when runing, the dialogbox only shows up for 1 second & then disappears. Right After that all the UiBinder Guis show up on the Customer Page & user can click any buttons on the page while the data has not finished downloading yet. This is not a correct behavior.

I want to do something like this http://sqlfiddle.com/#!2/a2581/1. As u can see, when u first time open that link, a loading panel popups & u can't click anything until all guis show up.

So, why do I have this problem?

How to fix it?

Or generally, What is the simplest way to show "loading indicator" during an RPC call in GWTP?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Issue with Loading image while using 'CellTable' in GWT

We do that without much problem.  How do you load the image and determine when it is finished loading?  We use gwt-image-loader (https://code.google.com/p/gwt-image-loader/).  It has an event that is thrown when the image is loaded.

Mike

On Thursday, November 28, 2013 10:35:36 PM UTC-8, Arnab wrote:
Hello All,

I am implementing a program using GWT where we need to show the 'Loading image' every time we visit the page.
I am using CellTable to perform this activity.

But the Loading image shows only for the first time visit and from the next time I do not get any loading image.

I tried lot of logic(clearing the cache) but nothing work. Checked different blog sites but didn't found any solution.


Can any body tell me how to implement this, so that I can see 'Loading image' every time I visit the page.

Thanks in advance!

Regards,
Arnab

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Issue with Loading image while using 'CellTable' in GWT

try to use table.setVisibleRangeAndClearData(range, true);

On Friday, November 29, 2013 7:35:36 AM UTC+1, Arnab wrote:

Hello All,

I am implementing a program using GWT where we need to show the 'Loading image' every time we visit the page.
I am using CellTable to perform this activity.

But the Loading image shows only for the first time visit and from the next time I do not get any loading image.

I tried lot of logic(clearing the cache) but nothing work. Checked different blog sites but didn't found any solution.


Can any body tell me how to implement this, so that I can see 'Loading image' every time I visit the page.

Thanks in advance!

Regards,
Arnab

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Thursday, November 28, 2013

Re: Using DatePicker in CellTable

It seems like this problem requires overriding the GWT-s DatePickerCell as shown in this example:

Jaga, tank you for your help.

Best regards:
Nermin

On Monday, November 25, 2013 4:02:11 PM UTC+1, jaga wrote:
Perhaps you can override the DatePickerCell's FieldUpdater() method?

I realised I hadn't been crystal clear in my answer to 2). Of course once the user has picked a date the cell's value has changed.  You may have too store the old value and manually update the DateCellpPicker's value.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Issue with Loading image while using 'CellTable' in GWT

Hello All,

I am implementing a program using GWT where we need to show the 'Loading image' every time we visit the page.
I am using CellTable to perform this activity.

But the Loading image shows only for the first time visit and from the next time I do not get any loading image.

I tried lot of logic(clearing the cache) but nothing work. Checked different blog sites but didn't found any solution.


Can any body tell me how to implement this, so that I can see 'Loading image' every time I visit the page.

Thanks in advance!

Regards,
Arnab

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

What is the simplest way to show “loading indicator” during an RPC call in GWTP?

I've successfully used the Scheduler. scheduleDeferred() method to show progress indicators. Launching such a thing shouldn't be done directly by the thread which is handling an event ie. Your code which is called once the page has loaded and which fires off the async RPC request.

Note that I can't speak to the suitability of my approach in the context of a GWTP application as it has been some time since I looked at that framework.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

RequestFactory + server side validation

Hi all, 

I'm using GWT version of 2.5.1 with RequestFactory and EditorFramework.
Today I tried set up the Validation and its working fine at client side but the server side is not.
The main problem, I found one usable sample from GWT trunk, but it use the GWT-RPC not RequestFactory: 

 public SafeHtml greetServer(Person person) throws IllegalArgumentException,
      ConstraintViolationException {
    // Verify that the input is valid.
    Set<ConstraintViolation<Person>> violations = validator.validate(person,
        Default.class, ServerGroup.class);
    if (!violations.isEmpty()) {
      Set<ConstraintViolation<?>> temp = new HashSet<ConstraintViolation<?>>(
          violations);
      throw new ConstraintViolationException(temp);
    }  

 but this way is caused 
       java.lang.RuntimeException: Server Error: null

with RequestFactory.

So, the question is, what is the proper way to use that with RF at server side ?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Re: GWT FileUpload with Progress Listener

I do this in the FormPanel onSubmit:

    private static final int PROGRESS_DELAY_MSEC = 1000;

    private static final int PROGRESS_UPDATE_MSEC = 1000;

    private Timer m_progressUpdateTimer;


        m_progressUpdateTimer = new Timer()

        {

            @Override

            public void run()

            {

                requestProgressUpdate();

            }

        };

        m_progressUpdateTimer.schedule(PROGRESS_DELAY_MSEC);

...

    private void requestProgressUpdate()

    {

        if (DEBUG)

        {

            Log.log(Duration.currentTimeMillis()/1000 + " requestProgressUpdate");

        }

        RequestBuilder builder = new RequestBuilder(GET, FILE_UPLOAD_SERVLET);

        try

        {

            builder.sendRequest(null, new RequestCallback()

            {

                @Override

                public void onResponseReceived(Request p_request,

                                               Response p_response)

                {

                    m_progress.setVisible(true);

                    if (p_response.getStatusCode() == Response.SC_OK)

                    {

                        String text = p_response.getText();

                        if (DEBUG)

                            m_status.setHTML(text);

                        if (m_progressUpdateTimer != null && text.length() > 0)

                            updateProgress(text);

                        if (DEBUG)

                        {

                            Log.log(Duration.currentTimeMillis()/1000

                               + " onResponseReceived " + text + " (OK)");

                        }

                    }

                    else

                    {

                        String text = p_response.getStatusText();

                        m_status.setHTML(text);

                        if (DEBUG)

                        {

                            Log.log(Duration.currentTimeMillis()/1000

                               + " onResponseReceived " + text + " ("+p_response.getStatusCode()+")");

                        }

                    }

                    if (m_progressUpdateTimer != null && isAttached())

                        m_progressUpdateTimer.schedule(PROGRESS_UPDATE_MSEC);

                }

                @Override

                public void onError(Request p_request, Throwable p_e)

                {

                    m_progress.setVisible(true);

                    m_status.setText(p_e.getMessage());

                    if (m_progressUpdateTimer != null && isAttached())

                        m_progressUpdateTimer.schedule(PROGRESS_UPDATE_MSEC);

                    if (DEBUG)

                    {

                        Log.log(Duration.currentTimeMillis()/1000

                           + " onError " + p_e.getMessage());

                    }

                }

            });

        }

        catch (RequestException e)

        {

            m_progress.setVisible(true);

            m_status.setText(e.getMessage());

            if (DEBUG)

            {

                Log.log(Duration.currentTimeMillis()/1000

                   + " RequestException " + e.getMessage());

            }

        }

    }


    private void updateProgress(String p_text)

    {

        try

        {

            Document xml = XMLParser.parse(p_text);

            Integer item = intValue(xml, "item");

            if (item == null)

            {

                m_progress.setItem(null);

            }

            else

            {

                // form item 1 is the id, items 2+ are the files.

                String filename = null;

                if (item > 1 && item - 2 < m_uploadFilelist.size())

                    filename = m_uploadFilelist.get(item - 2);

                m_progress.setItem(filename);

            }

            Integer percent_complete = intValue(xml, "percent_complete");

            if (percent_complete != null)

            {

                m_progress.setProgress(percent_complete.doubleValue());

            }

            if (DEBUG)

            {

                Integer bytes_read = intValue(xml, "bytes_read");

                Integer content_length = intValue(xml, "content_length");

                String progress = "Uploaded " + bytes_read + " of "

                        + content_length + ": " + percent_complete + "%";

                m_status.setText(progress);

            }

        }

        catch (Exception e)

        {

            m_status.setText(e.getMessage());

            if (DEBUG)

            {

                Log.log(Duration.currentTimeMillis()/1000

                   + " updateProgress " + e.getMessage());

            }

        }

    }


    private Integer intValue(Document p_xml, String p_tagname)

    {

        try

        {

            NodeList list = p_xml.getElementsByTagName(p_tagname);

            if (list.getLength() > 0)

            {

                Node node = list.item(0);

                list = node.getChildNodes();

                node = list.item(0);

                String value = node.getNodeValue();

                if (value != null)

                    return Integer.valueOf(value);

            }

        }

        catch (Exception e)

        {

            m_status.setText(e.getMessage());

        }

        return null;

    }


    private static class UploadProgressBar extends ProgressBar

    {

        private String m_item;


        public UploadProgressBar()

        {

            super();

        }


        public void setItem(String p_item)

        {

            m_item = p_item;

        }


        @Override

        protected String generateText(double curProgress)

        {

            if (m_item == null)

                return (int)(100 * getPercent()) + "%";

            else

                return m_item + " " + (int)(100 * getPercent()) + "%";

        }

    }



doGet in my FileUploadServlet does this:


    @Override

    protected void doGet(HttpServletRequest p_request,

                         HttpServletResponse p_response)

        throws ServletException, IOException

    {

        if (DEBUG)

            System.err.println("\n" + System.nanoTime() + " doGet request "

                + p_request.getContentType() + " " + p_request.getServletPath());


        HttpSession session = p_request.getSession();

        if (session == null)

            return;


        FileUploadProgress progress =

            (FileUploadProgress)session.getAttribute("progress");

        if (progress == null)

            return;


        long bytesRead = progress.getBytesRead();

        long contentLength = progress.getContentLength();

        int item = progress.getItem();


        p_response.setContentType("text/xml");


        StringBuffer buffer = new StringBuffer();

        buffer.append("<?xml version=\"1.0\"?>\n");

        buffer.append("<response>\n");

        buffer.append("\t<item>").append(item)

              .append("</item>\n");

        buffer.append("\t<bytes_read>").append(bytesRead)

              .append("</bytes_read>\n");

        buffer.append("\t<content_length>").append(contentLength)

              .append("</content_length>\n");


        long percentComplete;

        if (bytesRead < contentLength && contentLength != 0)

        {

            percentComplete = ((100 * bytesRead) / contentLength);

        }

        else

        {

            percentComplete = 100;

            session.setAttribute("progress", null);

        }


        buffer.append("\t<percent_complete>").append(percentComplete)

              .append("</percent_complete>\n");

        buffer.append("</response>\n");


        PrintWriter out = p_response.getWriter();

        out.println(buffer.toString());

        out.flush();

        out.close();

    }


FileUploadProgress uses this Apache Commons package:

http://commons.apache.org/proper/commons-fileupload/

import org.apache.commons.fileupload.ProgressListener;


public class FileUploadProgress implements ProgressListener

{

    private volatile long m_bytesRead;

    private volatile long m_contentLength;

    private volatile int m_item;


    public FileUploadProgress()

    {

        super();

    }


    @Override

    public void update(long p_bytesRead, long p_contentLength, int p_item)

    {

        m_bytesRead = p_bytesRead;

        m_contentLength = p_contentLength;

        m_item = p_item;

    }


    public long getBytesRead()

    {

        return m_bytesRead;

    }


    public long getContentLength()

    {

        return m_contentLength;

    }


    public int getItem()

    {

        return m_item;

    }

}



On Thursday, November 28, 2013 9:42:31 AM UTC-8, confile wrote:
Yes, but I do not get how to use it. Can you help me with this please?

Am Donnerstag, 28. November 2013 12:20:21 UTC+1 schrieb Thomas Broyer:
Have you checked Elemental? AFAICT, everything's there already.
http://www.gwtproject.org/articles/elemental.html

On Wednesday, November 27, 2013 4:02:48 PM UTC+1, confile wrote:

 want to observe the upload percentage of a file upload from GWT.

In JavaScript you can use a XMLHttpRequest and add an event listener like this:

var oReq = new XMLHttpRequest();    oReq.upload.addEventListener("progress", updateProgress, false);    // progress on transfers from the server to the client (downloads)  function updateProgress (oEvent) {    if (oEvent.lengthComputable) {      var percentComplete = oEvent.loaded / oEvent.total;      // ...    } else {      // Unable to compute progress information since the total size is unknown    }  }

(The above code is from here.)

This is also done very easily in jQuery as:

 var $request = $.ajax({        xhr: function() {          xhrNativeObject = new window.XMLHttpRequest();          //Upload progress          xhrNativeObject.upload.addEventListener("progress", function(event) { ... }        }   });

I want to do the same with GWT. I could use a RequestBuilder to send a request, but this is only a high level wrapper around the XMLHttpRequest JavaScriot object. Another possibility would be to use the GWT XMLHttpRequest class which is a JSNI wrapper of the JavaScript XMLHttpRequest.

My problem:

How can I add a progress listener to the XMLHttpRequest or the RequestBuilder?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.