2016-07-05 4 views
1

J'ai créé un service de repos pour télécharger un fichier. Mon service consomme Stream pour le fichier et Map of String pour quelques informations.pouvons-nous utiliser le type d'octet stream et json ensemble?

@RequestMapping(value = "/upload" , method = RequestMethod.POST) 
public void upload(InputStream file,Map<String, String> fileInfoMap) {} 

Si oui, comment appeler le service avec POSTMAN? si non alors s'il vous plaît suggérer des alternatives?

+0

vérifier cette si c'est utile http://stackoverflow.com/questions/9081079/rest-http-post-multipart-with-json – aravindKrishna

Répondre

0

ajouter multipart/mixed content_type dans postier, sous section du corps sélectionnez form-data comme image ci-dessous joint enter image description here

enter image description here

+0

merci pour une réponse rapide :) laissez-moi l'essayer !! – G10

+0

Salut J'ai utilisé application/octet-stream pour le fichier. Ça marche pour moi. mais comment obtenir Map fileInfoMap. devrais-je ajouter une annotation ici? – G10

+0

try multipart/mixed ou multipart/form-data – aravindKrishna

0

Essayez avec postier si ça ne marche pas, essayez boucle

curl -i -X POST -H "Content-Type: multipart/mixed" -F "fileInfoMap="name=xxx&age=24&location=yyy";type=application/x-www-form-urlencoded" -F "[email protected]" http://localhost:8080/upload