1 17 package org.alfresco.repo.webdav; 18 19 import org.alfresco.service.cmr.model.FileInfo; 20 import org.alfresco.service.cmr.model.FileNotFoundException; 21 22 27 public class OptionsMethod extends WebDAVMethod 28 { 29 private static final String DAV_HEADER = "DAV"; 30 private static final String DAV_HEADER_CONTENT = "1,2"; 31 private static final String ALLOW_HEADER = "Allow"; 32 private static final String MS_HEADER = "MS-Author-Via"; 33 34 private static final String FILE_METHODS = "OPTIONS, GET, HEAD, POST, DELETE, PROPFIND, COPY, MOVE, LOCK, UNLOCK"; 35 private static final String COLLECTION_METHODS = FILE_METHODS + ", PUT"; 36 37 40 public OptionsMethod() 41 { 42 } 43 44 49 protected void parseRequestHeaders() throws WebDAVServerException 50 { 51 } 53 54 59 protected void parseRequestBody() throws WebDAVServerException 60 { 61 } 63 64 69 protected void executeImpl() throws WebDAVServerException 70 { 71 boolean isFolder; 72 try 73 { 74 FileInfo fileInfo = getDAVHelper().getNodeForPath(getRootNodeRef(), getPath(), getServletPath()); 75 isFolder = fileInfo.isFolder(); 76 } 77 catch (FileNotFoundException e) 78 { 79 isFolder = true; 81 } 82 m_response.addHeader(DAV_HEADER, DAV_HEADER_CONTENT); 84 85 m_response.addHeader(MS_HEADER, DAV_HEADER); 87 88 m_response.addHeader(ALLOW_HEADER, isFolder ? COLLECTION_METHODS : FILE_METHODS); 90 } 91 } 92 | Popular Tags |