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.opennms.ipv6.summary.gui.client.DefaultChartService.java

License:Open Source License

private void sendRequest(String url, RequestCallback callback) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url));
    builder.setHeader("Accept", "application/json");

    builder.setUser("ipv6Rest");
    builder.setPassword("ipv6Rest");
    try {//from   w w  w .j  a  v  a2s. c o  m
        builder.sendRequest(null, callback);
    } catch (RequestException e) {
        e.printStackTrace();
    }
}

From source file:org.opennms.ipv6.summary.gui.client.Navigation.java

License:Open Source License

@UiHandler("m_link")
public void linkTopOpenNMSClicked(ClickEvent event) {
    StringBuffer postData = new StringBuffer();
    // note param pairs are separated by a '&' 
    // and each key-value pair is separated by a '='
    postData.append(URL.encode("j_username")).append("=").append(URL.encode("ipv6"));
    postData.append("&");
    postData.append(URL.encode("j_password")).append("=").append(URL.encode("ipv6"));
    postData.append("&");
    postData.append(URL.encode("Login")).append("=").append(URL.encode("login"));

    RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
            URL.encode("/opennms/j_spring_security_check"));
    builder.setHeader("Content-type", "application/x-www-form-urlencoded");
    try {//w  w  w .j  a v  a 2 s  .  c om
        builder.sendRequest(postData.toString(), new RequestCallback() {

            @Override
            public void onResponseReceived(Request request, Response response) {
                if (response.getStatusCode() == 200) {
                    Window.open("/opennms/index.jsp", "_target", null);
                } else {
                    Window.alert("Failed to login");
                }
            }

            @Override
            public void onError(Request request, Throwable exception) {
                Window.alert("Problem Logging in");
            }
        });
    } catch (RequestException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    //Window.alert("Cliking link to OpenNMS");
}

From source file:org.openremote.web.console.service.JSONControllerConnector.java

License:Open Source License

private void doJsonRequest(String url, String username, String password, JSONControllerCallback callback,
        Integer timeout) {/*w w w.j  a v a 2  s.c  o m*/
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
    Request request = null;

    // Add accept header
    builder.setHeader("Accept", "application/json");

    if (username != null && username.length() > 0) {
        if (password == null)
            password = "";

        // Add authentication header
        String authStr = username + ":" + password;
        String authEnc = "Basic " + BrowserUtils.base64Encode(authStr);
        builder.setHeader("Authorization", authEnc);
    }

    builder.setCallback(callback);

    if (timeout != null) {
        builder.setTimeoutMillis(timeout);
    }

    try {
        request = builder.send();
    } catch (RequestException e) {
        callback.onError(request, e);
    }
}

From source file:org.openremote.web.console.util.BrowserUtils.java

License:Open Source License

public static void isURLSameOrigin(String url, final AsyncControllerCallback<Boolean> callback) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url + "rest/panels/");
    builder.setHeader("Accept", "application/json");
    builder.setTimeoutMillis(2000);//from www .j a  v  a 2s.c  om

    try {
        Request request = builder.sendRequest(null, new RequestCallback() {
            public void onError(Request request, Throwable exception) {
                callback.onSuccess(true);
            }

            public void onResponseReceived(Request request, Response response) {
                if (response.getStatusCode() == 0) {
                    callback.onSuccess(false);
                } else {
                    callback.onSuccess(true);
                }
            }
        });
    } catch (RequestException e) {
        // Violates SOP
        callback.onSuccess(false);
    }
}

From source file:org.opentaps.gwt.common.client.listviews.EntityEditableListView.java

License:Open Source License

/**
 * Handles the save all batch action, this takes all records that need
 * to be created, update or deleted and send them in one request.
 * The posted data is the same format as for a <code>service-multi</code>.
 *///from www.j  av a 2s.  c  om
