Example usage for com.google.gwt.http.client RequestBuilder setHeader

List of usage examples for com.google.gwt.http.client RequestBuilder setHeader

Introduction

In this page you can find the example usage for com.google.gwt.http.client RequestBuilder setHeader.

Prototype

public void setHeader(String header, String value) 

Source Link

Document

Sets a request header with the given name and value.

Usage

From source file:org.jboss.hal.dmr.dispatch.impl.DMRHandler.java

License:Open Source License

private RequestBuilder chooseRequestBuilder(final ModelNode operation) {
    RequestBuilder requestBuilder;
    final String op = operation.get(OP).asString();
    if (READ_RESOURCE_DESCRIPTION_OPERATION.equals(op)) {
        String endpoint = endpoints.dmr();
        if (endpoint.endsWith("/")) {
            endpoint = endpoint.substring(0, endpoint.length() - 1);
        }/* w ww.j  av  a  2  s . com*/
        String descriptionUrl = endpoint + descriptionOperationToUrl(operation);
        requestBuilder = new RequestBuilder(RequestBuilder.GET,
                com.google.gwt.http.client.URL.encode(descriptionUrl));
        requestBuilder.setHeader(HEADER_ACCEPT, DMR_ENCODED);
        requestBuilder.setHeader(HEADER_CONTENT_TYPE, DMR_ENCODED);
        requestBuilder.setIncludeCredentials(true);
        requestBuilder.setRequestData(null);
    } else {
        requestBuilder = postRequestBuilder;
        requestBuilder.setRequestData(operation.toBase64String());
    }
    return requestBuilder;
}

From source file:org.jboss.uberfire.dmr.poc.client.local.dmr.DMRRequest.java

License:Open Source License

private static RequestBuilder makeRequest(ModelNode requestData) {
    RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, "http://127.0.0.1:9990/management");
    //RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, GWT.getHostPageBaseURL() + "index.jsp");
    rb.setHeader("Content-type", "application/dmr-encoded");
    rb.setHeader("Accept", "application/dmr-encoded");
    rb.setIncludeCredentials(true);/*from ww w  . ja  v  a2s .  c  o  m*/
    rb.setRequestData(requestData.toBase64String());
    return rb;
}

From source file:org.kie.workbench.common.screens.server.management.client.widget.card.footer.FooterPresenter.java

License:Apache License

RequestBuilder makeRequest(final String url, final Command onSuccess, final Command onError) {

    final RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
    final String none = "none";

    builder.setUser(none);//from www  .  ja va  2s . c  om
    builder.setPassword(none);
    builder.setCallback(makeCallback(onSuccess, onError));
    builder.setHeader("Accept", "*/*");
    return builder;
}

From source file:org.kuali.student.common.ui.client.security.SpringSecurityLoginDialogHandler.java

License:Educational Community License

private void createLoginPanel() {
    lightbox = new KSLightBox();
    VerticalPanel panel = new VerticalPanel();

    FlexTable table = new FlexTable();

    errorLabel = new Label();
    errorLabel.setText(TIMEOUT_MSG);
    errorLabel.setStyleName("KSError");

    username = new TextBox();
    username.setName("j_username");

    password = new PasswordTextBox();
    password.setName("j_password");

    table.setText(0, 0, "Username");
    table.setWidget(0, 1, username);//ww  w .j a  v a2 s.  co m

    table.setText(1, 0, "Password");
    table.setWidget(1, 1, password);

    table.setWidget(2, 0, (new Button("Login", new ClickHandler() {
        public void onClick(ClickEvent event) {

            //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder
            StringBuilder postData = new StringBuilder();
            postData.append(URL.encode("j_username")).append("=").append(username.getText());
            postData.append("&").append(URL.encode("j_password")).append("=").append(password.getText());

            RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                    context.getApplicationContextUrl() + "/j_spring_security_check");
            builder.setHeader("Content-type", "application/x-www-form-urlencoded");

            try {
                builder.sendRequest(postData.toString(), new RequestCallback() {

                    @Override
                    public void onError(Request req, Throwable caught) {
                        lightbox.hide();
                        KSErrorDialog.show(caught);
                    }

                    @Override
                    public void onResponseReceived(Request req, Response res) {
                        if (res.getStatusCode() == Response.SC_OK
                                && !res.getText().contains("Bad credentials")) {
                            lightbox.hide();
                        } else {
                            errorLabel.setText("Your login attempt was not successful, try again.");
                        }
                    }
                });
            } catch (RequestException e) {
                KSErrorDialog.show(e);
            }
        }
    })));

    panel.add(errorLabel);
    panel.add(table);

    panel.setStyleName("KSLoginPanel");
    lightbox.setWidget(panel);
}

