Example usage for com.google.gwt.safehtml.shared UriUtils fromSafeConstant

List of usage examples for com.google.gwt.safehtml.shared UriUtils fromSafeConstant

Introduction

In this page you can find the example usage for com.google.gwt.safehtml.shared UriUtils fromSafeConstant.

Prototype

public static SafeUri fromSafeConstant(String s) 

Source Link

Document

Returns a SafeUri constructed from a value that is fully under the control of the program, e.g., a constant.

Usage

From source file:org.roda.wui.common.client.tools.RestUtils.java

public static SafeUri createPreservationMetadataDownloadUri(String aipId) {

    // api/v1/aips/{aip_id}/preservation_metadata/?acceptFormat=zip
    StringBuilder b = new StringBuilder();
    // base uri//from ww  w.j a v a 2 s  . com
    b.append(RodaConstants.API_REST_V1_AIPS).append(URL.encodeQueryString(aipId)).append(RodaConstants.API_SEP)
            .append(RodaConstants.API_PRESERVATION_METADATA).append(RodaConstants.API_SEP);
    // accept format attribute
    b.append(RodaConstants.API_QUERY_START).append(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT)
            .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
            .append(RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_ZIP);

    return UriUtils.fromSafeConstant(b.toString());
}

From source file:org.roda.wui.common.client.tools.RestUtils.java

public static SafeUri createRepresentationDescriptiveMetadataDownloadUri(String aipId, String representationId,
        String descId, String versionId) {
    // api/v1/representations/{aip_id}/{representation_id}/descriptive_metadata/{descId}?acceptFormat=xml&version_id={versionId}
    StringBuilder b = new StringBuilder();
    // base uri//from   w  w w.j av  a  2  s  . c om
    b.append(RodaConstants.API_REST_V1_REPRESENTATIONS).append(URL.encodeQueryString(aipId))
            .append(RodaConstants.API_SEP).append(URL.encodeQueryString(representationId))
            .append(RodaConstants.API_SEP).append(RodaConstants.API_DESCRIPTIVE_METADATA)
            .append(RodaConstants.API_SEP).append(descId);
    // accept format attribute
    b.append(RodaConstants.API_QUERY_START).append(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT)
            .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
            .append(RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_BIN);

    if (versionId != null) {
        b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_QUERY_PARAM_VERSION_ID)
                .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL).append(versionId);
    }

    return UriUtils.fromSafeConstant(b.toString());
}

From source file:org.roda.wui.common.client.tools.RestUtils.java

public static SafeUri createRepresentationDescriptiveMetadataHTMLUri(String aipId, String representationId,
        String descId, String versionId) {
    // api/v1/representations/{aip_id}/{representation_id}/descriptive_metadata/{descId}?acceptFormat=html&version_id={versionId}
    StringBuilder b = new StringBuilder();
    // base uri//www.j a v a2 s .co  m
    b.append(RodaConstants.API_REST_V1_REPRESENTATIONS).append(URL.encodeQueryString(aipId))
            .append(RodaConstants.API_SEP).append(URL.encodeQueryString(representationId))
            .append(RodaConstants.API_SEP).append(RodaConstants.API_DESCRIPTIVE_METADATA)
            .append(RodaConstants.API_SEP).append(descId);
    // accept format attribute
    b.append(RodaConstants.API_QUERY_START).append(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT)
            .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
            .append(RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_HTML);

    if (versionId != null) {
        b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_QUERY_PARAM_VERSION_ID)
                .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL).append(versionId);
    }

    // locale
    b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_QUERY_KEY_LANG)
            .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
            .append(LocaleInfo.getCurrentLocale().getLocaleName());

    return UriUtils.fromSafeConstant(b.toString());
}

From source file:org.roda.wui.common.client.tools.RestUtils.java

public static SafeUri createPreservationEventDetailsHTMLUri(String eventId, String aipId,
        String representationUUID, String fileUUID) {
    // api/v1/events?id={event_id}&aipId={aip_id}&representationUUID={representationUUID}&fileUUID={fileUUID}&onlyDetails=true&acceptFormat=html&lang={lang}
    StringBuilder b = new StringBuilder();

    b.append(RodaConstants.API_REST_V1_EVENTS).append(RodaConstants.API_QUERY_START)
            .append(RodaConstants.API_QUERY_PARAM_ID).append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
            .append(URL.encodeQueryString(eventId));

    if (aipId != null) {
        b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_PATH_PARAM_AIP_ID)
                .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL).append(URL.encodeQueryString(aipId));
    }/*  www.j a  v a2  s  . c o  m*/

    if (representationUUID != null) {
        b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_PATH_PARAM_REPRESENTATION_UUID)
                .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
                .append(URL.encodeQueryString(representationUUID));
    }

    if (fileUUID != null) {
        b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_PATH_PARAM_FILE_UUID)
                .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL).append(URL.encodeQueryString(fileUUID));
    }

    b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_QUERY_PARAM_ONLY_DETAILS)
            .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
            .append(URL.encodeQueryString(Boolean.toString(true)));

    b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT)
            .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
            .append(URL.encodeQueryString(RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_HTML));

    b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_QUERY_KEY_LANG)
            .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
            .append(LocaleInfo.getCurrentLocale().getLocaleName());

    return UriUtils.fromSafeConstant(b.toString());
}

From source file:org.roda.wui.common.client.tools.RestUtils.java

public static SafeUri createTransferredResourceDownloadUri(String resourceId) {
    // api/v1/transferred/{transferred_resource_uuid}?acceptFormat=bin
    StringBuilder b = new StringBuilder();
    // base uri//from   w  w  w  .  j a  v  a 2  s . c  o  m
    b.append(RodaConstants.API_REST_V1_RESOURCES).append(resourceId).append(RodaConstants.API_QUERY_START)
            .append(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT).append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
            .append(RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_BIN);

    return UriUtils.fromSafeConstant(b.toString());
}

From source file:org.roda.wui.common.client.tools.RestUtils.java

public static SafeUri createThemeResourceUri(String resourceId, String defaultResourceId, boolean inline) {
    // api/v1/theme/?resource_id={resourceId}&default_resource_od={defaultResourceId}
    StringBuilder b = new StringBuilder();

    b.append(RodaConstants.API_REST_V1_THEME).append(RodaConstants.API_QUERY_START)
            .append(RodaConstants.API_QUERY_PARAM_RESOURCE_ID).append(RodaConstants.API_QUERY_ASSIGN_SYMBOL)
            .append(resourceId);// w ww  .j a va 2  s.  c  o  m

    if (defaultResourceId != null) {
        b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_QUERY_PARAM_DEFAULT_RESOURCE_ID)
                .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL).append(defaultResourceId);
    }

    if (inline) {
        b.append(RodaConstants.API_QUERY_SEP).append(RodaConstants.API_QUERY_PARAM_INLINE)
                .append(RodaConstants.API_QUERY_ASSIGN_SYMBOL).append(inline);
    }

    return UriUtils.fromSafeConstant(b.toString());
}