protected void doBatchAction() {
    UtilUi.logInfo("doBatchAction ...", MODULE, "doBatchAction");
    String data = makeBatchPostData();
    if (data == null) {
        UtilUi.logInfo("nothing to do", MODULE, "doBatchAction");
        return;
    }

    RequestBuilder request = new RequestBuilder(RequestBuilder.POST, GWT.getHostPageBaseURL() + saveAllUrl);
    request.setHeader("Content-type", "application/x-www-form-urlencoded");
    request.setRequestData(data);
    request.setTimeoutMillis(UtilLookup.getAjaxDefaultTimeout());
    request.setCallback(new RequestCallback() {
        public void onError(Request request, Throwable exception) {
            // display error message
            markGridNotBusy();
            UtilUi.errorMessage(exception.toString());
        }

        public void onResponseReceived(Request request, Response response) {
            // if it is a correct response, reload the grid
            markGridNotBusy();
            UtilUi.logInfo("onResponseReceived, response = " + response, MODULE, "doBatchAction");
            if (!ServiceErrorReader.showErrorMessageIfAny(response, saveAllUrl)) {
                // commit store changes
                getStore().commitChanges();
                loadFirstPage();
            }
        }
    });
    try {
        markGridBusy();
        UtilUi.logInfo("posting batch", MODULE, "doBatchAction");
        request.send();
    } catch (RequestException e) {
        // display error message
        UtilUi.errorMessage(e.toString(), MODULE, "doBatchAction");
    }
}

From source file:org.opentaps.gwt.common.client.services.Service.java

License:Open Source License

/**
 * Sends the request and get the result asynchronously.
 * @param cb an <code>AsyncCallback</code> instance for the returned <code>Record</code>
 *///w  ww  .  j av a  2s .  c  om
public void request(final AsyncCallback<Record> cb) {
    RequestBuilder request = new RequestBuilder(RequestBuilder.POST, GWT.getHostPageBaseURL() + url);
    request.setHeader("Content-type", "application/x-www-form-urlencoded");
    request.setRequestData(data);
    request.setTimeoutMillis(UtilLookup.getAjaxDefaultTimeout());
    request.setCallback(new RequestCallback() {
        public void onError(Request request, Throwable exception) {
            // display error message
            if (autoPopupErrors) {
                UtilUi.errorMessage(exception.toString());
            } else {
                UtilUi.logError("onError, error = " + exception.toString(), MODULE, "request");
            }
            cb.onFailure(exception);
        }

        public void onResponseReceived(Request request, Response response) {
            UtilUi.logInfo("onResponseReceived, response = " + response, MODULE, "request");
            String err = ServiceErrorReader.getErrorMessageIfAny(response, url);
            if (err == null) {
                if (store != null) {
                    store.loadJsonData(response.getText(), false);
                    Record rec = null;
                    if (store.getTotalCount() > 0) {
                        rec = store.getRecordAt(0);
                    }
                    cb.onSuccess(rec);
                }
            } else {
                if (autoPopupErrors) {
                    UtilUi.errorMessage(err);
                } else {
                    UtilUi.logError("onResponseReceived, error = " + err, MODULE, "request");
                }
                cb.onFailure(new RequestException(err));
            }
        }
    });
    try {
        UtilUi.logInfo("posting request", MODULE, "request");
        request.send();
    } catch (RequestException e) {
        if (autoPopupErrors) {
            UtilUi.errorMessage(e.toString());
        } else {
            UtilUi.logError("Caught RequestException, error = " + e.toString(), MODULE, "request");
        }
        cb.onFailure(e);
    }
}

From source file:org.opentaps.gwt.crmsfa.client.accounts.form.AccountsSublistView.java

License:Open Source License

