本文整理匯總了Java中com.google.gwt.http.client.URL.encode方法的典型用法代碼示例。如果您正苦於以下問題:Java URL.encode方法的具體用法?Java URL.encode怎麽用?Java URL.encode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.http.client.URL
的用法示例。
在下文中一共展示了URL.encode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildCompleteJsonUrl
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
private static String buildCompleteJsonUrl(String controllerUrl, String[] params, EnumControllerCommand command) {
String url = controllerUrl;
int paramCounter = 0;
url = url.endsWith("/") ? url : url + "/";
String methodUrl = getJsonMethodUrl(command);
if (methodUrl.equals("")) {
return "";
} else {
url += methodUrl;
}
for (String param : params) {
url += param;
paramCounter++;
if (paramCounter < params.length) {
url = url.endsWith("/") ? url : url + "/";
}
}
url = URL.encode(url);
return url;
}
示例2: buildCompleteJsonUrl
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
private static String buildCompleteJsonUrl(String controllerUrl, String[] params, EnumControllerCommand command) {
String url = controllerUrl;
int paramCounter = 0;
url = url.endsWith("/") ? url : url + "/";
String methodUrl = getJsonMethodUrl(command);
if (methodUrl.equals("")) {
return "";
} else {
url += methodUrl;
}
for (String param : params) {
url += param;
paramCounter++;
if (paramCounter < params.length) {
url = url.endsWith("/") ? url : url + "/";
}
}
url = URL.encode(url);
return url;
}
示例3: init
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
public void init(LASRequest request, String cruiseid) {
message.setVisible(false);
request.setOperation("Cruise_List", "v7");
List<Map<String, String>> c = request.getVariableConstraints();
for (Iterator cIt = c.iterator(); cIt.hasNext();) {
Map<String, String> map = (Map<String, String>) cIt.next();
String varid = map.get("varID");
if ( varid.equals(cruiseid)) {
} else {
}
}
String url = Util.getProductServer()+"?xml="+URL.encode(request.toString());
RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, UriUtils.sanitizeUri(url));
try {
sendRequest.sendRequest(null, iconListRequestCallback);
} catch (RequestException e) {
message.setVisible(true);
message.setHTML("Unable to icon list");
}
}
示例4: getProfileFileURL
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
/**
* Return the URL for the default user profile file
* @param fileDescr the user file descriptor
* @param isThumbnail true if we need a thumbnail, otherwise false
* @return the required URL
*/
public static String getProfileFileURL( final int userID, final ShortFileDescriptor fileDescr, final boolean isThumbnail ) {
final int fileID, ownerID = userID;
final String fileName = getURLAllowedFileName( fileDescr, PROFILE_FILE_DEFAULT_NAME_PREFIX );
final boolean isImageFile;
if( fileDescr == null ) {
fileID = ShortFileDescriptor.UNKNOWN_FILE_ID;
isImageFile = true;
} else {
fileID = fileDescr.fileID;
isImageFile = SupportedFileMimeTypes.isImageMimeType( fileDescr.mimeType ) ||
SupportedFileMimeTypes.isImageMimeType( SupportedFileMimeTypes.getFileMimeTypeStringByExtension( fileName ) );
}
return URL.encode( GWT.getModuleBaseURL() +
USER_PROFILE_FILES_SERVLET_CONTEXT +
SERVER_CONTEXT_DELIMITER + URL.encodeQueryString( fileName ) + URL_QUERY_DELIMITER +
FOR_USER_ID_IMAGE_SERVLET_PARAM + SERVER_PARAM_NAME_VAL_DELIM + ownerID + SERVLET_PARAMETERS_DELIMITER +
FILE_ID_SERVLET_PARAM + SERVER_PARAM_NAME_VAL_DELIM + fileID + SERVLET_PARAMETERS_DELIMITER +
IS_THUMBNAIL_SERVLET_PARAM + SERVER_PARAM_NAME_VAL_DELIM + (isThumbnail ? "1" : "0") + SERVLET_PARAMETERS_DELIMITER +
IS_IMAGE_SERVLET_PARAM + SERVER_PARAM_NAME_VAL_DELIM + (isImageFile ? "1" : "0") );
}
示例5: getProfileAvatarURL
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
/**
* Return the URL for the user avatar image
* @param userID the id of the user we want a picture of
* @param isMale true if this is a male's avatar, it is only
* neded if the user's avatar is not set.
* @param update true if we want to update the image, in this
* case the URL will be changed.
* @return the required URL
*/
private static String getProfileAvatarURL( final int userID, final boolean isMale, final boolean update ) {
long time; final boolean isMyAvatar = (userID == SiteManager.getUserID());
if( isMyAvatar ) {
if( update || myAvatarUpdateTimeMillisec < System.currentTimeMillis() ) {
myAvatarUpdateTimeMillisec += 60000;
}
time = myAvatarUpdateTimeMillisec;
} else {
if( update || otherAvatarsUpdateTimeMillisec < System.currentTimeMillis() ) {
otherAvatarsUpdateTimeMillisec += 60000;
}
time = otherAvatarsUpdateTimeMillisec;
}
return URL.encode( GWT.getModuleBaseURL() +
ServerSideAccessManager.USER_PROFILE_AVATAR_SERVLET_CONTEXT + ServerSideAccessManager.URL_QUERY_DELIMITER +
ServerSideAccessManager.FOR_USER_ID_AVATAR_SERVLET_PARAM + ServerSideAccessManager.SERVER_PARAM_NAME_VAL_DELIM + userID + ServerSideAccessManager.SERVLET_PARAMETERS_DELIMITER +
ServerSideAccessManager.FOR_USER_GENDER_AVATAR_SERVLET_PARAM + ServerSideAccessManager.SERVER_PARAM_NAME_VAL_DELIM + ( isMale ? "1" : "0") + ServerSideAccessManager.SERVLET_PARAMETERS_DELIMITER +
ServerSideAccessManager.DUMMY_TIME_SERVLET_PARAM + ServerSideAccessManager.SERVER_PARAM_NAME_VAL_DELIM + time );
//NOTE: The last parameter is only used for updating the avatar images
}
示例6: getUrlFromGetArgs
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
/**
* Encodes the URL, including proxy and base WMS URL
*
* @param baseUrl
* The base URL to encode
* @param params
* A series of key=value arguments to append as GET parameters
* @return the encoded URL
*/
protected String getUrlFromGetArgs(String baseUrl, String... params) {
StringBuilder argPart = new StringBuilder();
/*
* If the baseUrl already contains a "?", we need to append with "&"
*/
argPart.append(baseUrl.contains("?") ? "&" : "?");
for (String param : params) {
argPart.append(param + "&");
}
argPart.deleteCharAt(argPart.length() - 1);
String ret = URL.encode(proxyUrl + baseUrl) + argPart.toString();
GWT.log("encoded:" + ret);
return ret;
}
示例7: buildLegend
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
private void buildLegend(VerticalPanel layout) {
NamedStyleInfo styleInfo = layer.getLayerInfo().getNamedStyleInfo();
int i = 0;
for (FeatureTypeStyleInfo sfi : styleInfo.getUserStyle().getFeatureTypeStyleList()) {
for (RuleInfo rInfo : sfi.getRuleList()) {
String url = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl();
ServerLayerStyleWidget.addPath(url, layer.getServerLayerId());
ServerLayerStyleWidget.addPath(url, styleInfo.getName());
ServerLayerStyleWidget.addPath(url, i + ".png");
ServerLayerStyleWidget widget = new ServerLayerStyleWidget(URL.encode(url), rInfo.getName(), rInfo);
ruleWidgets.add(widget);
layout.add(widget);
i++;
}
}
}
示例8: encode
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
public String encode (String s){
if (s == null) {
return s;
}
String res = s;
res = res.replace(EQUAL, EQUALCODE);
res = res.replace(AND, ANDCODE);
res = res.replace(LEFT, LEFTCODE);
res = res.replace(RIGHT, RIGHTCODE);
// String res = Base64.encode(s);
// byte[] ss = Base64.encode(Util.getBytes(s));
// res = Util.toString(ss);
res = URL.encode(res);
// res = URLEncoder.encode(res, "UTF-8");
// res = res.replace('+', '*');
// res = res.replace('/', '-');
Logger.getClientLogger().log("encode: before="+s+", after="+res);
return res;
}
示例9: getImageProxyURL
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
public static String getImageProxyURL(String username, String password, String url) {
String imageUrl = url;
if (username != null && password != null) {
String authStr = username + ":" + password;
authStr = BrowserUtils.base64Encode(authStr);
imageUrl = GWT.getModuleBaseURL() + "imageproxy?userpass=" + authStr + "&url=" + URL.encode(url);
}
return imageUrl;
}
示例10: addFacet
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
protected void addFacet(CheckBox checkBox) {
if ( !activeFacets.contains(checkBox) ) {
activeFacets.add(checkBox);
}
String query = URL.encode(showFacets());
if ( query.length() ==0 ) {
datasetPanel.clear();
} else {
spinLabel.setText("Searching...");
spin.show();
Util.getRPCService().getESGFDatasets(query+"&access=LAS&limit="+limit+"&offset="+offset, datasetCallback);
}
}
示例11: removeFacet
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
protected void removeFacet(CheckBox checkBox) {
checkBox.setValue(false, false);
activeFacets.remove(checkBox);
String query = URL.encode(showFacets());
offset=0;
if ( query.length() == 0 ) {
datasetPanel.clear();
} else {
spinLabel.setText("Searching...");
spin.show();
Util.getRPCService().getESGFDatasets(query+"&access=LAS&limit="+limit+"&offset="+offset, datasetCallback);
}
}
示例12: onModuleLoad
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
/**
* A module to run the columneditor as a separate module (page). To do this, you must add the name of the variable and its WOCE flag to the URL as datavar and wocevar.
*/
@Override
public void onModuleLoad() {
String catid = Util.getParameterString("catid");
String xml = Util.getParameterString("xml");
String datavarname = Util.getParameterString("datavar");
String wocename = Util.getParameterString("wocevar");
if (xml != null && !xml.equals("")) {
xml = Util.decode(xml);
lasRequest = new LASRequest(xml);
String url = Util.getProductServer() + "?xml=" + URL.encode(lasRequest.toString());
columnEditor = new ColumnEditorWidget(catid, xml, datavarname, wocename);
} else {
Window.alert("This app must be launched from the main interface.");
}
Window.addWindowClosingHandler(new Window.ClosingHandler() {
public void onWindowClosing(Window.ClosingEvent closingEvent) {
if ( columnEditor.isDirty() ) {
closingEvent.setMessage("If you close or refresh the page your current changes will be lost.");
}
}
});
RootPanel.get("id_list").add(columnEditor);
}
示例13: updatePlot
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
private void updatePlot(boolean addHistory, boolean cache) {
// TODO Before submitting...
setConstraints();
//TODO this should wait until the result comes back and is good and should be an event, right?
update.removeStyleDependentName("APPLY-NEEDED");
lasAnnotationsPanel.setError("Fetching plot...");
spin.setPopupPosition(outputPanel.getAbsoluteLeft(), outputPanel.getAbsoluteTop());
spin.show();
makeRequest(true);
imageCanvas = Canvas.createIfSupported();
drawingCanvas = Canvas.createIfSupported();
if (imageCanvas != null) {
canvasDiv.add(imageCanvas, 0, 0);
canvasDiv.add(drawingCanvas, 0, 0);
outputPanel.setWidget(1, 0, canvasDiv);
imageCanvasContext = imageCanvas.getContext2d();
drawingCanvasContext = drawingCanvas.getContext2d();
} else {
outputPanel.setWidget(1, 0 , new HTML(""));
Window.alert("You are accessing this site with an older, no longer supported browser. "
+ "Some or all features of this site will not work correctly using your browser. " + "Recommended browsers include these or higher versions of these: "
+ "IE 9.0 FF 17.0 Chorme 23.0 Safari 5.1");
}
String url = Util.getProductServer() + "?xml=" + URL.encode(lasRequest.toString());
currentURL = url;
if ( cache ) {
lasRequest.setProperty("product_server", "use_cache", "true");
} else {
lasRequest.setProperty("product_server", "use_cache", "false");
}
if (addHistory) {
String x = lasRequest.toString();
pushHistory(x);
}
RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, url);
try {
sendRequest.sendRequest(null, lasRequestCallback);
} catch (RequestException e) {
HTML error = new HTML(e.toString());
outputPanel.setWidget(2, 0, error);
}
}
示例14: openTable
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
private void openTable() {
makeRequest(false);
LASRequest tableRequest = new LASRequest(lasRequest.toString());
String dsid = tableRequest.getDataset(0);
String v0 = tableRequest.getVariable(0);
String v1 = tableRequest.getVariable(1);
String v2 = null;
if ( colorCheckBox.getValue() ) {
v2 = colorVariables.getUserObject(colorVariables.getSelectedIndex()).getID();
}
tableRequest.removeVariables();
tableRequest.addVariable(dsid, v0, 0);
tableRequest.addVariable(dsid, v1, 0);
// Set the data property...
if (v0 != null) {
tableRequest.setProperty("data_0", "url", netcdf);
}
if (v1 != null) {
tableRequest.setProperty("data_1", "url", netcdf);
}
if (v2 != null && !v2.equals(dsg_id) && !v2.equals("longitude") && !v2.equals("latitude") && !v2.equals("longitude") ) {
tableRequest.addVariable(dsid, v2, 0);
tableRequest.setProperty("data_2", "url", netcdf);
tableRequest.setProperty("data", "count", "3");
} else {
tableRequest.setProperty("data", "count", "2");
}
tableRequest.setProperty("ferret", "data_format", "csv");
String url = Util.getProductServer() + "?xml=" + URL.encode(tableRequest.toString());
Window.open(url, "_blank", Constants.WINDOW_FEATURES);
}
示例15: sendPlot
import com.google.gwt.http.client.URL; //導入方法依賴的package包/類
private void sendPlot(LASRequest lr0) {
currentRequest = lr0;
String url = Util.getProductServer() + "?xml=" + URL.encode(lr0.toString());
RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, url);
try {
sendRequest.sendRequest(null, lasRequestCallback);
} catch (RequestException e) {
Window.alert("Unable to make plot requests.");
}
}