From source file:org.mindinformatics.gwt.domeo.plugins.resource.pmcimages.service.impl.JsonPmcImagesConnector.java

License:Apache License

@Override
public void retrievePmcImagesData(final IPmcImagesRequestCompleted completionCallback, String pmid,
        String pmcid, String doi) throws IllegalArgumentException {

    if (_application.isHostedMode()) {
        String response = "[{\"uysie:hasCaption\": \"Representative self-terminating radical reactions.\","
                + "\"uysie:hasFullText\": \"Most organic radical reactions occur through a cascade of two or more individual steps [1,2]. Knowledge of the nature and rates of these steps  in other words, the mechanism of the reaction  is of fundamental interest and is also important in synthetic planning. In synthesis, both the generation of the initial radical of the cascade and the removal of the final radical are crucial events [3]. Many useful radical reactions occur through chains that provide a naturally coupled regulation of radical generation and removal. Among the non-chain methods, generation and removal of radicals by oxidation and reduction are important, as is the\","
                + "\"uysie:hasFileName\": \"nihms28314f1\","
                + "\"uysie:hasTitle\": \"Do alpha-acyloxy and alpha-alkoxycarbonyloxy radicals fragment to form acyl and alkoxycarbonyl radicals?\"}]";

        @SuppressWarnings("unchecked")
        JsArray<JsPmcImage> responseOnSets = (JsArray<JsPmcImage>) parseJson(response);
        HashMap<String, JsPmcImage> images = new HashMap<String, JsPmcImage>();
        for (int i = 0; i < responseOnSets.length(); i++) {
            images.put(responseOnSets.get(i).getName(), responseOnSets.get(i));
        }/* w  ww  .  j  a v  a2 s  . c  o m*/

        completionCallback.returnPmcImagesData(images);
        return;
    }

    String requestUrl = ApplicationUtils.getUrlBase(GWT.getModuleBaseURL())
            + "yaleImageFinder/retrievePmcImagesData?format=json";
    try {
        RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, requestUrl);
        builder.setHeader("Content-Type", "application/json");

        JSONObject request = new JSONObject();
        if (pmid != null)
            request.put("pmid", new JSONString(pmid));
        if (pmcid != null)
            request.put("pmcid", new JSONString(pmcid));
        if (doi != null)
            request.put("doi", new JSONString(doi));

        JSONArray messages = new JSONArray();
        messages.set(0, request);

        builder.setTimeoutMillis(20000);
        builder.setRequestData(messages.toString());
        builder.setCallback(new RequestCallback() {
            public void onError(Request request, Throwable exception) {
                if (exception instanceof RequestTimeoutException) {
                    _application.getLogger().exception(this,
                            "Couldn't load images metadata (timeout) " + exception.getMessage());
                    completionCallback.pmcImagesDataNotFound();
                    //                  ((ProgressMessagePanel)((DialogGlassPanel)_application.getDialogPanel()).getPanel()).addErrorMessage("Could not load images metadata  (timeout)");
                    //                  handler.bibliographySetListNotCreated("Could not load existing bibliography  (timeout)");
                } else {
                    _application.getLogger().exception(this, "Couldn't load images metadata");
                    completionCallback.pmcImagesDataNotFound();
                    //                  ((ProgressMessagePanel)((DialogGlassPanel)_application.getDialogPanel()).getPanel()).addErrorMessage("Could not load existing bibliography (onError)");
                    //                  handler.bibliographySetListNotCreated("Could not load existing bibliography (onError)");
                }
            }

            public void onResponseReceived(Request request, Response response) {
                if (200 == response.getStatusCode()) {
                    try {
                        _application.getLogger().debug(this, response.getText());
                        @SuppressWarnings("unchecked")
                        JsArray<JsPmcImage> responseOnSets = (JsArray<JsPmcImage>) parseJson(
                                response.getText());
                        HashMap<String, JsPmcImage> images = new HashMap<String, JsPmcImage>();
                        for (int i = 0; i < responseOnSets.length(); i++) {
                            images.put(responseOnSets.get(i).getName(), responseOnSets.get(i));
                        }
                        completionCallback.returnPmcImagesData(images);
                    } catch (Exception e) {
                        _application.getLogger().exception(this,
                                "Could not parse images metadata " + e.getMessage());
                        completionCallback.pmcImagesDataNotFound();
                        //                     ((ProgressMessagePanel)((DialogGlassPanel)_application.getDialogPanel()).getPanel()).addErrorMessage("Could not parse existing bibliography  " + e.getMessage());
                        //                     handler.bibliographySetListNotCreated("Could not parse existing bibliography " + e.getMessage() + " - "+ response.getText());
                    }
                } else if (503 == response.getStatusCode()) {
                    _application.getLogger().exception(this,
                            "Existing bibliography by url 503: " + response.getText());
                    completionCallback.pmcImagesDataNotFound();
                    //                  ((ProgressMessagePanel)((DialogGlassPanel)_application.getDialogPanel()).getPanel()).addErrorMessage("Could not retrieve existing bibliography  " + response.getStatusCode());
                    //                  handler.bibliographySetListNotCreated("Could not retrieve existing bibliography " + response.getStatusCode() + " - "+ response.getText());
                    //completionCallback.textMiningNotCompleted(response.getText());
                } else {
                    _application.getLogger().exception(this,
                            "Load images metadata " + response.getStatusCode() + ": " + response.getText());
                    //                  ((ProgressMessagePanel)((DialogGlassPanel)_application.getDialogPanel()).getPanel()).addErrorMessage("Could not retrieve existing bibliography  " + response.getStatusCode());
                    //                  handler.bibliographySetListNotCreated("Could not retrieve existing bibliography " + response.getStatusCode() + " - "+ response.getText());
                    //handler.setExistingBibliographySetList(new JsArray(), true);
                    //completionCallback.textMiningNotCompleted(response.getText());
                    completionCallback.pmcImagesDataNotFound();
                }
            }
        });
        builder.send();

    } catch (RequestException e) {
        _application.getLogger().exception(this, "Couldn't save annotation");
        completionCallback.pmcImagesDataNotFound();

    }
}

