List of usage examples for org.springframework.util MultiValueMap set
void set(K key, @Nullable V value);
From source file:org.springframework.social.facebook.api.impl.FacebookTemplate.java
public <T> T fetchObject(String objectId, Class<T> type, String... fields) { MultiValueMap<String, String> queryParameters = new LinkedMultiValueMap<String, String>(); if (fields.length > 0) { String joinedFields = join(fields); queryParameters.set("fields", joinedFields); }//from w ww. j a va 2 s . co m return fetchObject(objectId, type, queryParameters); }
From source file:org.springframework.social.facebook.api.impl.FacebookTemplate.java
public <T> PagedList<T> fetchConnections(String objectId, String connectionType, Class<T> type, String... fields) {//from w w w . ja v a 2 s . co m MultiValueMap<String, String> queryParameters = new LinkedMultiValueMap<String, String>(); if (fields.length > 0) { String joinedFields = join(fields); queryParameters.set("fields", joinedFields); } return fetchConnections(objectId, connectionType, type, queryParameters); }
From source file:org.springframework.social.facebook.api.impl.FacebookTemplate.java
public <T> PagedList<T> fetchConnections(String objectId, String connectionType, Class<T> type, MultiValueMap<String, String> queryParameters, String... fields) { if (fields.length > 0) { String joinedFields = join(fields); queryParameters.set("fields", joinedFields); }// www. j av a2s. co m return fetchPagedConnections(objectId, connectionType, type, queryParameters); }
From source file:org.springframework.social.facebook.api.impl.FacebookTemplate.java
public void delete(String objectId, String connectionType, MultiValueMap<String, String> data) { data.set("method", "delete"); URI uri = URIBuilder.fromUri(GRAPH_API_URL + objectId + "/" + connectionType).build(); HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<MultiValueMap<String, String>>(data, new HttpHeaders()); getRestTemplate().exchange(uri, HttpMethod.POST, entity, String.class); }
From source file:org.springframework.social.facebook.api.impl.FeedTemplate.java
public String postLink(String ownerId, String message, FacebookLink link) { requireAuthorization();//from www .j a va 2s . co m MultiValueMap<String, Object> map = new LinkedMultiValueMap<String, Object>(); map.set("link", link.getLink()); map.set("name", link.getName()); map.set("caption", link.getCaption()); map.set("description", link.getDescription()); map.set("message", message); return graphApi.publish(ownerId, "feed", map); }
From source file:org.springframework.social.facebook.api.impl.FeedTemplate.java
public String post(String ownerId, String message) { requireAuthorization();//from w ww. j av a2 s. co m MultiValueMap<String, Object> map = new LinkedMultiValueMap<String, Object>(); map.set("message", message); return graphApi.publish(ownerId, "feed", map); }
From source file:org.springframework.social.facebook.api.impl.FeedTemplate.java
public PagedList<Post> getCheckins(PagingParameters pagedListParameters) { requireAuthorization();// ww w . j a v a 2 s. c o m MultiValueMap<String, String> params = getPagingParameters(pagedListParameters); params.set("with", "location"); return graphApi.fetchConnections("me", "posts", Post.class, params); }
From source file:org.springframework.social.facebook.api.impl.FriendTemplate.java
public PagedList<User> getFriendProfiles(String userId) { MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>(); parameters.set("fields", FULL_PROFILE_FIELDS); return graphApi.fetchConnections(userId, "friends", User.class, parameters); }
From source file:org.springframework.social.facebook.api.impl.FriendTemplate.java
public PagedList<User> getFriendProfiles(String userId, PagingParameters pagedListParameters) { MultiValueMap<String, String> parameters = PagedListUtils.getPagingParameters(pagedListParameters); parameters.set("fields", FULL_PROFILE_FIELDS); return graphApi.fetchConnections(userId, "friends", User.class, parameters); }
From source file:ubic.gemma.web.util.upload.CommonsMultipartMonitoredResolver.java
@Override public MultipartHttpServletRequest resolveMultipart(HttpServletRequest request) throws MultipartException { String enc = determineEncoding(request); ServletFileUpload fileUpload = this.newFileUpload(request); DiskFileItemFactory newFactory = (DiskFileItemFactory) fileUpload.getFileItemFactory(); fileUpload.setSizeMax(sizeMax);//from www . j ava 2 s. c o m newFactory.setRepository(this.uploadTempDir); fileUpload.setHeaderEncoding(enc); try { MultiValueMap<String, MultipartFile> multipartFiles = new LinkedMultiValueMap<>(); Map<String, String[]> multipartParams = new HashMap<>(); // Extract multipart files and multipart parameters. List<?> fileItems = fileUpload.parseRequest(request); for (Object fileItem1 : fileItems) { FileItem fileItem = (FileItem) fileItem1; if (fileItem.isFormField()) { String value; String fieldName = fileItem.getFieldName(); try { value = fileItem.getString(enc); } catch (UnsupportedEncodingException ex) { logger.warn("Could not decode multipart item '" + fieldName + "' with encoding '" + enc + "': using platform default"); value = fileItem.getString(); } String[] curParam = multipartParams.get(fieldName); if (curParam == null) { // simple form field multipartParams.put(fieldName, new String[] { value }); } else { // array of simple form fields String[] newParam = StringUtils.addStringToArray(curParam, value); multipartParams.put(fieldName, newParam); } } else { // multipart file field MultipartFile file = new CommonsMultipartFile(fileItem); multipartFiles.set(file.getName(), file); if (logger.isDebugEnabled()) { logger.debug("Found multipart file [" + file.getName() + "] of size " + file.getSize() + " bytes with original filename [" + file.getOriginalFilename() + "]"); } } } return new DefaultMultipartHttpServletRequest(request, multipartFiles, multipartParams, null); } catch (FileUploadException ex) { return new FailedMultipartHttpServletRequest(request, ex.getMessage()); } }