List of usage examples for com.google.gwt.http.client URL decodeQueryString
public static String decodeQueryString(String encodedURLComponent)
From source file:com.google.gerrit.client.changes.DashboardTable.java
License:Apache License
public DashboardTable(String params) { titles = new ArrayList<String>(); queries = new ArrayList<String>(); String foreach = null;/* ww w. j av a2 s .c o m*/ for (String kvPair : params.split("[,;&]")) { String[] kv = kvPair.split("=", 2); if (kv.length != 2 || kv[0].isEmpty()) { continue; } if ("title".equals(kv[0])) { title = URL.decodeQueryString(kv[1]); } else if ("foreach".equals(kv[0])) { foreach = URL.decodeQueryString(kv[1]); } else { titles.add(URL.decodeQueryString(kv[0])); queries.add(URL.decodeQueryString(kv[1])); } } if (foreach != null) { ListIterator<String> it = queries.listIterator(); while (it.hasNext()) { it.set(it.next() + " " + foreach); } } addStyleName(Gerrit.RESOURCES.css().accountDashboard()); sections = new ArrayList<ChangeTable2.Section>(); int i = 0; for (String title : titles) { Section s = new Section(); s.setTitleWidget(new InlineHyperlink(title, PageLinks.toChangeQuery(queries.get(i++)))); addSection(s); sections.add(s); } }
From source file:com.google.gerrit.client.Dispatcher.java
License:Apache License
private static void projects(final String token) { String rest = skip(token);/*from w w w.ja v a2 s .co m*/ int c = rest.indexOf(DASHBOARDS); if (0 <= c) { final String project = URL.decodePathSegment(rest.substring(0, c)); rest = rest.substring(c); if (matchPrefix(DASHBOARDS, rest)) { final String dashboardId = skip(rest); GerritCallback<DashboardInfo> cb = new GerritCallback<DashboardInfo>() { @Override public void onSuccess(DashboardInfo result) { if (matchPrefix("/dashboard/", result.url())) { String params = skip(result.url()).substring(1); ProjectDashboardScreen dash = new ProjectDashboardScreen(new Project.NameKey(project), params); Gerrit.display(token, dash); } } @Override public void onFailure(Throwable caught) { if ("default".equals(dashboardId) && RestApi.isNotFound(caught)) { Gerrit.display( PageLinks.toChangeQuery(PageLinks.projectQuery(new Project.NameKey(project)))); } else { super.onFailure(caught); } } }; if ("default".equals(dashboardId)) { DashboardList.getDefault(new Project.NameKey(project), cb); return; } c = dashboardId.indexOf(":"); if (0 <= c) { final String ref = URL.decodeQueryString(dashboardId.substring(0, c)); final String path = URL.decodeQueryString(dashboardId.substring(c + 1)); DashboardList.get(new Project.NameKey(project), ref + ":" + path, cb); return; } } } Gerrit.display(token, new NotFoundScreen()); }
From source file:com.google.gerrit.client.Gerrit.java
License:Apache License
@Override public void onModuleLoad() { UserAgent.assertNotInIFrame();/* ww w. j a v a2s.c om*/ KeyUtil.setEncoderImpl(new KeyUtil.Encoder() { @Override public String encode(String e) { e = URL.encodeQueryString(e); e = fixPathImpl(e); e = fixColonImpl(e); e = fixDoubleQuote(e); return e; } @Override public String decode(final String e) { return URL.decodeQueryString(e); } private native String fixPathImpl(String path) /*-{ return path.replace(/%2F/g, "/"); }-*/; private native String fixColonImpl(String path) /*-{ return path.replace(/%3A/g, ":"); }-*/; private native String fixDoubleQuote(String path) /*-{ return path.replace(/%22/g, '"'); }-*/; }); initHostname(); Window.setTitle(M.windowTitle1(myHost)); final HostPageDataService hpd = GWT.create(HostPageDataService.class); hpd.load(new GerritCallback<HostPageData>() { @Override public void onSuccess(final HostPageData result) { Document.get().getElementById("gerrit_hostpagedata").removeFromParent(); myConfig = result.config; myTheme = result.theme; if (result.account != null) { myAccount = result.account; xGerritAuth = result.xGerritAuth; } if (result.accountDiffPref != null) { myAccountDiffPref = result.accountDiffPref; applyUserPreferences(); } onModuleLoad2(result); } }); }
From source file:com.google.gerrit.client.groups.GroupBaseInfo.java
License:Apache License
public final AccountGroup.UUID getGroupUUID() { return new AccountGroup.UUID(URL.decodeQueryString(id())); }
From source file:com.google.gerrit.client.info.GroupInfo.java
License:Apache License
public final AccountGroup.UUID getOwnerUUID() { String owner = owner_id();/*from w ww. j av a 2s.com*/ if (owner != null) { return new AccountGroup.UUID(URL.decodeQueryString(owner)); } return null; }
From source file:com.gwtplatform.common.client.ClientUrlUtils.java
License:Apache License
@Override public String decodeQueryString(String encodedUrlComponent) { return URL.decodeQueryString(encodedUrlComponent); }
From source file:com.gwtplatform.mvp.client.proxy.ParameterTokenFormatter.java
License:Apache License
@Override public PlaceRequest toPlaceRequest(String placeToken) throws TokenFormatException { return unescapedStringToPlaceRequest(URL.decodeQueryString(placeToken)); }
From source file:com.gwtplatform.mvp.client.proxy.ParameterTokenFormatter.java
License:Apache License
@Override public List<PlaceRequest> toPlaceRequestHierarchy(String historyToken) throws TokenFormatException { String unescapedHistoryToken = URL.decodeQueryString(historyToken); int split = unescapedHistoryToken.indexOf(hierarchySeparator); List<PlaceRequest> result = new ArrayList<PlaceRequest>(); if (split == -1) { // History token consists of a single place token. result.add(unescapedStringToPlaceRequest(unescapedHistoryToken)); } else {// www. jav a 2s .c o m String[] unescapedPlaceTokens = unescapedHistoryToken.split(hierarchySeparator); if (unescapedPlaceTokens.length == 0) { throw new TokenFormatException("Bad parameter: nothing in the history token."); } for (String unescapedPlaceToken : unescapedPlaceTokens) { if (unescapedPlaceToken.isEmpty()) { throw new TokenFormatException("Bad parameter: Successive place tokens require a single '" + hierarchySeparator + "' between them."); } result.add(unescapedStringToPlaceRequest(unescapedPlaceToken)); } } return result; }
From source file:com.gwtplatform.mvp.client.proxy.ParameterTokenFormatterOld.java
License:Apache License
private String unescape(String value) { return URL.decodeQueryString(value); }
From source file:com.ikon.frontend.client.bean.GWTFileUploadResponse.java
License:Open Source License
/** * GWTFileUploadResponse/* www.j av a2 s .com*/ * * @param text json encoded parameters. */ public GWTFileUploadResponse(String text) { text = text.substring(text.indexOf("{")); text = text.substring(0, text.lastIndexOf("}") + 1); JSONValue responseValue = JSONParser.parseStrict(text); JSONObject response = responseValue.isObject(); // Deserialize information hasAutomation = response.get("hasAutomation").isBoolean().booleanValue(); path = URL.decodeQueryString(response.get("path").isString().stringValue()); error = response.get("error").isString().stringValue(); showWizardCategories = response.get("showWizardCategories").isBoolean().booleanValue(); showWizardKeywords = response.get("showWizardKeywords").isBoolean().booleanValue(); digitalSignature = response.get("digitalSignature").isBoolean().booleanValue(); // Getting property groups JSONArray groupsArray = response.get("groupsList").isArray(); if (groupsArray != null) { for (int i = 0; i <= groupsArray.size() - 1; i++) { groupsList.add(groupsArray.get(i).isString().stringValue()); } } // Getting workflows JSONArray workflowArray = response.get("workflowList").isArray(); if (workflowArray != null) { for (int i = 0; i <= workflowArray.size() - 1; i++) { workflowList.add(workflowArray.get(i).isString().stringValue()); } } }