From source file:org.mindinformatics.gwt.framework.component.profiles.src.testing.JsonProfileManager.java

License:Apache License

@Override
public void retrieveUserProfiles() {
    String url = GWT.getModuleBaseURL() + "profile/" + _application.getUserManager().getUser().getUserName()
            + "/all?format=json";
    if (!_application.isHostedMode())
        url = ApplicationUtils.getUrlBase(GWT.getModuleBaseURL()) + "profile/"
                + _application.getUserManager().getUser().getUserName() + "/all?format=json";

    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
    builder.setHeader("Content-type", "application/json");

    try {//w w  w  .  ja  v a 2 s .  co m
        Request request = builder.sendRequest(null, new RequestCallback() {
            public void onError(Request request, Throwable exception) {
                _application.getInitializer().addException("Couldn't retrieve User Profiles JSON");
            }

            public void onResponseReceived(Request request, Response response) {
                if (200 == response.getStatusCode()) {
                    ArrayList<MProfile> userProfiles = new ArrayList<MProfile>();
                    JsArray profiles = (JsArray) parseJson(response.getText());
                    for (int j = 0; j < profiles.length(); j++) {
                        JsoProfile jsoProfile = (JsoProfile) profiles.get(j);

                        MProfile profile = new MProfile();
                        profile.setUuid(jsoProfile.getUuid());
                        profile.setName(jsoProfile.getName());
                        profile.setDescription(jsoProfile.getDescription());
                        profile.setLastSavedOn(jsoProfile.getCreatedOn());

                        JsArray<JavaScriptObject> creators = jsoProfile.getCreatedBy();
                        if (getObjectType(creators.get(0)).equals(IPerson.TYPE)) {
                            AgentsFactory factory = new AgentsFactory();
                            JsoAgent jperson = (JsoAgent) creators.get(0);
                            profile.setLastSavedBy((IPerson) factory.createAgent(jperson));
                        }

                        JsArray<JsoProfileEntry> plugins = jsoProfile.getStatusPlugins();
                        for (int i = 0; i < plugins.length(); i++) {
                            JsoProfileEntry entry = plugins.get(i);
                            profile.getPlugins().put(entry.getName(), entry.getStatus());
                        }

                        JsArray<JsoProfileEntry> features = jsoProfile.getStatusFeatures();
                        for (int i = 0; i < features.length(); i++) {
                            JsoProfileEntry entry = features.get(i);
                            profile.getFeatures().put(entry.getName(), entry.getStatus());
                        }

                        userProfiles.add(profile);
                    }

                    setProfiles(userProfiles);
                    stageCompleted();
                } else {
                    _application.getInitializer().addException(
                            "Couldn't retrieve User Profiles JSON (" + response.getStatusText() + ")");
                }
            }
        });
    } catch (RequestException e) {
        _application.getInitializer().addException("Couldn't retrieve User Profiles JSON");
    }
}

