当前位置: 首页>>代码示例>>Java>>正文


Java DavConstants类代码示例

本文整理汇总了Java中org.apache.jackrabbit.webdav.DavConstants的典型用法代码示例。如果您正苦于以下问题:Java DavConstants类的具体用法?Java DavConstants怎么用?Java DavConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DavConstants类属于org.apache.jackrabbit.webdav包,在下文中一共展示了DavConstants类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processResponseBody

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
/**
 * Overridden to process the sync-token. Adapted from DavMethodBase.
 *
 * @see DavMethodBase#processResponseBody(HttpState, HttpConnection)
 */
@Override
protected void processResponseBody(HttpState httpState, HttpConnection httpConnection) {
	if (getStatusCode() == DavServletResponse.SC_MULTI_STATUS) {
		try {
			Document document = getResponseBodyAsDocument();
			if (document != null) {
				synctoken = DomUtil.getChildText(document.getDocumentElement(), SyncReportInfo.XML_SYNC_TOKEN, DavConstants.NAMESPACE);
				log.info("Sync-Token for REPORT: " + synctoken);

				multiStatus = MultiStatus.createFromXml(document.getDocumentElement());
				processMultiStatusBody(multiStatus, httpState, httpConnection);
			}
		} catch (IOException e) {
			log.error("Error while parsing sync-token.", e);
			setSuccess(false);
		}
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:24,代码来源:SyncMethod.java

示例2: convertToWspaceMeta

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
private WspaceMeta convertToWspaceMeta(WspaceMeta meta, MultiStatusResponse res) {
    if (meta == null) {
        meta = new WspaceMeta(getWsHome(), res.getHref().replaceFirst(getWsHome(), ""));
    }
    DavPropertySet props = res.getProperties(200);
    if (props != null) {
        for (DavProperty p : props) {
            String name = (p == null || p.getName() == null) ? null : p.getName().getName();
            if (name != null) {
                String v = String.valueOf(p.getValue());
                if (name.equals(DavConstants.PROPERTY_GETLASTMODIFIED)) {
                        meta.setLastModified(v);
                } else if (name.equals(DavConstants.PROPERTY_GETCONTENTLENGTH)) {
                    try {
                        meta.setSize(Long.parseLong(v));
                    } catch (Exception e) {}
                } else if (name.equals(DavConstants.PROPERTY_GETCONTENTTYPE)) {
                    meta.setContentType(v);
                } else if (p.getName().getNamespace().equals(IRSA_NS)) {
                    meta.setProperty(name, String.valueOf(p.getValue()));
                }
            }
        }
    }
    return meta;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:27,代码来源:WorkspaceManager.java

示例3: isDirectory

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
private boolean isDirectory(URLFileName name) throws IOException
{
    try
    {
        DavProperty property = getProperty(name, DavConstants.PROPERTY_RESOURCETYPE);
        Node node;
        if (property != null && (node = (Node) property.getValue()) != null)
        {
            return node.getLocalName().equals(DavConstants.XML_COLLECTION);
        }
        else
        {
            return false;
        }
    }
    catch (FileNotFoundException fse)
    {
        throw new FileNotFolderException(name);
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:21,代码来源:WebdavFileObject.java

示例4: addRequiredProperties

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
private void addRequiredProperties() {
    if (underLineResource instanceof Collection) {
        addDavProperty(DavPropertyName.RESOURCETYPE, new ResourceType(ResourceType.COLLECTION));
        // Windows XP support
        addDavProperty(DavPropertyName.ISCOLLECTION, "1");
    } else {
        addDavProperty(DavPropertyName.RESOURCETYPE, new ResourceType(ResourceType.DEFAULT_RESOURCE));
        // Windows XP support
        addDavProperty(DavPropertyName.ISCOLLECTION, "0");
        addDavProperty(DavPropertyName.GETCONTENTLENGTH, getContentLength());
        addDavProperty(DavPropertyName.GETCONTENTTYPE, underLineResource.getMediaType());
    }

    addDavProperty(DavPropertyName.create("author"), underLineResource.getAuthorUserName());
    addDavProperty(DavPropertyName.GETETAG, getETag());
    addDavProperty(DavPropertyName.DISPLAYNAME, getDisplayName());
    addDavProperty(DavPropertyName.CREATIONDATE, DavConstants.creationDateFormat.format(
                                                                               underLineResource.getCreatedTime()));
    addDavProperty(DavPropertyName.GETLASTMODIFIED, DavConstants.modificationDateFormat.format(
                                                                              underLineResource.getLastModified()));

}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:23,代码来源:RegistryResource.java

示例5: isDirectory

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
private boolean isDirectory(URLFileName name) throws IOException, DavException
{
    try
    {
        DavProperty property = getProperty(name, DavConstants.PROPERTY_RESOURCETYPE);
        Node node;
        if (property != null && (node = (Node) property.getValue()) != null)
        {
            return node.getLocalName().equals(DavConstants.XML_COLLECTION);
        }
        else
        {
            return false;
        }
    }
    catch (FileNotFoundException fse)
    {
        throw new FileNotFolderException(name);
    }
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:21,代码来源:WebdavFileObject.java

示例6: toXml

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
public Element toXml(Document document) {
    if (isAbstract) {
        return null;
    }
    Element privilege = DomUtil.createElement(document, 
            XML_PRIVILEGE, DavConstants.NAMESPACE); 
    privilege.appendChild(DomUtil.createElement(document, 
            qname.getLocalPart(), ns(qname)));
    return privilege;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:11,代码来源:DavPrivilege.java

示例7: createProperties

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
protected DavPropertySet createProperties() {
    final DavPropertySet localProperties = new DavPropertySet();
    SimpleDateFormat simpleFormat = (SimpleDateFormat) DavConstants.modificationDateFormat.clone();
    simpleFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
    localProperties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, simpleFormat.format(new Date())));

    if (getDisplayName() != null) {
        localProperties.add(new DefaultDavProperty(DavPropertyName.DISPLAYNAME, getDisplayName()));
    }

    return localProperties;
}
 
开发者ID:Benky,项目名称:webdav-cassandra,代码行数:13,代码来源:AbstractDavResource.java

示例8: doGetContentSize

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
/**
 * Returns the size of the file content (in bytes).
 */
@Override
protected long doGetContentSize() throws Exception
{
    DavProperty property = getProperty((URLFileName) getName(),
            DavConstants.PROPERTY_GETCONTENTLENGTH);
    if (property != null)
    {
        String value = (String) property.getValue();
        return Long.parseLong(value);
    }
    return 0;
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:16,代码来源:WebdavFileObject.java

示例9: doGetLastModifiedTime

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
/**
 * Returns the last modified time of this file.  Is only called if
 * {@link #doGetType} does not return {@link FileType#IMAGINARY}.
 */
@Override
protected long doGetLastModifiedTime() throws Exception
{
    DavProperty property = getProperty((URLFileName) getName(),
            DavConstants.PROPERTY_GETLASTMODIFIED);
    if (property != null)
    {
        String value = (String) property.getValue();
        return DateUtil.parseDate(value).getTime();
    }
    return 0;
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:17,代码来源:WebdavFileObject.java

示例10: getProperties

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
DavPropertySet getProperties(URLFileName name, int type, DavPropertyNameSet nameSet,
                             boolean addEncoding)
        throws FileSystemException
{
    try
    {
        String urlStr = urlString(name);
        PropFindMethod method = new PropFindMethod(urlStr, type, nameSet, DavConstants.DEPTH_0);
        setupMethod(method);
        execute(method);
        if (method.succeeded())
        {
            MultiStatus multiStatus = method.getResponseBodyAsMultiStatus();
            MultiStatusResponse response = multiStatus.getResponses()[0];
            DavPropertySet props = response.getProperties(HttpStatus.SC_OK);
            if (addEncoding)
            {
                DavProperty prop = new DefaultDavProperty(RESPONSE_CHARSET,
                        method.getResponseCharSet());
                props.add(prop);
            }
            return props;
        }
        return new DavPropertySet();
    }
    catch (FileSystemException fse)
    {
        throw fse;
    }
    catch (Exception e)
    {
        throw new FileSystemException("vfs.provider.webdav/propfind.error", getName(), e);
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:35,代码来源:WebdavFileObject.java

示例11: doGetContentSize

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
/**
 * Returns the size of the file content (in bytes).
 */
protected long doGetContentSize() throws Exception
{
    DavProperty property = getProperty((URLFileName) getName(),
            DavConstants.PROPERTY_GETCONTENTLENGTH);
    if (property != null)
    {
        String value = (String) property.getValue();
        return Long.parseLong(value);
    }
    return 0;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:15,代码来源:WebdavFileObject.java

示例12: doGetLastModifiedTime

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
/**
 * Returns the last modified time of this file.  Is only called if
 * {@link #doGetType} does not return {@link FileType#IMAGINARY}.
 */
protected long doGetLastModifiedTime() throws Exception
{
    DavProperty property = getProperty((URLFileName) getName(),
            DavConstants.PROPERTY_GETLASTMODIFIED);
    if (property != null)
    {
        String value = (String) property.getValue();
        return DateUtil.parseDate(value).getTime();
    }
    return 0;
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:16,代码来源:WebdavFileObject.java

示例13: generate

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
public static FileSystemException generate(DavException davExc, DavMethod method)
        throws FileSystemException
{
    String msg = davExc.getMessage();
    if (davExc.hasErrorCondition())
    {
        try
        {
            Element error = davExc.toXml(DomUtil.BUILDER_FACTORY.newDocumentBuilder().newDocument());
            if (DomUtil.matches(error, DavException.XML_ERROR, DavConstants.NAMESPACE))
            {
                if (DomUtil.hasChildElement(error, "exception", null))
                {
                    Element exc = DomUtil.getChildElement(error, "exception", null);
                    if (DomUtil.hasChildElement(exc, "message", null))
                    {
                        msg = DomUtil.getChildText(exc, "message", null);
                    }
                    if (DomUtil.hasChildElement(exc, "class", null))
                    {
                        Class<?> cl = Class.forName(DomUtil.getChildText(exc, "class", null));
                        Constructor<?> excConstr = cl.getConstructor(new Class[]{String.class});
                        if (excConstr != null)
                        {
                            Object o = excConstr.newInstance(new Object[]{msg});
                            if (o instanceof FileSystemException)
                            {
                                return (FileSystemException) o;
                            }
                            else if (o instanceof Exception)
                            {
                                return new FileSystemException(msg, (Exception) o);
                            }
                        }
                    }
                }
            }
        }
        catch (Exception e)
        {
            throw new FileSystemException(e);
        }
    }

    return new FileSystemException(msg);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:47,代码来源:ExceptionConverter.java

示例14: generate

import org.apache.jackrabbit.webdav.DavConstants; //导入依赖的package包/类
public static FileSystemException generate(DavException davExc, DavMethod method)
        throws FileSystemException
{
    String msg = davExc.getMessage();
    if (davExc.hasErrorCondition())
    {
        try
        {
            Element error = davExc.toXml(DomUtil.BUILDER_FACTORY.newDocumentBuilder().newDocument());
            if (DomUtil.matches(error, DavException.XML_ERROR, DavConstants.NAMESPACE))
            {
                if (DomUtil.hasChildElement(error, "exception", null))
                {
                    Element exc = DomUtil.getChildElement(error, "exception", null);
                    if (DomUtil.hasChildElement(exc, "message", null))
                    {
                        msg = DomUtil.getChildText(exc, "message", null);
                    }
                    if (DomUtil.hasChildElement(exc, "class", null))
                    {
                        Class cl = Class.forName(DomUtil.getChildText(exc, "class", null));
                        Constructor excConstr = cl.getConstructor(new Class[]{String.class});
                        if (excConstr != null)
                        {
                            Object o = excConstr.newInstance(new String[]{msg});
                            if (o instanceof FileSystemException)
                            {
                                return (FileSystemException) o;
                            }
                            else if (o instanceof Exception)
                            {
                                return new FileSystemException(msg, (Exception) o);
                            }
                        }
                    }
                }
            }
        }
        catch (Exception e)
        {
            throw new FileSystemException(e);
        }
    }

    return new FileSystemException(msg);
}
 
开发者ID:pentaho,项目名称:pdi-vfs,代码行数:47,代码来源:ExceptionConverter.java


注:本文中的org.apache.jackrabbit.webdav.DavConstants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。