public void summaryAction(HttpServletRequest req, HttpServletResponse res) { if (AccountController.redirectIfNoCookie(req, res)) return; Map<String, Object> viewData = new HashMap<String, Object>(); DocumentManager docMan = new DocumentManager(); try { if (req.getParameter("documentId") != null) { // Get the document ID int docId = Integer.parseInt(req.getParameter("documentId")); // Get the document using document id Document document = docMan.get(docId); // Set title to name of the document viewData.put("title", document.getDocumentName()); // Create List of access records List<AccessRecord> accessRecords = new LinkedList<AccessRecord>(); // Add access records for document to the list accessRecords = docMan.getAccessRecords(docId); viewData.put("accessRecords", accessRecords); } else { // Go back to thread page. } } catch (Exception e) { Logger.getLogger("").log(Level.SEVERE, "An error occurred when getting profile user", e); } view(req, res, "/views/group/Document.jsp", viewData); }
public List getUserListAT() { List<Map> list = new ArrayList<Map>(); String[][] data = { {"3537255778", "Alex Chen"}, {"2110989338", "Brian Wang"}, {"3537640807", "David Hsieh"}, {"5764816553", "James Yu"}, {"3756404948", "K.C."}, {"2110994764", "Neil Weinstock"}, {"6797798390", "Owen Chen"}, {"3831206627", "Randy Chen"}, {"6312460903", "Tony Shen"}, {"2110993498", "Yee Liaw"} }; for (int i = 0; i < data.length; i++) { Map map = new HashMap(); String userRef = data[i][0]; String userName = data[i][1]; map.put("userObjectId", userRef); map.put("userName", userName); list.add(map); } return list; }
/** * Displays a Discussion Thread page * * <p>- Requires a cookie for the session user - Requires a threadId request parameter for the * HTTP GET * * @param req The HTTP Request * @param res The HTTP Response */ public void discussionAction(HttpServletRequest req, HttpServletResponse res) { // Ensure there is a cookie for the session user if (AccountController.redirectIfNoCookie(req, res)) return; Map<String, Object> viewData = new HashMap<>(); if (req.getMethod() == HttpMethod.Get) { // Get the thread GroupManager gm = new GroupManager(); int threadId = Integer.parseInt(req.getParameter("threadId")); DiscussionManager discussionManager = new DiscussionManager(); DiscussionThread thread = discussionManager.getThread(threadId); thread.setGroup(gm.get(thread.getGroupId())); thread.setPosts(discussionManager.getPosts(threadId)); // get documents for the thread DocumentManager docMan = new DocumentManager(); viewData.put("documents", docMan.getDocumentsForThread(threadId)); viewData.put("thread", thread); viewData.put("title", "Discussion: " + thread.getThreadName()); view(req, res, "/views/group/DiscussionThread.jsp", viewData); } else { httpNotFound(req, res); } }
static { CONTENT_TYPES.put(ContentType.HTTP, Response.HTTP); CONTENT_TYPES.put(ContentType.MULTIPART, Response.MULTIPART); CONTENT_TYPES.put(ContentType.XML, Response.XML); for (final Entry<ContentType, String> entry : CONTENT_TYPES.entrySet()) TYPE_CONTENTS.put(entry.getValue(), entry.getKey()); }
@Override public void parseRequestParameters( final Map<String, String> params, final Map<String, com.bradmcevoy.http.FileItem> files) throws RequestParseException { try { if (isMultiPart()) { parseQueryString(params, req.getQueryString()); @SuppressWarnings("unchecked") final List<FileItem> items = new ServletFileUpload().parseRequest(req); for (final FileItem item : items) { if (item.isFormField()) params.put(item.getFieldName(), item.getString()); else files.put(item.getFieldName(), new FileItemWrapper(item)); } } else { final Enumeration<String> en = req.getParameterNames(); while (en.hasMoreElements()) { final String nm = en.nextElement(); final String val = req.getParameter(nm); params.put(nm, val); } } } catch (final FileUploadException ex) { throw new RequestParseException("FileUploadException", ex); } catch (final Throwable ex) { throw new RequestParseException(ex.getMessage(), ex); } }
public List getUserList() { List<Map> list = new ArrayList<Map>(); try { /* String apiUrl=rallyApiHost+"/user?query="+ "((TeamMemberships%20%3D%20https%3A%2F%2Frally1.rallydev.com%2Fslm%2Fwebservice%2F1.34%2Fproject%2F6169133135)%20or%20"+ "(TeamMemberships%20%3D%20https%3A%2F%2Frally1.rallydev.com%2Fslm%2Fwebservice%2F1.34%2Fproject%2F6083311244))"+ "&fetch=true&order=Name&start=1&pagesize=100"; */ String apiUrl = rallyApiHost + "/user?query=(Disabled%20=%20false)" + "&fetch=true&order=Name&start=1&pagesize=100"; log.info("apiUrl=" + apiUrl); String responseXML = getRallyXML(apiUrl); org.jdom.input.SAXBuilder bSAX = new org.jdom.input.SAXBuilder(); org.jdom.Document doc = bSAX.build(new StringReader(responseXML)); Element root = doc.getRootElement(); XPath xpath = XPath.newInstance("//Object"); List xlist = xpath.selectNodes(root); Iterator iter = xlist.iterator(); while (iter.hasNext()) { Map map = new HashMap(); Element item = (Element) iter.next(); String userRef = item.getAttribute("ref").getValue(); String userName = item.getAttribute("refObjectName").getValue(); String userObjectId = item.getChildText("ObjectID"); map.put("userRef", userRef); map.put("userObjectId", userObjectId); map.put("userName", userName); list.add(map); } } catch (Exception ex) { log.error("", ex); } return list; }
/** * Displays a page showing details for all groups in RGMS * * @param req The HTTP Request * @param res The HTTP Response */ public void showgroupsAction(HttpServletRequest req, HttpServletResponse res) { // Ensure there is a cookie for the session user if (AccountController.redirectIfNoCookie(req, res)) return; Map<String, Object> viewData = new HashMap<String, Object>(); viewData.put("title", "RGMS Groups"); // Get all groups in the RGMS database GroupManager groupMan = new GroupManager(); List<Group> groups = groupMan.getEveryGroup(); viewData.put("allGroups", groups); view(req, res, "/views/group/ShowGroups.jsp", viewData); }
private void rotateTokens(HttpServletRequest request) { HttpSession session = request.getSession(true); /** rotate master token * */ String tokenFromSession = null; try { tokenFromSession = RandomGenerator.generateRandomId(getPrng(), getTokenLength()); } catch (Exception e) { throw new RuntimeException( String.format("unable to generate the random token - %s", e.getLocalizedMessage()), e); } session.setAttribute(getSessionKey(), tokenFromSession); /** rotate page token * */ if (isTokenPerPageEnabled()) { @SuppressWarnings("unchecked") Map<String, String> pageTokens = (Map<String, String>) session.getAttribute(CsrfGuard.PAGE_TOKENS_KEY); try { pageTokens.put( request.getRequestURI(), RandomGenerator.generateRandomId(getPrng(), getTokenLength())); } catch (Exception e) { throw new RuntimeException( String.format("unable to generate the random token - %s", e.getLocalizedMessage()), e); } } }
// getListOfSharesByType - private Map<String, String> getListOfSharesByType( String type, HttpServletRequest request, HttpServletResponse response) { Map<String, String> allShares = new HashMap<String, String>(); // publishedSources - array of source._ids of published sources ArrayList<String> publishedSources = new ArrayList<String>(); try { JSONObject sharesObject = new JSONObject(searchSharesByType(type, request, response)); JSONObject json_response = sharesObject.getJSONObject("response"); if (json_response.getString("success").equalsIgnoreCase("true")) { if (sharesObject.has("data")) { // Iterate over share objects and write to our collection JSONArray shares = sharesObject.getJSONArray("data"); for (int i = 0; i < shares.length(); i++) { JSONObject share = shares.getJSONObject(i); allShares.put(share.getString("title"), share.getString("_id")); } } } } catch (Exception e) { System.out.println(e.getMessage()); } return allShares; }
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pathInfo = req.getPathInfo(); HttpSession session = req.getSession(); if (session == null) { resp.setStatus(401); return; } String username = (String) session.getAttribute("username"); if (username == null) { resp.setStatus(401); return; } Map userMap = loadUserSettingsMap(username); if (userMap == null) { resp.setStatus(401); return; } if (pathInfo.equals("/")) { resp.setContentType("application/json; charset=UTF-8"); resp.getWriter().write(JSONUtil.write(userMap)); return; } String key = pathInfo.substring(1); String value = (String) userMap.get(key); Map jsonObject = new HashMap(); jsonObject.put(key, value); resp.setContentType("application/json; charset=UTF-8"); resp.getWriter().write(JSONUtil.write(jsonObject)); }
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pathInfo = req.getPathInfo(); if (pathInfo.equals("/")) { HttpSession session = req.getSession(); if (session == null) { resp.setStatus(401); return; } String username = (String) session.getAttribute("username"); if (username == null) { resp.setStatus(401); return; } Map userMap = loadUserSettingsMap(username); if (userMap == null) { resp.setStatus(401); return; } Enumeration parameterNames = req.getParameterNames(); while (parameterNames.hasMoreElements()) { String parameterName = (String) parameterNames.nextElement(); userMap.put(parameterName, req.getParameter(parameterName)); } saveUserSettingsMap(username, userMap); return; } super.doPost(req, resp); }
public File doAttachment(HttpServletRequest request) throws ServletException, IOException { File file = null; DiskFileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); try { List<?> items = upload.parseRequest(request); Iterator<?> itr = items.iterator(); while (itr.hasNext()) { FileItem item = (FileItem) itr.next(); if (item.isFormField()) { parameters .put(item.getFieldName(), item.getString("UTF-8")); } else { File tempFile = new File(item.getName()); file = new File(sc.getRealPath("/") + savePath, tempFile .getName()); item.write(file); } } } catch (Exception e) { Logger logger = Logger.getLogger(SendAttachmentMailServlet.class); logger.error("邮件发送出了异常", e); } return file; }
/** * Return the request parameters as a Map<String,String>. Only the first value of multivalued * parameters is included. */ Map<String, String> getParamsAsMap() { Map<String, String> map = new HashMap<String, String>(); for (Enumeration en = req.getParameterNames(); en.hasMoreElements(); ) { String name = (String) en.nextElement(); map.put(name, req.getParameter(name)); } return map; }
/** * Adds parameters from the passed on request body. * * @param body request body * @param params map parameters */ private static void addParams(final String body, final Map<String, String[]> params) { for (final String nv : body.split("&")) { final String[] parts = nv.split("=", 2); if (parts.length < 2) continue; try { params.put(parts[0], new String[] {URLDecoder.decode(parts[1], Token.UTF8)}); } catch (final Exception ex) { Util.notexpected(ex); } } }
@Override public Map<String, String> getHeaders() { final Map<String, String> map = new HashMap<>(); final Enumeration<String> en = req.getHeaderNames(); while (en.hasMoreElements()) { final String name = en.nextElement(); final String val = req.getHeader(name); map.put(name, val); } return map; }
public List getProjectList() { List<Map> list = new ArrayList<Map>(); try { String apiUrl = rallyApiHost + "/project?" + "fetch=true&order=Name&start=1&pagesize=200"; log.info("rallyApiUrl:" + apiUrl); String responseXML = getRallyXML(apiUrl); org.jdom.input.SAXBuilder bSAX = new org.jdom.input.SAXBuilder(); org.jdom.Document doc = bSAX.build(new StringReader(responseXML)); Element root = doc.getRootElement(); XPath xpath = XPath.newInstance("//Object"); List xlist = xpath.selectNodes(root); Iterator iter = xlist.iterator(); while (iter.hasNext()) { Map map = new HashMap(); Element item = (Element) iter.next(); String objId = item.getChildText("ObjectID"); String name = item.getChildText("Name"); String state = item.getChildText("State"); map.put("objId", objId); map.put("name", name); map.put("state", state); list.add(map); } } catch (Exception ex) { log.error("ERROR: ", ex); } return list; }
public static synchronized void sessionCreated(HttpSessionEvent ev) { HttpSession httpSession = ev.getSession(); String id = httpSession.getId(); // Remember HTTP-session: { lookupHttpSessionById.put(id, httpSession); } AbstractSession session = null; synchronized (lookupSessionById) { session = lookupSessionById.get(id); } if (session == null) { Principal userPrincipal = null; Date timeCreation = new Date(httpSession.getCreationTime()); Date timeLastAccess = new Date(httpSession.getLastAccessedTime()); List<String> urisForLastRequests = null; Properties properties = null; session = new DefaultSession( id, userPrincipal, timeCreation, timeLastAccess, urisForLastRequests, properties); synchronized (lookupSessionById) { lookupSessionById.put(id, session); // Update 'sessionCountMax': { int sessionCount = lookupSessionById.size(); if (sessionCount > sessionCountMax) { sessionCountMax = sessionCount; sessionCountMaxTime = System.currentTimeMillis(); } } } } }
/** * Parses HTTP parameters in an appropriate format and return back map of values to predefined * list of names. * * @param req Request. * @return Map of parsed parameters. */ @SuppressWarnings({"unchecked"}) private Map<String, Object> parameters(ServletRequest req) { Map<String, String[]> params = req.getParameterMap(); if (F.isEmpty(params)) return Collections.emptyMap(); Map<String, Object> map = U.newHashMap(params.size()); for (Map.Entry<String, String[]> entry : params.entrySet()) map.put(entry.getKey(), parameter(entry.getValue())); return map; }
/** * 获取所得到的k个最近邻元组的多数类 * * @param pq 存储k个最近近邻元组的优先级队列 * @return 多数类的名称 */ private String getMostClass(PriorityQueue<KNNNode> pq) { Map<Double, Integer> classCount = new HashMap<Double, Integer>(); for (int i = 0; i < pq.size(); i++) { KNNNode node = pq.remove(); double c = node.getC(); if (classCount.containsKey(c)) { classCount.put(c, classCount.get(c) + 1); } else { classCount.put(c, 1); } } int maxIndex = -1; int maxCount = 0; Object[] classes = classCount.keySet().toArray(); for (int i = 0; i < classes.length; i++) { if (classCount.get(classes[i]) > maxCount) { maxIndex = i; maxCount = classCount.get(classes[i]); } } return classes[maxIndex].toString(); }
/** * Create page token if it doesn't exist. * * @param pageTokens A map of tokens. If token doesn't exist it will be added. * @param uri The key for the tokens. */ private void createPageToken(Map<String, String> pageTokens, String uri) { if (pageTokens == null) return; /** create token if it does not exist * */ if (pageTokens.containsKey(uri)) return; try { pageTokens.put(uri, RandomGenerator.generateRandomId(getPrng(), getTokenLength())); } catch (Exception e) { throw new RuntimeException( String.format("unable to generate the random token - %s", e.getLocalizedMessage()), e); } }
PageInfo getPageInfo(ScriptContext context, String path) throws IOException { PageInfo info = null; if (pageInfoCache != null) info = this.pageInfoCache.get(path); if (info == null) { String file = prefix + path + suffix; String actualPath = FileHelper.findRecursive(file); String source = FileHelper.read(actualPath); Object object = context.evaluate(source, path); info = new PageInfo((BaseFunction) object, actualPath); if (pageInfoCache != null) pageInfoCache.put(path, info); } return info; }
/** * Returns all query parameters. * * @return parameters */ public Map<String, String[]> params() { final Map<String, String[]> params = new HashMap<String, String[]>(); final Map<?, ?> map = req.getParameterMap(); for (final Entry<?, ?> s : map.entrySet()) { final String key = s.getKey().toString(); final String[] vals = s.getValue() instanceof String[] ? (String[]) s.getValue() : new String[] {s.getValue().toString()}; params.put(key, vals); } return params; }
public boolean convalida() { boolean tuttoOk = true; Map<String, String> errori = new HashMap<String, String>(); if ((nome == null) || nome.equals("")) { tuttoOk = false; request.setAttribute("nome", nome); errori.put("nome", "campo obbligatorio"); } if ((descrizione == null) || descrizione.equals("")) { tuttoOk = false; request.setAttribute("descrizione", descrizione); errori.put("descrizione", "campo obbligatorio"); } if ((codice == null) || codice.equals("")) { tuttoOk = false; request.setAttribute("codice", codice); errori.put("codice", "campo obbligatorio"); } if (!isInteger(disponibilita)) { tuttoOk = false; request.setAttribute("disponibilita", disponibilita); errori.put("disponibilita", "formato non valido"); } if (!isInteger(prezzo)) { tuttoOk = false; request.setAttribute("prezzo", prezzo); errori.put("prezzo", "formato non valido"); } if (!tuttoOk) request.setAttribute("errori", errori); HttpSession sess = request.getSession(); sess.setAttribute("errori", errori); return tuttoOk; }
@Override public void sessionCreated(HttpSessionEvent se) { HttpSession session = se.getSession(); try { sessions.put(session.getId(), session); setUsersOnline(getUsersOnline() + 1); } catch (UnsupportedOperationException | ClassCastException | NullPointerException | IllegalArgumentException e) { System.out.println( "edu.temple.cis3238.wiki.WikiEventMonitor.sessionCreated() -- " + e.toString()); } }
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Map root = new HashMap(); Connection conn = null; conn = ConFact.getInstance().makeConnection(); String id = req.getParameter("id"); String sql = "select title,description,language_id from film where film_id=" + id + ";"; java.sql.PreparedStatement pst; try { pst = conn.prepareStatement(sql); ResultSet rs = pst.executeQuery(); while (rs.next()) { java.sql.PreparedStatement pst1; String sql1 = "select name from language where language_id=" + rs.getString(3) + ";"; pst1 = conn.prepareStatement(sql1); ResultSet rs1 = pst1.executeQuery(); while (rs1.next()) { Template t = cfg.getTemplate("test.ftl"); root.put("title", rs.getString(1)); root.put("description", rs.getString(2)); root.put("language", rs1.getString(1)); resp.setContentType("text/html; charset=" + t.getEncoding()); Writer out = resp.getWriter(); t.process(root, out); } rs1.close(); } rs.close(); pst.close(); conn.close(); } catch (TemplateException e) { e.printStackTrace(); } catch (SQLException e1) { e1.printStackTrace(); } }
// getListOfCommunityMembers private Map<String, String> getListOfCommunityMembers( String id, HttpServletRequest request, HttpServletResponse response) { Map<String, String> allPeople = new HashMap<String, String>(); try { JSONObject communityObj = new JSONObject(getCommunity(id, request, response)); if (communityObj.has("data")) { JSONObject community = new JSONObject(communityObj.getString("data")); if (community.has("members")) { JSONArray members = community.getJSONArray("members"); for (int i = 0; i < members.length(); i++) { JSONObject member = members.getJSONObject(i); if (member.has("displayName")) { allPeople.put(member.getString("displayName"), member.getString("_id")); } else { allPeople.put(member.getString("_id"), member.getString("_id")); } } } } } catch (Exception e) { // System.out.println(e.getMessage()); } return allPeople; }
// Get parameter map either directly from an Servlet 2.4 compliant implementation // or by looking it up explictely (thanks to codewax for the patch) private Map<String, String[]> getParameterMap(HttpServletRequest pReq) { try { // Servlet 2.4 API return pReq.getParameterMap(); } catch (UnsupportedOperationException exp) { // Thrown by 'pseudo' 2.4 Servlet API implementations which fake a 2.4 API // As a service for the parameter map is build up explicitely Map<String, String[]> ret = new HashMap<String, String[]>(); Enumeration params = pReq.getParameterNames(); while (params.hasMoreElements()) { String param = (String) params.nextElement(); ret.put(param, pReq.getParameterValues(param)); } return ret; } }
// getListOfAllCommunities private Map<String, String> getListOfAllCommunities( HttpServletRequest request, HttpServletResponse response) { Map<String, String> allCommunities = new HashMap<String, String>(); try { JSONObject communitiesObj = new JSONObject(getAllCommunities(request, response)); if (communitiesObj.has("data")) { JSONArray communities = communitiesObj.getJSONArray("data"); for (int i = 0; i < communities.length(); i++) { JSONObject community = communities.getJSONObject(i); allCommunities.put(community.getString("name"), community.getString("_id")); } } } catch (Exception e) { // System.out.println(e.getMessage()); } return allCommunities; }
/** * Parse the query string. * * @param map parsed key-values will be stored here * @param qs query string */ private static void parseQueryString(final Map<String, String> map, final String qs) { if (qs == null) return; for (final String nv : qs.split("&")) { final String[] parts = nv.split("="); final String key = parts[0]; String val = null; if (parts.length > 1) { val = parts[1]; if (val != null) { try { val = URLDecoder.decode(val, Token.UTF8); } catch (final UnsupportedEncodingException ex) { throw new RuntimeException(ex); } } } map.put(key, val); } }
/** * Creates REST request. * * @param cmd Command. * @param params Parameters. * @return REST request. * @throws GridException If creation failed. */ @Nullable private GridRestRequest createRequest( GridRestCommand cmd, Map<String, Object> params, ServletRequest req) throws GridException { GridRestRequest restReq; switch (cmd) { case CACHE_GET: case CACHE_GET_ALL: case CACHE_PUT: case CACHE_PUT_ALL: case CACHE_REMOVE: case CACHE_REMOVE_ALL: case CACHE_ADD: case CACHE_CAS: case CACHE_METRICS: case CACHE_REPLACE: case CACHE_DECREMENT: case CACHE_INCREMENT: case CACHE_APPEND: case CACHE_PREPEND: { GridRestCacheRequest restReq0 = new GridRestCacheRequest(); restReq0.cacheName((String) params.get("cacheName")); restReq0.key(params.get("key")); restReq0.value(params.get("val")); restReq0.value2(params.get("val2")); Object val1 = params.get("val1"); if (val1 != null) restReq0.value(val1); restReq0.cacheFlags(intValue("cacheFlags", params, 0)); restReq0.ttl(longValue("exp", params, null)); restReq0.initial(longValue("init", params, null)); restReq0.delta(longValue("delta", params, null)); if (cmd == CACHE_GET_ALL || cmd == CACHE_PUT_ALL || cmd == CACHE_REMOVE_ALL) { List<Object> keys = values("k", params); List<Object> vals = values("v", params); if (keys.size() < vals.size()) throw new GridException( "Number of keys must be greater or equals to number of values."); Map<Object, Object> map = U.newHashMap(keys.size()); Iterator<Object> keyIt = keys.iterator(); Iterator<Object> valIt = vals.iterator(); while (keyIt.hasNext()) map.put(keyIt.next(), valIt.hasNext() ? valIt.next() : null); restReq0.values(map); } restReq = restReq0; break; } case TOPOLOGY: case NODE: { GridRestTopologyRequest restReq0 = new GridRestTopologyRequest(); restReq0.includeMetrics(Boolean.parseBoolean((String) params.get("mtr"))); restReq0.includeAttributes(Boolean.parseBoolean((String) params.get("attr"))); restReq0.nodeIp((String) params.get("ip")); restReq0.nodeId(uuidValue("id", params)); restReq = restReq0; break; } case EXE: case RESULT: case NOOP: { GridRestTaskRequest restReq0 = new GridRestTaskRequest(); restReq0.taskId((String) params.get("id")); restReq0.taskName((String) params.get("name")); restReq0.params(values("p", params)); restReq0.async(Boolean.parseBoolean((String) params.get("async"))); restReq0.timeout(longValue("timeout", params, 0L)); restReq = restReq0; break; } case LOG: { GridRestLogRequest restReq0 = new GridRestLogRequest(); restReq0.path((String) params.get("path")); restReq0.from(intValue("from", params, -1)); restReq0.to(intValue("to", params, -1)); restReq = restReq0; break; } case VERSION: { restReq = new GridRestRequest(); break; } default: throw new GridException("Invalid command: " + cmd); } restReq.address(new InetSocketAddress(req.getRemoteAddr(), req.getRemotePort())); restReq.command(cmd); if (params.containsKey("gridgain.login") || params.containsKey("gridgain.password")) { GridSecurityCredentials cred = new GridSecurityCredentials( (String) params.get("gridgain.login"), (String) params.get("gridgain.password")); restReq.credentials(cred); } String clientId = (String) params.get("clientId"); try { if (clientId != null) restReq.clientId(UUID.fromString(clientId)); } catch (Exception ignored) { // Ignore invalid client id. Rest handler will process this logic. } String destId = (String) params.get("destId"); try { if (destId != null) restReq.destinationId(UUID.fromString(destId)); } catch (IllegalArgumentException ignored) { // Don't fail - try to execute locally. } String sesTokStr = (String) params.get("sessionToken"); try { if (sesTokStr != null) restReq.sessionToken(U.hexString2ByteArray(sesTokStr)); } catch (IllegalArgumentException ignored) { // Ignore invalid session token. } return restReq; }