From source file:org.mindinformatics.gwt.framework.component.profiles.src.testing.JsonProfileManager.java

License:Apache License

@Override
public void retrieveUserCurrentProfile() {

    String url = GWT.getModuleBaseURL() + "profile/" + _application.getUserManager().getUser().getUserName()
            + "/info?format=json";
    if (!_application.isHostedMode())
        url = ApplicationUtils.getUrlBase(GWT.getModuleBaseURL()) + "profile/"
                + _application.getUserManager().getUser().getUserName() + "/info?format=json";

    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
    builder.setHeader("Content-type", "application/json");

    try {//from  w w  w. j a v a 2  s  .c  om
        Request request = builder.sendRequest(null, new RequestCallback() {
            public void onError(Request request, Throwable exception) {
                _application.getInitializer().addException("Couldn't retrieve User Profile JSON");
            }

            public void onResponseReceived(Request request, Response response) {
                if (200 == response.getStatusCode()) {
                    JsoProfile jsoProfile = (JsoProfile) ((JsArray) parseJson(response.getText())).get(0);

                    MProfile profile = new MProfile();
                    profile.setUuid(jsoProfile.getUuid());
                    profile.setName(jsoProfile.getName());
                    profile.setDescription(jsoProfile.getDescription());
                    profile.setLastSavedOn(jsoProfile.getCreatedOn());

                    AgentsFactory factory = new AgentsFactory();
                    JsArray<JavaScriptObject> creators = jsoProfile.getCreatedBy();
                    if (getObjectType(creators.get(0)).equals(IPerson.TYPE)) {
                        JsoAgent person = (JsoAgent) creators.get(0);
                        profile.setLastSavedBy((IPerson) factory.createAgent(person));
                    }

                    JsArray<JsoProfileEntry> plugins = jsoProfile.getStatusPlugins();
                    for (int i = 0; i < plugins.length(); i++) {
                        JsoProfileEntry entry = plugins.get(i);
                        profile.getPlugins().put(entry.getName(), entry.getStatus());
                    }

                    JsArray<JsoProfileEntry> features = jsoProfile.getStatusFeatures();
                    for (int i = 0; i < features.length(); i++) {
                        JsoProfileEntry entry = features.get(i);
                        profile.getFeatures().put(entry.getName(), entry.getStatus());
                    }

                    setCurrentProfile(profile);
                    stageCompleted();
                } else {
                    _application.getInitializer().addException(
                            "Couldn't retrieve User Profile JSON (" + response.getStatusText() + ")");
                }
            }
        });
    } catch (RequestException e) {
        _application.getInitializer().addException("Couldn't retrieve User Profile JSON");
    }
}

From source file:org.mindinformatics.gwt.framework.component.profiles.src.testing.JsonProfileManager.java

License:Apache License

