use of org.jboss.resteasy.util.GenericType in project candlepin by candlepin.
the class OwnerResource method getArchiveFromResponse.
private UploadMetadata getArchiveFromResponse(MultipartInput input) throws IOException {
String filename = "";
InputPart part = input.getParts().get(0);
MultivaluedMap<String, String> headers = part.getHeaders();
String contDis = headers.getFirst("Content-Disposition");
StringTokenizer st = new StringTokenizer(contDis, ";");
while (st.hasMoreTokens()) {
String entry = st.nextToken().trim();
if (entry.startsWith("filename")) {
filename = entry.substring(entry.indexOf("=") + 2, entry.length() - 1);
break;
}
}
return new UploadMetadata(part.getBody(new GenericType<File>() {
}), filename);
}
Aggregations