boolean ignoreMime,
@QueryParam(RestParam.FLASH)
@DefaultValue("false")
boolean flash) {
try {
Context context = getContext();
InputStream is = null;
// Determine if content is provided
RequestContent content =
RestUtil.getRequestContent(m_servletRequest, headers);
if (content != null && content.getContentStream() != null) {
if (ignoreMime) {
is = content.getContentStream();
} else {
// Make sure content is XML or ZIP
String contentMime = content.getMimeType();
if (contentMime != null) {
MediaType t = MediaType.valueOf(contentMime);
if (TEXT_XML.isCompatible(t) || APP_ZIP.isCompatible(t)) {
is = content.getContentStream();
}
}
}
}
// If no content is provided, use a FOXML template
if (is == null) {
if (pid == null || pid.equals("new")) {
pid = m_management.getNextPID(context, 1, namespace)[0];
}
if (ownerID == null || "".equals(ownerID.trim())) {
ownerID = context.getSubjectValue(Constants.SUBJECT.LOGIN_ID.uri);
}
is = new ByteArrayInputStream(getFOXMLTemplate(pid, label, ownerID, encoding).getBytes());
} else {
if (namespace != null && !namespace.equals("")) {