1598 |
1598 |
MultipartRequestResolver mrr = new MultipartRequestResolver(
|
1599 |
1599 |
tmpDir.getAbsolutePath(), 1000000000, 0);
|
1600 |
1600 |
MultipartRequest mr = mrr.resolveMultipart(request);
|
|
1601 |
System.out.println("resolved multipart request");
|
1601 |
1602 |
Map<String, File> files = mr.getMultipartFiles();
|
|
1603 |
if(files == null)
|
|
1604 |
{
|
|
1605 |
throw new ServiceFailure("1202", "create/update must have multipart files with names 'object' and 'sysmeta'");
|
|
1606 |
}
|
|
1607 |
System.out.println("got multipart files");
|
|
1608 |
|
|
1609 |
if(files.keySet() == null)
|
|
1610 |
{
|
|
1611 |
System.out.println("No file keys in MMP request.");
|
|
1612 |
throw new ServiceFailure("1202", "No file keys found in MMP. " +
|
|
1613 |
"create/update must have multipart files with names 'object' and 'sysmeta'");
|
|
1614 |
}
|
1602 |
1615 |
Iterator keys = files.keySet().iterator();
|
|
1616 |
System.out.println("iterating through multipart files: " + keys);
|
1603 |
1617 |
while(keys.hasNext())
|
1604 |
1618 |
{
|
|
1619 |
System.out.println("1");
|
1605 |
1620 |
String key = (String)keys.next();
|
1606 |
1621 |
System.out.println("files key: " + key);
|
1607 |
1622 |
System.out.println("files value: " + files.get(key));
|
1608 |
1623 |
}
|
|
1624 |
System.out.println("2");
|
1609 |
1625 |
|
1610 |
1626 |
Map<String, List<String>> params = mr.getMultipartParameters();
|
|
1627 |
System.out.println("3");
|
1611 |
1628 |
keys = params.keySet().iterator();
|
|
1629 |
System.out.println("4");
|
1612 |
1630 |
while(keys.hasNext())
|
1613 |
1631 |
{
|
|
1632 |
System.out.println("5");
|
1614 |
1633 |
String key = (String)keys.next();
|
1615 |
1634 |
System.out.println("params key: " + key);
|
1616 |
1635 |
System.out.println("params value: " + params.get(key));
|
1617 |
1636 |
}
|
1618 |
|
|
|
1637 |
System.out.println("6");
|
1619 |
1638 |
File smFile = files.get("sysmeta");
|
1620 |
1639 |
System.out.println("smFile: " + smFile.getAbsolutePath());
|
1621 |
1640 |
sysmeta = new FileInputStream(smFile);
|
... | ... | |
1758 |
1777 |
InvalidSystemMetadata ism = new InvalidSystemMetadata("1080", e.getMessage());
|
1759 |
1778 |
serializeException(ism, out);
|
1760 |
1779 |
}
|
1761 |
|
finally
|
1762 |
|
{
|
1763 |
|
/*if(parts != null)
|
1764 |
|
{
|
1765 |
|
Enumeration keys = parts.keys();
|
1766 |
|
while(keys.hasMoreElements())
|
1767 |
|
{
|
1768 |
|
String key = (String)keys.nextElement();
|
1769 |
|
File f = parts.get(key);
|
1770 |
|
f.delete();
|
1771 |
|
}
|
1772 |
|
}*/
|
1773 |
|
}
|
1774 |
1780 |
}
|
1775 |
1781 |
|
1776 |
1782 |
/**
|
some new code for debugging mmp