/** {@inheritDoc} */
@Override/* w  ww  . j a v  a  2s .  c o m*/
public void init() {

    String entityViewUrl = "/crmsfa/control/viewAccount?partyId={0}";
    StringFieldDef idDefinition = new StringFieldDef(PartyLookupConfiguration.INOUT_PARTY_ID);

    makeLinkColumn(UtilUi.MSG.crmContactId(), idDefinition, entityViewUrl, true);
    makeLinkColumn(UtilUi.MSG.crmAccountName(), idDefinition,
            new StringFieldDef(PartyLookupConfiguration.INOUT_FRIENDLY_PARTY_NAME), entityViewUrl, true);
    makeColumn(UtilUi.MSG.partyCity(), new StringFieldDef(PartyLookupConfiguration.INOUT_CITY));
    makeColumn(UtilUi.MSG.crmPrimaryEmail(), new StringFieldDef(PartyLookupConfiguration.INOUT_EMAIL));
    makeColumn(UtilUi.MSG.crmPrimaryPhone(),
            new StringFieldDef(PartyLookupConfiguration.INOUT_FORMATED_PHONE_NUMBER));
    makeColumn(UtilUi.MSG.partyToName(), new StringFieldDef(PartyLookupConfiguration.INOUT_TO_NAME));
    makeColumn(UtilUi.MSG.partyAttentionName(),
            new StringFieldDef(PartyLookupConfiguration.INOUT_ATTENTION_NAME));
    makeColumn(UtilUi.MSG.partyAddressLine1(), new StringFieldDef(PartyLookupConfiguration.INOUT_ADDRESS));
    makeColumn(UtilUi.MSG.partyAddressLine2(), new StringFieldDef(PartyLookupConfiguration.OUT_ADDRESS_2));
    makeColumn(UtilUi.MSG.partyState(), new StringFieldDef(PartyLookupConfiguration.INOUT_STATE));
    makeColumn(UtilUi.MSG.partyCountry(), new StringFieldDef(PartyLookupConfiguration.INOUT_COUNTRY));
    makeColumn(UtilUi.MSG.partyPostalCode(), new StringFieldDef(PartyLookupConfiguration.INOUT_POSTAL_CODE));
    makeColumn(UtilUi.MSG.crmPostalCodeExt(), new StringFieldDef(PartyLookupConfiguration.OUT_POSTAL_CODE_EXT));

    // add last column if logged in user has required permission
    deleteColumnIndex = getCurrentColumnIndex();
    if (hasAccountsRemoveAbility()) {
        ColumnConfig config = makeColumn("", new Renderer() {
            public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex,
                    int colNum, Store store) {
                return Format.format("<img width=\"15\" height=\"15\" class=\"checkbox\" src=\"{0}\"/>",
                        UtilUi.ICON_DELETE);
            }
        });
        config.setWidth(26);
        config.setResizable(false);
        config.setFixed(true);
        config.setSortable(false);

        addGridCellListener(new GridCellListenerAdapter() {
            private final String actionUrl = "/crmsfa/control/removeContactFromAccountAJX";

            /** {@inheritDoc} */
            @Override
            public void onCellClick(GridPanel grid, int rowIndex, int colindex, EventObject e) {
                if (colindex == AccountsSublistView.this.deleteColumnIndex) {
                    String accountPartyId = getStore().getRecordAt(rowIndex).getAsString("partyId");
                    RequestBuilder request = new RequestBuilder(RequestBuilder.POST, actionUrl);
                    request.setHeader("Content-type", "application/x-www-form-urlencoded");
                    request.setRequestData(Format.format("partyId={0}&contactPartyId={0}&accountPartyId={1}",
                            AccountsSublistView.this.contactPartyId, accountPartyId));
                    request.setCallback(new RequestCallback() {
                        public void onError(Request request, Throwable exception) {
                            // display error message
                            markGridNotBusy();
                            UtilUi.errorMessage(exception.toString());
                        }

                        public void onResponseReceived(Request request, Response response) {
                            // if it is a correct response, reload the grid
                            markGridNotBusy();
                            UtilUi.logInfo("onResponseReceived, response = " + response, MODULE,
                                    "ContactListView.init()");
                            if (!ServiceErrorReader.showErrorMessageIfAny(response, actionUrl)) {
                                getStore().reload();
                                loadFirstPage();
                            }
                        }
                    });

                    try {
                        markGridBusy();
                        UtilUi.logInfo("posting batch", MODULE, "ContactListView.init()");
                        request.send();
                    } catch (RequestException re) {
                        // display error message
                        UtilUi.errorMessage(e.toString(), MODULE, "ContactListView.init()");
                    }

                }
            }

        });
    }

    configure(PartyLookupConfiguration.URL_FIND_ACCOUNTS, PartyLookupConfiguration.INOUT_PARTY_ID, SortDir.ASC);

    // by default, hide non essential columns
    setColumnHidden(PartyLookupConfiguration.INOUT_PARTY_ID, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_STATE, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_COUNTRY, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_TO_NAME, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_ATTENTION_NAME, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_ADDRESS, true);
    setColumnHidden(PartyLookupConfiguration.OUT_ADDRESS_2, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_POSTAL_CODE, true);
    setColumnHidden(PartyLookupConfiguration.OUT_POSTAL_CODE_EXT, true);
}

