List of usage examples for com.google.gwt.http.client URL decode
public static String decode(String encodedURL)
From source file:cl.uai.client.marks.CommentMark.java
License:Open Source License
/** * Creates a CommentMark from a Hash with Strings as key value pairs, * parsing the values in the map and casting them to the proper * types// w ww . ja v a 2s . c o m * * @param mark the Hash * @return a CommentMark object */ public static CommentMark createFromMap(Map<String, String> markMap) { CommentMark commentobj = new CommentMark(Integer.parseInt(markMap.get("id")), Integer.parseInt(markMap.get("posx")), Integer.parseInt(markMap.get("posy")), Integer.parseInt(markMap.get("pageno")), Integer.parseInt(markMap.get("markerid")), Long.parseLong(markMap.get("timecreated")), Integer.parseInt(markMap.get("criterionid")), markMap.get("markername"), URL.decode(markMap.get("rawtext"))); return commentobj; }
From source file:cl.uai.client.marks.RubricMark.java
License:Open Source License
/** * Creates a RubricMark from a Hash with Strings as key value pairs, * parsing the values in the map and casting them to the proper * types/*from w ww . j av a 2 s. c o m*/ * * @param mark the Hash * @return a RubricMark object */ public static RubricMark createFromMap(Map<String, String> mark) { ArrayList<FeedbackObject> mapFeedback = new ArrayList<FeedbackObject>(); if (mark.get("feedback") != null && mark.get("feedback").length() > 5) { try { List<Map<String, String>> allfeedback = AjaxRequest.getValuesFromResultString(mark.get("feedback")); for (Map<String, String> feedbackDB : allfeedback) { FeedbackObject obj = new FeedbackObject(Integer.parseInt(feedbackDB.get("id")), feedbackDB.get("name"), feedbackDB.get("link"), feedbackDB.get("oer")); mapFeedback.add(obj); } } catch (Exception e) { logger.severe("Exception creating feedback from DB. " + mark.toString()); } } RubricMark markobj = new RubricMark(Integer.parseInt(mark.get("id")), Integer.parseInt(mark.get("posx")), Integer.parseInt(mark.get("posy")), Integer.parseInt(mark.get("pageno")), Integer.parseInt(mark.get("markerid")), Integer.parseInt(mark.get("levelid")), Long.parseLong(mark.get("timecreated")), Integer.parseInt(mark.get("criterionid")), mark.get("markername"), URL.decode(mark.get("rawtext"))); // The feedback id added to the mark markobj.setFeedback(mapFeedback); markobj.setRegradeid(Integer.parseInt(mark.get("regradeid"))); markobj.setRegradecomment(mark.get("regradecomment")); markobj.setRegrademotive(Integer.parseInt(mark.get("motive"))); markobj.setRegradeaccepted(Integer.parseInt(mark.get("regradeaccepted"))); markobj.setRegrademarkercomment(mark.get("regrademarkercomment")); return markobj; }
From source file:cl.uai.client.rubric.PreviousCommentsInterface.java
License:Open Source License
/** * Adds a string comment/* w w w . j a v a 2 s . c o m*/ * @param comment */ public void addMarkAsCommentToInterface(Mark mark, boolean broadcast) { if (mark.getRawtext().trim().length() == 0) { return; } Comment prevComment = findPreviousComment(mark.getRawtext()); // First check if the comment hasn't been added before if (prevComment != null) { long unixTime = System.currentTimeMillis() / 1000L; prevComment.setLastUsed(unixTime); prevComment.setTimesUsed(prevComment.getTimesUsed() + 1); prevComment.setMarkerId(EMarkingConfiguration.getMarkerId()); prevComment.setPages(mark.getPageno()); prevComment.setOwnComment(true); } else { List<Integer> markers = new ArrayList<Integer>(); markers.add(mark.getMarkerId()); List<Integer> pages = new ArrayList<Integer>(); pages.add(mark.getPageno()); List<Integer> criteria = new ArrayList<Integer>(); criteria.add(mark.getCriterionId()); List<Integer> drafts = new ArrayList<Integer>(); drafts.add(MarkingInterface.getDraftId()); Comment newComment = new Comment(mark.getId(), mark.getRawtext(), mark.getFormat(), markers, 1, mark.getTimeCreated(), pages, true, criteria, drafts, false); previousComments.add(newComment); if (broadcast && EMarkingWeb.chatServer != null) { SubmissionGradeData sdata = MarkingInterface.submissionData; String json = "{ " + "\"id\":" + mark.getId() + "," + "\"text\": \"" + URL.encode(mark.getRawtext()) + "\"," + "\"criterionid\":" + mark.getCriterionId() + "," + "\"pageno\":" + mark.getPageno() + "," + "\"markerid\":" + mark.getMarkerId() + "," + "\"format\":" + mark.getFormat() + "," + "\"timecreated\":" + mark.getTimeCreated() + "}"; EMarkingWeb.chatServer.sendMessage(sdata.getMarkerid(), json, NodeChat.SOURCE_BUS, MarkingInterface.getDraftId(), 0, 0); } EMarkingWeb.markingInterface.previousCommentsOracle.add(URL.decode(newComment.getText())); } updateAllCommentsInInterfaces(); }
From source file:cn.xhh.dailyreview.client.utils.ClientUtil.java
License:Apache License
public static FastMap<String> parseToken(String token) { if (token == null) return null; token = URL.decode(token); FastMap<String> params = new FastMap<String>(); String[] pArr = token.split("&"); for (String pair : pArr) { String key, value;/* w w w .j ava2s . c o m*/ int pos = pair.indexOf('='); if (pos < 0) { key = pair.trim(); value = ""; } else { key = pair.substring(0, pos).trim(); value = pair.substring(pos + 1).trim(); } if (ClientUtil.notBlank(key)) params.put(key, value); } return params; }
From source file:com.eucalyptus.webui.client.activity.AbstractSearchActivity.java
License:Open Source License
public AbstractSearchActivity(SearchPlace place, ClientFactory clientFactory) { this.place = place; this.search = URL.decode(place.getSearch()); this.clientFactory = clientFactory; this.pageSize = this.clientFactory.getSessionData().getIntProperty(SessionData.SEARCH_RESULT_PAGE_SIZE, DEFAULT_PAGE_SIZE);/*from w ww . j a va2s.c o m*/ }
From source file:com.eucalyptus.webui.client.activity.ActivityUtil.java
License:Open Source License
/** * Find out the current search using the history. * //from w ww . j a v a2s. co m * @param clientFactory * @return */ public static String getCurrentSearch(ClientFactory clientFactory) { return URL.decode(clientFactory.getMainHistorian().getToken()); }
From source file:com.lushprojects.circuitjs1.client.gui.QueryParameters.java
License:Open Source License
public QueryParameters() { String search = getQueryString(); if ((search != null) && (search.length() > 0)) { String[] nameValues = search.substring(1).split("&"); for (int i = 0; i < nameValues.length; i++) { String[] pair = nameValues[i].split("="); map.put(pair[0], URL.decode(pair[1])); }// w w w . j ava 2 s .c o m } }
From source file:com.mresearch.databank.client.UserAppController.java
License:Apache License
private void parsePathToken(String token, ArrayList<String> p_names, ArrayList<String> p_values) { if (!token.contains("@")) return;/*from w ww . j ava 2 s .c o m*/ String[] ar = token.split("@"); String[] params = ar[1].split("&"); for (int i = 0; i < params.length; i++) { String[] key_value = params[i].split("="); p_names.add(key_value[0]); p_values.add(URL.decode(key_value[1])); } }
From source file:com.ricbit.gibit.client.SearchState.java
License:Apache License
public SearchState(String token) { query = "";//from w w w.ja v a 2 s . c o m page = 0; String decodedToken = URL.decode(token); if (decodedToken.startsWith("search?")) { for (String param : decodedToken.substring(7).split(";")) { String[] split = param.split("="); if (split.length < 2) { continue; } if ("p".equals(split[0])) { try { page = Integer.parseInt(split[1]); } catch (NumberFormatException e) { // Do nothing. } } else if ("q".equals(split[0])) { query = split[1]; } } } }
From source file:com.risevision.ui.client.common.controller.PrerequisitesController.java
License:Open Source License
private String getFromHash(String hash, String param) { int paramIndex = hash.toLowerCase().indexOf(param.toLowerCase()); if (!hash.isEmpty() && hash.charAt(0) == '#' && paramIndex != -1) { int endIndex = hash.indexOf("/", paramIndex); if (endIndex != -1) return URL.decode(hash.substring(paramIndex + param.length(), endIndex)); else/* w w w . ja va2s . c om*/ return URL.decode(hash.substring(paramIndex + param.length())); } return null; }