Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3667964
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:03:55+00:00 2026-05-19T02:03:55+00:00

I have a project where you can ask for resources that are served by

  • 0

I have a project where you can ask for resources that are served by jax-rs in the json format. Everything works properly in the browser when I query the rest URL the json appears.

Now I want my GWT project to request those resources and process them and show them in my interface. The simplest way I found to do so is using a request builder and an overlay. Code is lower. The problem is, it seems when the code is running it never goes into the actual RequestCallback(). The status string is never changed. I thought it could be a SOP so I added the <add-linker name="xs"/> but still doesn’t work. Any ideal?

    package com.workoutcell.client;
    //import com.google.gwt.core.client.JavaScriptObject;
    import com.google.gwt.core.client.JsArray;
    import com.google.gwt.http.client.*;
    import com.google.gwt.http.client.Request;
    import com.google.gwt.http.client.RequestBuilder;
    import com.google.gwt.http.client.RequestCallback;
    import com.google.gwt.http.client.RequestException;
    import com.google.gwt.http.client.Response;

    /**
     *
     * @author 
     */

    public class RestToInfoSession{

        String queryReturn = null;
        JsArray<InfoJSO> arrayOfInfo = null;
        String host = "http://localhost:8080/mysite";
        String restModule = "/calendar/getinfo";
        String id = null;
        String year = null;
        String month = null;
        String status = "Not Initialized";

        public RestToInfoSession(String id, String year, String month){

            this.id =id;
            this.year = year;
            this.month = month;
            String url = host + restModule + "/"+this.id + "/"+this.year + "/"+this.month;   
            RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);


            try {
                status = "Initialized at Url " + builder.getUrl();
                Request request = builder.sendRequest(null, new RequestCallback() {

                    public void onError(Request request, Throwable exception) {
                        // Couldn't connect to server (could be timeout, SOP violation, etc.)
                         status = "Error on connecting to Server";
                    }


                    public void onResponseReceived(Request request, Response response) {
                        if (200 == response.getStatusCode()) {
                           // arrayOfInfo = jsonToJsArray(response.getText());    
                            status = "JSON has been Fetched. Result is:" + response.getText();
                        } else if(0 == response.getStatusCode()) {
                            status = "Error is 0";
                        } else {
                            status = "Error in JSON Request:" + response.getStatusCode();
                            //response.getStatusText();
                        }
                    }

                });

            } catch (RequestException ex) {
                 status = "Error in  Request Builder Startup";
            }

        }

        //get an jso object in array
        private final native JsArray<InfoJSO> jsonToJsArray(String json) /*-{
        return eval(json);
          }-*/;

        public JsArray<InfoJSO> getInfoArray (){

            return arrayOfInfo;
        }

    }

UPDATE: My problem is the same as Referring to a non-final variable data inside an inner class . I wasn’t aware of asynchronous calls working mechanism. I still don’t know how to pass my response.getText() to update a label that isn’t part of my RestToInfoSession class any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:03:56+00:00Added an answer on May 19, 2026 at 2:03 am

    I have put a timer that checks every 1000ms if my json string has updated from null to the xhttp requested data. This works, but I got a feeling there is a more elegant way of resolving this problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project with graphs that can be printed. When you click the
I have multimodule project. Can I make it somehow work that when calling compile
I'm working on asp.net (vb, maybe that can change something) I have a project
I have a WinForm project that contains a form called MainUI. You can see
I have a ASP.NET MVC2 project in VS2010 that can be deployed in two
I would like to ask that if I have a project written in C
i want to ask about ASP.Net Configuration. i have a project that use ASP.Net
I have a java SE project or you can say applet , but i
I have a legacy project using Rails 2.3.5 but I can't find with which
I have a Spring Project with Wicket. I can successfully inject Services in Wicket

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.