From source file:org.opentaps.gwt.crmsfa.client.contacts.form.ContactsSublistView.java

License:Open Source License

/** {@inheritDoc} */
@Override/*from   ww  w .jav a2 s  .  c o m*/
public void init() {

    String entityViewUrl = "/crmsfa/control/viewContact?partyId={0}";
    StringFieldDef idDefinition = new StringFieldDef(PartyLookupConfiguration.INOUT_PARTY_ID);

    makeLinkColumn(UtilUi.MSG.crmContactId(), idDefinition, entityViewUrl, true);
    makeLinkColumn(UtilUi.MSG.crmContactName(), idDefinition,
            new StringFieldDef(PartyLookupConfiguration.INOUT_FRIENDLY_PARTY_NAME), entityViewUrl, true);
    makeColumn(UtilUi.MSG.partyCity(), new StringFieldDef(PartyLookupConfiguration.INOUT_CITY));
    makeColumn(UtilUi.MSG.crmPrimaryEmail(), new StringFieldDef(PartyLookupConfiguration.INOUT_EMAIL));
    makeColumn(UtilUi.MSG.crmPrimaryPhone(),
            new StringFieldDef(PartyLookupConfiguration.INOUT_FORMATED_PHONE_NUMBER));
    makeColumn(UtilUi.MSG.partyToName(), new StringFieldDef(PartyLookupConfiguration.INOUT_TO_NAME));
    makeColumn(UtilUi.MSG.partyAttentionName(),
            new StringFieldDef(PartyLookupConfiguration.INOUT_ATTENTION_NAME));
    makeColumn(UtilUi.MSG.partyAddressLine1(), new StringFieldDef(PartyLookupConfiguration.INOUT_ADDRESS));
    makeColumn(UtilUi.MSG.partyAddressLine2(), new StringFieldDef(PartyLookupConfiguration.OUT_ADDRESS_2));
    makeColumn(UtilUi.MSG.partyState(), new StringFieldDef(PartyLookupConfiguration.INOUT_STATE));
    makeColumn(UtilUi.MSG.partyCountry(), new StringFieldDef(PartyLookupConfiguration.INOUT_COUNTRY));
    makeColumn(UtilUi.MSG.partyPostalCode(), new StringFieldDef(PartyLookupConfiguration.INOUT_POSTAL_CODE));
    makeColumn(UtilUi.MSG.crmPostalCodeExt(), new StringFieldDef(PartyLookupConfiguration.OUT_POSTAL_CODE_EXT));

    // add Remove button if user has required permission
    if (hasRemovePermission(isOpportunity)) {
        deleteColumnIndex = getCurrentColumnIndex();
        ColumnConfig config = makeColumn("", new Renderer() {
            public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex,
                    int colNum, Store store) {
                return Format.format("<img width=\"15\" height=\"15\" class=\"checkbox\" src=\"{0}\"/>",
                        UtilUi.ICON_DELETE);
            }
        });
        config.setWidth(26);
        config.setResizable(false);
        config.setFixed(true);
        config.setSortable(false);

        addGridCellListener(new GridCellListenerAdapter() {
            private final String actionUrl = isOpportunity ? "/crmsfa/control/removeContactFromOpportunityAJX"
                    : "/crmsfa/control/removeContactFromAccountAJX";

            /** {@inheritDoc} */
            @Override
            public void onCellClick(GridPanel grid, int rowIndex, int colindex, EventObject e) {
                if (colindex == ContactsSublistView.this.deleteColumnIndex) {
                    String contactPartyId = getStore().getRecordAt(rowIndex).getAsString("partyId");
                    RequestBuilder request = new RequestBuilder(RequestBuilder.POST, actionUrl);
                    request.setHeader("Content-type", "application/x-www-form-urlencoded");
                    if (isOpportunity) {
                        request.setRequestData(Format.format("salesOpportunityId={0}&contactPartyId={1}",
                                ContactsSublistView.this.entityId, contactPartyId));
                    } else {
                        request.setRequestData(
                                Format.format("partyId={0}&accountPartyId={0}&contactPartyId={1}",
                                        ContactsSublistView.this.entityId, contactPartyId));
                    }
                    request.setCallback(new RequestCallback() {
                        public void onError(Request request, Throwable exception) {
                            // display error message
                            markGridNotBusy();
                            UtilUi.errorMessage(exception.toString());
                        }

                        public void onResponseReceived(Request request, Response response) {
                            // if it is a correct response, reload the grid
                            markGridNotBusy();
                            UtilUi.logInfo("onResponseReceived, response = " + response, MODULE,
                                    "ContactListView.init()");
                            if (!ServiceErrorReader.showErrorMessageIfAny(response, actionUrl)) {
                                // commit store changes
                                getStore().reload();
                                loadFirstPage();
                            }
                        }
                    });

                    try {
                        markGridBusy();
                        UtilUi.logInfo("posting batch", MODULE, "ContactListView.init()");
                        request.send();
                    } catch (RequestException re) {
                        // display error message
                        UtilUi.errorMessage(e.toString(), MODULE, "ContactListView.init()");
                    }

                }
            }

        });
    }

    configure(PartyLookupConfiguration.URL_FIND_CONTACTS, PartyLookupConfiguration.INOUT_PARTY_ID, SortDir.ASC);

    // by default, hide non essential columns
    setColumnHidden(PartyLookupConfiguration.INOUT_PARTY_ID, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_STATE, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_COUNTRY, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_TO_NAME, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_ATTENTION_NAME, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_ADDRESS, true);
    setColumnHidden(PartyLookupConfiguration.OUT_ADDRESS_2, true);
    setColumnHidden(PartyLookupConfiguration.INOUT_POSTAL_CODE, true);
    setColumnHidden(PartyLookupConfiguration.OUT_POSTAL_CODE_EXT, true);
}

