use of com.zimbra.cs.dav.resource.Collection in project zm-mailbox by Zimbra.
the class Put method handle.
@Override
public void handle(DavContext ctxt) throws DavException, IOException {
String user = ctxt.getUser();
String name = ctxt.getItem();
if (user == null || name == null)
throw new DavException("invalid uri", HttpServletResponse.SC_NOT_ACCEPTABLE, null);
Collection col = UrlNamespace.getCollectionAtUrl(ctxt, ctxt.getPath());
DavResource rs = col.createItem(ctxt, name);
if (rs.isNewlyCreated())
ctxt.setStatus(HttpServletResponse.SC_CREATED);
else
ctxt.setStatus(HttpServletResponse.SC_NO_CONTENT);
if (rs.hasEtag()) {
ctxt.getResponse().setHeader(DavProtocol.HEADER_ETAG, rs.getEtag());
ctxt.getResponse().setHeader(ETagHeaderFilter.ZIMBRA_ETAG_HEADER, rs.getEtag());
}
}
Aggregations