Example usage for com.google.gwt.http.client URL encodeComponent

List of usage examples for com.google.gwt.http.client URL encodeComponent

Introduction

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

Prototype

@Deprecated
public static String encodeComponent(String decodedURLComponent, boolean queryStringSpaces) 

Source Link

Document

Returns a string where all characters that are not valid for a URL component have been escaped.

Usage

From source file:org.ednovo.gooru.client.mvp.play.collection.end.CollectionEndView.java

License:Open Source License

@Override
public void showShareWidget(final CollectionDo collectionDo, Map<String, String> collectionShare) {
    shareBitlyUrl = collectionShare.get("shortenUrl");
    originalUrl = collectionShare.get("decodeRawUrl");
    encodeUrl = collectionShare.get("rawUrl");
    SocialShareWidget swidget = new SocialShareWidget(collectionDo.getGoals(),
            collectionDo.getThumbnails().getUrl(), "collection") {
        @Override//from ww w. jav  a2s  .c o  m
        public void onTwitter() {
            Window.open("http://twitter.com/intent/tweet?text=" + GL0733 + " " + GL_GRR_Hyphen + " "
                    + collectionDo.getTitle().replaceAll("\\+", "%2B") + ": "
                    + URL.encodeComponent(originalUrl, true), "_blank", "width=600,height=300");
        }

        @Override
        public void onFacebook() {
            SocialShareView.postOnFacebook(collectionDo.getTitle(), encodeUrl, getResourceDescription(),
                    getThumbnailUrl());
        }

        @Override
        public void onEmail() {

            String emailSubject = "Gooru - " + collectionDo.getTitle();
            String emailDescription = collectionDo.getTitle() + "<div><br/></div><div>" + originalUrl
                    + "</div><div><br/></div><div>" + GL1429 + "</div>";
            emailShareView = new CollectionEmailShareView(emailSubject, emailDescription) {
                @Override
                public void sendEmail(String fromEmail, String toEmail, String copyEmail, String subject,
                        String message) {
                    getUiHandlers().sendEmail(fromEmail, toEmail, copyEmail, subject, message);
                }
            };
            emailShareView.show();

        }
    };

    collectionPlayerSummaryShareTextBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            collectionPlayerSummaryShareTextBox.setFocus(true);
            collectionPlayerSummaryShareTextBox.selectAll();
        }
    });

    collectionPlayerSummaryShareTextBox.setReadOnly(true);
    collectionPlayerSummaryShareTextBox.getElement().setAttribute("readOnly", "");
    collectionPlayerSummaryShareTextBox.setText(originalUrl);
    ftmSummaryPageContainer.add(swidget);

}

From source file:org.sigmah.client.SigmahAppFrame.java

License:Open Source License

private void configureReportAnchor(final Anchor reportButton, final Authentication auth, String hostUrl) {

    final String versionNumber = Dictionary.getDictionary(SigmahAuthProvider.DICTIONARY_NAME)
            .get(SigmahAuthProvider.VERSION_NUMBER);

    // The current date
    Date now = new Date();
    DateTimeFormat dtf = DateTimeFormat.getFormat("dd-MM-yyyy");
    final String dateString = dtf.format(now);

    String subject = I18N.MESSAGES.bugReportMailObject(auth.getEmail(), hostUrl, dateString);

    final StringBuilder hrefBuilder = new StringBuilder("mailto:");
    hrefBuilder.append(I18N.CONSTANTS.bugReportSupportAddress()).append("?subject=")
            .append(URL.encodeComponent(subject, false)).append("&body=")
            .append(URL.encodeComponent(I18N.MESSAGES.bugReportBody(getUserAgent(), versionNumber), false));

    reportButton.setHref(hrefBuilder.toString());

}