From source file:org.opentaps.gwt.crmsfa.client.Entry.java

License:Open Source License

/**
 * This method setup a button into subsection title at right-hand position
 * and allow to assign a new account using lookup accounts window.
 * @param container <code>RootPanel</code> that is root container for button
 * @param contactAccounts parent accounts list view.
 *//*from w  w  w . j a v a 2 s. com*/
private void loadAssignAccountToContactWidget(RootPanel container, final AccountsSublistView contactAccounts) {

    // create lookup window
    final LookupAccountsWindow window = new LookupAccountsWindow(true, true);
    window.create();

    // register listener to be notified when user selects an account
    window.register(new FormNotificationInterface<String>() {

        /** {@inheritDoc} */
        public void notifySuccess(String obj) {
            if (obj == null) {
                return;
            }

            final String actionUrl = "/crmsfa/control/assignAccountToContactAJX";

            // keep user's selection
            String accountPartyId = obj;

            // nothing special, just send HTTP POST request
            // and run crmsfa.assignContactToAccount service
            RequestBuilder request = new RequestBuilder(RequestBuilder.POST, actionUrl);
            request.setHeader("Content-type", "application/x-www-form-urlencoded");
            request.setRequestData(Format.format("partyId={0}&contactPartyId={0}&accountPartyId={1}",
                    getPartyId(), accountPartyId));
            request.setCallback(new RequestCallback() {
                public void onError(Request request, Throwable exception) {
                    // display error message
                    UtilUi.errorMessage(exception.toString());
                }

                public void onResponseReceived(Request request, Response response) {
                    // we don't expect anything from server, just reload the list of contacts
                    UtilUi.logInfo("onResponseReceived, response = " + response, "",
                            "loadAssignContactToAccountWidget");
                    if (!ServiceErrorReader.showErrorMessageIfAny(response, actionUrl)) {
                        contactAccounts.getStore().reload();
                        contactAccounts.loadFirstPage();
                    }
                    contactAccounts.markGridNotBusy();
                }
            });

            try {
                contactAccounts.markGridBusy();
                UtilUi.logInfo("Run service crmsfa.assignContactToAccount", MODULE,
                        "loadAssignContactToAccountWidget");
                request.send();
            } catch (RequestException re) {
                // display error message
                UtilUi.errorMessage(re.toString(), MODULE, "loadAssignContactToAccountWidget");
            }
        }

    });

    // create hyperlink as submenu button
    Button embedLink = new Button(UtilUi.MSG.crmAssignAccount(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            window.show();
        }

    });
    embedLink.setStyleName("subMenuButton");

    // place [Assign Contact] button on page
    container.add(embedLink);
}