@Override
public MProfile saveUserProfile(MProfile newProfile, final IUpdateProfileCallback callback) {
    String url = GWT.getModuleBaseURL() + "profile/" + _application.getUserManager().getUser().getUserName()
            + "/info?format=json";
    RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
    builder.setHeader("Content-type", "application/json");

    HashMap<String, String> pluginsStatus = callback.getPluginsStatus();
    HashMap<String, String> featuresStatus = callback.getFeaturesStatus();

    StringBuffer postData = new StringBuffer();
    postData.append("[");
    postData.append("  {");
    postData.append("    \"uuid\": \"");
    postData.append(newProfile.getUuid());
    postData.append("\",");
    postData.append("    \"name\": \"");
    postData.append(newProfile.getName());
    postData.append("\",");
    postData.append("    \"description\": \"");
    postData.append(newProfile.getDescription());
    postData.append("\",");
    postData.append("    \"createdon\": \"");
    DateTimeFormat fmt = DateTimeFormat.getFormat("MM/dd/yyyy HH:mm:ss Z");
    postData.append(fmt.format(new Date()));
    postData.append("\",");
    postData.append("    \"createdby\": [");
    postData.append("      {");
    postData.append("        \"@id\": \"");
    postData.append(_application.getAgentManager().getUserPerson().getUri());
    postData.append("\",");
    postData.append("        \"@type\": \"");
    postData.append("foafx:Person");
    postData.append("\",");
    postData.append("        \"foafx:name\": \"");
    postData.append(_application.getAgentManager().getUserPerson().getName());
    postData.append("\"");
    postData.append("      }");
    postData.append("     ],");

    postData.append("    \"statusplugins\": [");
    for (String key : pluginsStatus.keySet()) {
        postData.append("      {");
        postData.append("        \"uuid\": \"");
        postData.append(key);// w ww  . j  a va 2s . co m
        postData.append("\",");
        postData.append("        \"status\": \"");
        postData.append(pluginsStatus.get(key));
        postData.append("\"");
        postData.append("      },");
    }
    postData.append("     ],");

    postData.append("    \"statusfeatures\": [");
    for (String key : featuresStatus.keySet()) {
        postData.append("      {");
        postData.append("        \"uuid\": \"");
        postData.append(key);
        postData.append("\",");
        postData.append("        \"status\": \"");
        postData.append(featuresStatus.get(key));
        postData.append("\"");
        postData.append("      },");
    }
    postData.append("     ]");

    postData.append("  }");
    postData.append("]");

    try {
        Request request = builder.sendRequest(postData.toString(), new RequestCallback() {
            public void onError(Request request, Throwable exception) {
                _application.getInitializer().addException("Couldn't retrieve User Profile JSON");
            }

            public void onResponseReceived(Request request, Response response) {
                if (200 == response.getStatusCode()) {

                    JsoProfile jsoProfile = (JsoProfile) ((JsArray) parseJson(response.getText())).get(0);

                    MProfile profile = new MProfile();
                    profile.setUuid(jsoProfile.getUuid());
                    profile.setName(jsoProfile.getName());
                    profile.setDescription(jsoProfile.getDescription());
                    profile.setLastSavedOn(jsoProfile.getCreatedOn());

                    AgentsFactory factory = new AgentsFactory();
                    JsArray<JavaScriptObject> creators = jsoProfile.getCreatedBy();
                    if (getObjectType(creators.get(0)).equals(IPerson.TYPE)) {
                        JsoAgent person = (JsoAgent) creators.get(0);
                        profile.setLastSavedBy((IPerson) factory.createAgent(person));
                    }

                    JsArray<JsoProfileEntry> plugins = jsoProfile.getStatusPlugins();
                    for (int i = 0; i < plugins.length(); i++) {
                        JsoProfileEntry entry = plugins.get(i);
                        profile.getPlugins().put(entry.getName(), entry.getStatus());
                    }

                    JsArray<JsoProfileEntry> features = jsoProfile.getStatusFeatures();
                    for (int i = 0; i < features.length(); i++) {
                        JsoProfileEntry entry = features.get(i);
                        profile.getFeatures().put(entry.getName(), entry.getStatus());
                    }

                    setCurrentProfile(profile);
                    callback.updateCurrentProfile();
                } else {
                    _application.getInitializer().addException(
                            "Couldn't retrieve User Profile JSON (" + response.getStatusText() + ")");
                }
            }
        });
    } catch (RequestException e) {
        _application.getInitializer().addException("Couldn't retrieve User Profile JSON");
    }
    return newProfile;
}

From source file:org.mindinformatics.gwt.framework.component.profiles.src.testing.JsonProfileManager.java

License:Apache License

