001/* 002 * SonarQube 003 * Copyright (C) 2009-2016 SonarSource SA 004 * mailto:contact AT sonarsource DOT com 005 * 006 * This program is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public License 017 * along with this program; if not, write to the Free Software Foundation, 018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 */ 020package org.sonarqube.ws.client; 021 022import java.io.File; 023import java.util.LinkedHashMap; 024import java.util.Map; 025 026/** 027 * @since 5.3 028 */ 029public class PostRequest extends BaseRequest<PostRequest> { 030 031 private final Map<String, Part> parts = new LinkedHashMap<>(); 032 033 public PostRequest(String path) { 034 super(path); 035 } 036 037 @Override 038 public Method getMethod() { 039 return Method.POST; 040 } 041 042 public PostRequest setPart(String name, Part part) { 043 this.parts.put(name, part); 044 return this; 045 } 046 047 public Map<String, Part> getParts() { 048 return parts; 049 } 050 051 public static class Part { 052 private final String mediaType; 053 private final File file; 054 055 public Part(String mediaType, File file) { 056 this.mediaType = mediaType; 057 this.file = file; 058 } 059 060 public String getMediaType() { 061 return mediaType; 062 } 063 064 public File getFile() { 065 return file; 066 } 067 } 068 069}