From source file:org.opentaps.gwt.crmsfa.client.Entry.java

License:Open Source License

/**
 * This method setup a button into subsection title at right-hand position
 * and allow to assign a new contact using lookup contacts window.
 * @param container <code>RootPanel</code> that is root container for button
 * @param opportunityContacts parent contacts list view.
 *//*from  www. j a v  a 2 s.  c om*/
private void loadAssignContactToOpportunityWidget(RootPanel container,
        final ContactsSublistView opportunityContacts) {

    // create lookup window
    final LookupContactsWindow window = new LookupContactsWindow(true, true);
    window.create();

    // register listener to be notified when user selects a contact
    window.register(new FormNotificationInterface<String>() {

        /** {@inheritDoc} */
        public void notifySuccess(String obj) {
            if (obj == null) {
                return;
            }

            final String actionUrl = "/crmsfa/control/addContactToOpportunityAJX";

            // keep user's selection
            String contactPartyId = obj;

            // nothing special, just send HTTP POST request
            // and run crmsfa.assignContactToAccount service
            RequestBuilder request = new RequestBuilder(RequestBuilder.POST, actionUrl);
            request.setHeader("Content-type", "application/x-www-form-urlencoded");
            request.setRequestData(Format.format("salesOpportunityId={0}&contactPartyId={1}",
                    getSalesOpportunityId(), contactPartyId));
            request.setCallback(new RequestCallback() {
                public void onError(Request request, Throwable exception) {
                    // display error message
                    UtilUi.errorMessage(exception.toString());
                }

                public void onResponseReceived(Request request, Response response) {
                    // we don't expect anything from server, just reload the list of contacts
                    UtilUi.logInfo("onResponseReceived, response = " + response, "",
                            "loadAssignContactToAccountWidget");
                    if (!ServiceErrorReader.showErrorMessageIfAny(response, actionUrl)) {
                        opportunityContacts.getStore().reload();
                        opportunityContacts.loadFirstPage();
                    }
                    opportunityContacts.markGridNotBusy();
                }
            });

            try {
                opportunityContacts.markGridBusy();
                UtilUi.logInfo("Run service crmsfa.assignContactToAccount", MODULE,
                        "loadAssignContactToAccountWidget");
                request.send();
            } catch (RequestException re) {
                // display error message
                UtilUi.errorMessage(re.toString(), MODULE, "loadAssignContactToAccountWidget");
            }
        }

    });

    // create hyperlink as submenu button
    Button embedLink = new Button(UtilUi.MSG.crmAssignContact(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            window.show();
        }

    });
    embedLink.setStyleName("subMenuButton");

    // place [Assign Contact] button on page
    container.add(embedLink);
}