@Override
public void saveCurrentProfile(MProfile currentProfile, final IUpdateProfileCallback callback) {
    String url = GWT.getModuleBaseURL() + "profile/" + _application.getUserManager().getUser().getUserName()
            + "/save?format=json";
    if (!_application.isHostedMode())
        url = ApplicationUtils.getUrlBase(GWT.getModuleBaseURL()) + "profile/"
                + _application.getUserManager().getUser().getUserName() + "/save?format=json";

    RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
    builder.setHeader("Content-type", "application/json");

    HashMap<String, String> pluginsStatus = callback.getPluginsStatus();
    HashMap<String, String> featuresStatus = callback.getFeaturesStatus();

    StringBuffer postData = new StringBuffer();
    postData.append("[");
    postData.append("  {");
    postData.append("    \"uuid\": \"");
    postData.append(currentProfile.getUuid());
    postData.append("\",");
    postData.append("    \"name\": \"");
    postData.append(currentProfile.getName());
    postData.append("\",");
    postData.append("    \"description\": \"");
    postData.append(currentProfile.getDescription());
    postData.append("\",");
    postData.append("    \"createdOn\": \"");
    DateTimeFormat fmt = DateTimeFormat.getFormat("MM/dd/yyyy HH:mm:ss Z");
    postData.append(fmt.format(new Date()));
    postData.append("\",");
    postData.append("    \"createdBy\": [");
    postData.append("      {");
    postData.append("        \"@id\": \"");
    //Window.alert(""+currentProfile.getLastSavedBy());
    postData.append(currentProfile.getLastSavedBy().getUri());
    postData.append("\",");
    postData.append("        \"@type\": \"");
    postData.append("foafx:Person");
    postData.append("\",");
    postData.append("        \"foafx:name\": \"");
    postData.append(currentProfile.getLastSavedBy().getName());
    postData.append("\"");
    postData.append("      }");
    postData.append("     ],");
    postData.append("    \"plugins\": [");

    for (String key : pluginsStatus.keySet()) {
        postData.append("      {");
        postData.append("        \"uuid\": \"");
        postData.append(key);//from   w w w.j  a  v  a  2 s .  co m
        postData.append("\",");
        postData.append("        \"status\": \"");
        postData.append(pluginsStatus.get(key));
        postData.append("\"");
        postData.append("      },");
    }
    postData.append("     ],");

    postData.append("    \"statusfeatures\": [");
    for (String key : featuresStatus.keySet()) {
        postData.append("      {");
        postData.append("        \"uuid\": \"");
        postData.append(key);
        postData.append("\",");
        postData.append("        \"status\": \"");
        postData.append(featuresStatus.get(key));
        postData.append("\"");
        postData.append("      },");
    }
    postData.append("     ]");

    postData.append("  }");
    postData.append("]");

    try {
        Request request = builder.sendRequest(postData.toString(), new RequestCallback() {
            public void onError(Request request, Throwable exception) {
                _application.getInitializer().addException("Couldn't retrieve User Profile JSON");
            }

            public void onResponseReceived(Request request, Response response) {
                if (200 == response.getStatusCode()) {

                    /*
                    JsoProfile jsoProfile = (JsoProfile)((JsArray) parseJson(response.getText())).get(0);
                            
                    MProfile profile = new MProfile();
                    profile.setUuid(jsoProfile.getUuid());
                    profile.setName(jsoProfile.getName());
                    profile.setDescription(jsoProfile.getDescription());
                    profile.setLastSavedOn(jsoProfile.getCreatedOn());
                            
                    AgentsFactory factory = new AgentsFactory();
                    JsArray<JavaScriptObject> creators = jsoProfile.getCreatedBy();
                    if(getObjectType(creators.get(0)).equals(IPerson.TYPE)) {
                       JsoAgent person = (JsoAgent) creators.get(0);
                       profile.setLastSavedBy((IPerson) factory.createAgent(person));
                    }
                            
                    JsArray<JsoProfileEntry> plugins = jsoProfile.getStatusPlugins();
                    for(int i=0; i<plugins.length(); i++) {
                       JsoProfileEntry entry = plugins.get(i);
                       profile.getPlugins().put(entry.getName(), entry.getStatus());
                    }
                            
                    setCurrentProfile(profile);
                    */

                    callback.updateCurrentProfile();
                } else {
                    _application.getInitializer().addException(
                            "Couldn't retrieve User Profile JSON (" + response.getStatusText() + ")");
                }
            }
        });
    } catch (RequestException e) {
        _application.getInitializer().addException("Couldn't retrieve User Profile JSON");
        callback.updateCurrentProfile();
    }
}

From source file:org.obiba.opal.web.gwt.rest.client.RequestCredentials.java

License:Open Source License

public RequestBuilder provideCredentials(RequestBuilder builder) {
    if (hasOpalCredentials()) {
        builder.setHeader(OpalAuth.CREDENTIALS_HEADER, extractOpalCredentials());
    }//from   w  w w.j  a  v  a2 s  .  c om
    return builder;
}