org.apache.jackrabbit.webdav.xml.Namespace Java Examples

The following examples show how to use org.apache.jackrabbit.webdav.xml.Namespace. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExchangeDavMethod.java    From davmail with GNU General Public License v2.0 6 votes vote down vote up
protected void handleProperty(XMLStreamReader reader, MultiStatusResponse multiStatusResponse) throws XMLStreamException {
    while (reader.hasNext() && !XMLStreamUtil.isEndTag(reader, "prop")) {
        reader.next();
        if (XMLStreamUtil.isStartTag(reader)) {
            Namespace namespace = Namespace.getNamespace(reader.getNamespaceURI());
            String tagLocalName = reader.getLocalName();
            if (reader.getAttributeCount() > 0 && "mv.string".equals(reader.getAttributeValue(0))) {
                 handleMultiValuedProperty(reader, multiStatusResponse);
            } else {
                String tagContent = getTagContent(reader);
                if (tagContent != null) {
                    multiStatusResponse.add(new DefaultDavProperty<>(tagLocalName, tagContent, namespace));
                }
            }
        }
    }
}
 
Example #2
Source File: Field.java    From davmail with GNU General Public License v2.0 6 votes vote down vote up
protected static void createField(String alias, DistinguishedPropertySetType propertySetType, int propertyTag, String responseAlias, PropertyType propertyType) {
    String name;
    String updateAlias;
    if (propertySetType == DistinguishedPropertySetType.Address) {
        // Address namespace expects integer names
        name = String.valueOf(propertyTag);
        updateAlias = "_x0030_x" + toHexString(propertyTag);
    } else if (propertySetType == DistinguishedPropertySetType.Task) {
        name = "0x" + toHexString(propertyTag);
        updateAlias = "0x0000" + toHexString(propertyTag);
    } else {
        // Common namespace expects hex names
        name = "0x" + toHexString(propertyTag);
        updateAlias = "_x0030_x" + toHexString(propertyTag);
    }
    Field field = new Field(alias, Namespace.getNamespace(SCHEMAS_MAPI_ID.getURI() +
            '{' + distinguishedPropertySetMap.get(propertySetType) + "}/"), name, propertyType, responseAlias, null, updateAlias);
    fieldMap.put(field.alias, field);
}
 
Example #3
Source File: TestCaldavHttpClient4.java    From davmail with GNU General Public License v2.0 6 votes vote down vote up
public void testRenameCalendar() throws IOException, URISyntaxException {
    String folderName = "testcalendarfolder";
    String renamedFolderName = "renamedcalendarfolder";
    URI uri = new URIBuilder().setPath("/users/" + session.getEmail() + "/calendar/" + folderName + '/').build();
    // first delete calendar
    session.deleteFolder("calendar/" + folderName);
    session.deleteFolder("calendar/" + renamedFolderName);

    session.createCalendarFolder("calendar/" + folderName, null);

    DavPropertySet davPropertySet = new DavPropertySet();
    davPropertySet.add(new DefaultDavProperty<>(DavPropertyName.create("displayname", Namespace.getNamespace("DAV:")), renamedFolderName));

    HttpProppatch propPatchMethod = new HttpProppatch(uri, davPropertySet, new DavPropertyNameSet());
    httpClient.executeDavRequest(propPatchMethod);

    ExchangeSession.Folder renamedFolder = session.getFolder("calendar/" + renamedFolderName);
    assertNotNull(renamedFolder);

}
 
Example #4
Source File: ExchangeDavRequest.java    From davmail with GNU General Public License v2.0 6 votes vote down vote up
protected void handleProperty(XMLStreamReader reader, MultiStatusResponse multiStatusResponse) throws XMLStreamException {
    while (reader.hasNext() && !XMLStreamUtil.isEndTag(reader, "prop")) {
        reader.next();
        if (XMLStreamUtil.isStartTag(reader)) {
            Namespace namespace = Namespace.getNamespace(reader.getNamespaceURI());
            String tagLocalName = reader.getLocalName();
            if (reader.getAttributeCount() > 0 && "mv.string".equals(reader.getAttributeValue(0))) {
                handleMultiValuedProperty(reader, multiStatusResponse);
            } else {
                String tagContent = getTagContent(reader);
                if (tagContent != null) {
                    multiStatusResponse.add(new DefaultDavProperty<>(tagLocalName, tagContent, namespace));
                }
            }
        }
    }
}
 
Example #5
Source File: Field.java    From davmail with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create field for namespace and name of type propertyType.
 *
 * @param alias         logical name in DavMail
 * @param namespace     Exchange namespace
 * @param name          Exchange name
 * @param propertyType  property type
 * @param responseAlias property name in SEARCH response (as responsealias in request)
 * @param cast          response cast type (e.g. bin.base64)
 * @param updateAlias   some properties use a different alias in PROPPATCH requests
 */
protected Field(String alias, Namespace namespace, String name, PropertyType propertyType, String responseAlias, String cast, String updateAlias) {
    this.alias = alias;

    // property name in PROPFIND requests
    davPropertyName = DavPropertyName.create(name, namespace);
    // property name in PROPPATCH requests
    updatePropertyName = DavPropertyName.create(updateAlias, namespace);

    // a few type based flags
    isMultivalued = propertyType != null && propertyType.toString().endsWith("Array");
    isIntValue = propertyType == PropertyType.Long || propertyType == PropertyType.Integer || propertyType == PropertyType.Short;
    isBooleanValue = propertyType == PropertyType.Boolean;
    isFloatValue = propertyType == PropertyType.Float || propertyType == PropertyType.Double;
    isDateValue = propertyType == PropertyType.SystemTime;

    this.uri = namespace.getURI() + name;
    if (responseAlias == null) {
        this.requestPropertyString = '"' + uri + '"';
        this.responsePropertyName = davPropertyName;
    } else {
        this.requestPropertyString = '"' + uri + "\" as " + responseAlias;
        this.responsePropertyName = DavPropertyName.create(responseAlias, EMPTY);
    }
    this.cast = cast;
}
 
Example #6
Source File: TestCaldav.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
public void testPropfindPublicPrincipal() throws IOException, DavException {
    //Settings.setLoggingLevel("httpclient.wire", Level.DEBUG);

    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    davPropertyNameSet.add(DavPropertyName.create("calendar-home-set", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("calendar-user-address-set", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("schedule-inbox-URL", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("schedule-outbox-URL", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    PropFindMethod method = new PropFindMethod("/principals/public/testcalendar/", davPropertyNameSet, 0);
    httpClient.executeMethod(method);
    assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode());
    MultiStatus multiStatus = method.getResponseBodyAsMultiStatus();
    MultiStatusResponse[] responses = multiStatus.getResponses();
    assertEquals(1, responses.length);
}
 
Example #7
Source File: Webdav4FileObject.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Sets an attribute of this file. Is only called if {@link #doGetType} does not return {@link FileType#IMAGINARY}.
 */
@Override
protected void doSetAttribute(final String attrName, final Object value) throws Exception {
    try {
        final GenericURLFileName fileName = (GenericURLFileName) getName();
        final String urlStr = toUrlString(fileName);
        final DavPropertySet properties = new DavPropertySet();
        final DavPropertyNameSet propertyNameSet = new DavPropertyNameSet();
        final DavProperty property = new DefaultDavProperty(attrName, value, Namespace.EMPTY_NAMESPACE);
        if (value != null) {
            properties.add(property);
        } else {
            propertyNameSet.add(property.getName()); // remove property
        }

        final HttpProppatch request = new HttpProppatch(urlStr, properties, propertyNameSet);
        setupRequest(request);
        final HttpResponse response = executeRequest(request);
        if (!request.succeeded(response)) {
            throw new FileSystemException("Property '" + attrName + "' could not be set.");
        }
    } catch (final FileSystemException fse) {
        throw fse;
    } catch (final Exception e) {
        throw new FileSystemException("vfs.provider.webdav/set-attributes", e, getName(), attrName);
    }
}
 
Example #8
Source File: TestCaldavHttpClient4.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
public void testPropfindPrincipal() throws IOException {
    //Settings.setLoggingLevel("httpclient.wire", Level.DEBUG);

    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    davPropertyNameSet.add(DavPropertyName.create("calendar-home-set", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("calendar-user-address-set", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("schedule-inbox-URL", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("schedule-outbox-URL", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    HttpPropfind method = new HttpPropfind("/principals/users/" + session.getEmail() + "/", davPropertyNameSet, 0);
    MultiStatus multiStatus = httpClient.executeDavRequest(method);
    MultiStatusResponse[] responses = multiStatus.getResponses();
    assertEquals(1, responses.length);
}
 
Example #9
Source File: TestCaldavHttpClient4.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
public void testWellKnown() throws IOException {
    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    davPropertyNameSet.add(DavPropertyName.create("current-user-principal", Namespace.getNamespace("DAV:")));
    davPropertyNameSet.add(DavPropertyName.create("principal-URL", Namespace.getNamespace("DAV:")));
    davPropertyNameSet.add(DavPropertyName.create("resourcetype", Namespace.getNamespace("DAV:")));
    HttpPropfind method = new HttpPropfind("/.well-known/caldav", davPropertyNameSet, 0) {
        @Override
        public boolean succeeded(HttpResponse response) {
            return response.getStatusLine().getStatusCode() == DavServletResponse.SC_MOVED_PERMANENTLY;
        }
    };
    httpClient.executeDavRequest(method);
}
 
Example #10
Source File: TestCaldavHttpClient4.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
public void testPropfindRoot() throws IOException {
    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    davPropertyNameSet.add(DavPropertyName.create("current-user-principal", Namespace.getNamespace("DAV:")));
    davPropertyNameSet.add(DavPropertyName.create("principal-URL", Namespace.getNamespace("DAV:")));
    davPropertyNameSet.add(DavPropertyName.create("resourcetype", Namespace.getNamespace("DAV:")));
    HttpPropfind method = new HttpPropfind("/", davPropertyNameSet, 0);
    httpClient.executeDavRequest(method);
}
 
Example #11
Source File: TestCaldavHttpClient4.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
public void testPropfindPublicPrincipal() throws IOException {
    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    davPropertyNameSet.add(DavPropertyName.create("calendar-home-set", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("calendar-user-address-set", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("schedule-inbox-URL", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("schedule-outbox-URL", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    HttpPropfind method = new HttpPropfind("/principals/public/testcalendar/", davPropertyNameSet, 0);
    MultiStatus multiStatus = httpClient.executeDavRequest(method);
    MultiStatusResponse[] responses = multiStatus.getResponses();
    assertEquals(1, responses.length);
}
 
Example #12
Source File: ResourceType.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    for (QName qn : getQnames()) {
        Namespace ns =
            Namespace.getNamespace(qn.getPrefix(), qn.getNamespaceURI());
        Element e =
            DomUtil.createElement(document, qn.getLocalPart(), ns);
        name.appendChild(e);
    }

    return name;
}
 
Example #13
Source File: SupportedCalendarComponentSet.java    From cosmo with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * {@inheritDoc}
 */
public Element toXml(Document document) {
    Element name = getName().toXml(document);

    for (String type : getComponentTypes()) {
        Element e = DomUtil.createElement(document,
                ELEMENT_CALDAV_COMP, NAMESPACE_CALDAV);
        DomUtil.setAttribute(e, ATTR_CALDAV_NAME,  Namespace.EMPTY_NAMESPACE, 
                type);
        name.appendChild(e);
    }

    return name;
}
 
Example #14
Source File: DavItemResourceBase.java    From cosmo with Apache License 2.0 5 votes vote down vote up
private QName propNameToQName(DavPropertyName name) {
    if (name == null) {
        final String msg = "name cannot be null";
        throw new IllegalArgumentException(msg);
    }

    Namespace ns = name.getNamespace();
    String uri = ns != null ? ns.getURI() : "";

    return entityFactory.createQName(uri, name.getName());
}
 
Example #15
Source File: DavItemResourceBase.java    From cosmo with Apache License 2.0 5 votes vote down vote up
private DavPropertyName qNameToPropName(QName qname) {
    // no namespace at all
    if ("".equals(qname.getNamespace())) {
        return DavPropertyName.create(qname.getLocalName());
    }

    Namespace ns = Namespace.getNamespace(qname.getNamespace());

    return DavPropertyName.create(qname.getLocalName(), ns);
}
 
Example #16
Source File: MultiStatus.java    From cosmo with Apache License 2.0 5 votes vote down vote up
/**
 * Finds Prop.
 * @param name The name.
 * @param ns The namespace.
 * @return The element.
 */
public Element findProp(String name,  Namespace ns) {
    for (Element prop : props) {
        if (DomUtil.matches(prop, name, ns)) {
            return prop;
        }
    }
    return null;
}
 
Example #17
Source File: WebdavFileObject.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Sets an attribute of this file. Is only called if {@link #doGetType} does not return {@link FileType#IMAGINARY}.
 */
@Override
protected void doSetAttribute(final String attrName, final Object value) throws Exception {
    try {
        final URLFileName fileName = (URLFileName) getName();
        final String urlStr = toUrlString(fileName);
        final DavPropertySet properties = new DavPropertySet();
        final DavPropertyNameSet propertyNameSet = new DavPropertyNameSet();
        final DavProperty property = new DefaultDavProperty(attrName, value, Namespace.EMPTY_NAMESPACE);
        if (value != null) {
            properties.add(property);
        } else {
            propertyNameSet.add(property.getName()); // remove property
        }

        final PropPatchMethod method = new PropPatchMethod(urlStr, properties, propertyNameSet);
        setupMethod(method);
        execute(method);
        if (!method.succeeded()) {
            throw new FileSystemException("Property '" + attrName + "' could not be set.");
        }
    } catch (final FileSystemException fse) {
        throw fse;
    } catch (final Exception e) {
        throw new FileSystemException("vfs.provider.webdav/set-attributes", e, getName(), attrName);
    }
}
 
Example #18
Source File: VersionControlledResourceImpl.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Fill the property set for this resource.
 * 
 * @see DavResourceImpl#initProperties()
 */
protected void initProperties() {
	if (!propsInitialized) {
		super.initProperties();

		properties.add(new HrefProperty(VERSION_HISTORY, locator.getResourcePath(), true));

		// DAV:auto-version property: there is no auto version, explicit
		// EVENT_CHECKEDOUT is required.
		properties.add(new DefaultDavProperty(AUTO_VERSION, null, false));
	  
		if(resource==null)
			return;
		
		properties.add(new DefaultDavProperty(DavPropertyName.DISPLAYNAME, resource.getName(), false));
		properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, AbstractWebdavServlet.getContext().getMimeType(resource.getName()), false));
		
		if (resource.isFolder())
			return;

		SupportedLock supportedLock = new SupportedLock();
		supportedLock.addEntry(Type.WRITE, Scope.EXCLUSIVE);
		properties.add(new DefaultDavProperty(DavPropertyName.SUPPORTEDLOCK, supportedLock, false));

		String baseVHref = getLocatorFromResource(resource).getHref(false);

		if (resource.isCheckedOut() || resource.isLocked()) {
			log.debug("{} is checkedout", resource.getName());
			properties.add(new HrefProperty(CHECKED_OUT, baseVHref, true));
			properties.add(new HrefProperty(VersionResource.PREDECESSOR_SET, locator.getResourcePath(), false));

			DefaultActiveLock activeLock = new DefaultActiveLock();
			activeLock.setOwner(resource.getLockUser());
			properties.add(new DefaultDavProperty(DavPropertyName.LOCKDISCOVERY, activeLock, false));
			properties.add(new DefaultDavProperty("activelock", activeLock, Namespace.XMLNS_NAMESPACE));
		} else {
			properties.add(new HrefProperty(CHECKED_IN, locator.getResourcePath(), true));
		}
	}
}
 
Example #19
Source File: TestCaldav.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
public void testPropfindRoot() throws IOException, DavException {
    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    davPropertyNameSet.add(DavPropertyName.create("current-user-principal", Namespace.getNamespace("DAV:")));
    davPropertyNameSet.add(DavPropertyName.create("principal-URL", Namespace.getNamespace("DAV:")));
    davPropertyNameSet.add(DavPropertyName.create("resourcetype", Namespace.getNamespace("DAV:")));
    PropFindMethod method = new PropFindMethod("/", davPropertyNameSet, 0);
    httpClient.executeMethod(method);
    assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode());
    method.getResponseBodyAsMultiStatus();
}
 
Example #20
Source File: ExchangeDavMethod.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected void handleMultiValuedProperty(XMLStreamReader reader, MultiStatusResponse multiStatusResponse) throws XMLStreamException {
    String tagLocalName = reader.getLocalName();
    Namespace namespace = Namespace.getNamespace(reader.getNamespaceURI());
    ArrayList<String> values = new ArrayList<>();
    while (reader.hasNext() && !XMLStreamUtil.isEndTag(reader, tagLocalName)) {
        reader.next();
        if (XMLStreamUtil.isStartTag(reader)) {
            String tagContent = getTagContent(reader);
            if (tagContent != null) {
                values.add(tagContent);
            }
        }
    }
    multiStatusResponse.add(new DefaultDavProperty<>(tagLocalName, values, namespace));
}
 
Example #21
Source File: ExchangeDavRequest.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
protected void handleMultiValuedProperty(XMLStreamReader reader, MultiStatusResponse multiStatusResponse) throws XMLStreamException {
    String tagLocalName = reader.getLocalName();
    Namespace namespace = Namespace.getNamespace(reader.getNamespaceURI());
    ArrayList<String> values = new ArrayList<>();
    while (reader.hasNext() && !XMLStreamUtil.isEndTag(reader, tagLocalName)) {
        reader.next();
        if (XMLStreamUtil.isStartTag(reader)) {
            String tagContent = getTagContent(reader);
            if (tagContent != null) {
                values.add(tagContent);
            }
        }
    }
    multiStatusResponse.add(new DefaultDavProperty<>(tagLocalName, values, namespace));
}
 
Example #22
Source File: TestCaldav.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
public void testPropfindPrincipal() throws IOException, DavException {
    //Settings.setLoggingLevel("httpclient.wire", Level.DEBUG);

    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    davPropertyNameSet.add(DavPropertyName.create("calendar-home-set", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("calendar-user-address-set", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("schedule-inbox-URL", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    davPropertyNameSet.add(DavPropertyName.create("schedule-outbox-URL", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav")));
    PropFindMethod method = new PropFindMethod("/principals/users/" + session.getEmail() + "/", davPropertyNameSet, 0);
    httpClient.executeMethod(method);
    assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode());
    MultiStatus multiStatus = method.getResponseBodyAsMultiStatus();
    MultiStatusResponse[] responses = multiStatus.getResponses();
    assertEquals(1, responses.length);
}
 
Example #23
Source File: TestCaldav.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
public void testWellKnown() throws IOException, DavException {
    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    davPropertyNameSet.add(DavPropertyName.create("current-user-principal", Namespace.getNamespace("DAV:")));
    davPropertyNameSet.add(DavPropertyName.create("principal-URL", Namespace.getNamespace("DAV:")));
    davPropertyNameSet.add(DavPropertyName.create("resourcetype", Namespace.getNamespace("DAV:")));
    PropFindMethod method = new PropFindMethod("/.well-known/caldav", davPropertyNameSet, 0);
    httpClient.executeMethod(method);
    assertEquals(HttpStatus.SC_MOVED_PERMANENTLY, method.getStatusCode());
}
 
Example #24
Source File: TestCaldav.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
public void testPrincipalUrl() throws IOException, DavException {
    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    davPropertyNameSet.add(DavPropertyName.create("principal-URL", Namespace.getNamespace("DAV:")));
    PropFindMethod method = new PropFindMethod("/principals/users/"+session.getEmail(), davPropertyNameSet, 0);
    httpClient.executeMethod(method);
    method.getResponseBodyAsMultiStatus();
    assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode());
}
 
Example #25
Source File: TestCaldav.java    From davmail with GNU General Public License v2.0 5 votes vote down vote up
public void testPropfindAddressBook() throws IOException, DavException {
    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    //davPropertyNameSet.add(DavPropertyName.create("getctag", Namespace.getNamespace("http://calendarserver.org/ns/")));
    davPropertyNameSet.add(DavPropertyName.create("getetag", Namespace.getNamespace("DAV:")));
    PropFindMethod method = new PropFindMethod("/users/" + session.getEmail()+"/addressbook/", davPropertyNameSet, 1);
    httpClient.getParams().setParameter(HttpMethodParams.USER_AGENT, "Address%20Book/883 CFNetwork/454.12.4 Darwin/10.8.0 (i386) (MacBookPro3%2C1)");
    httpClient.executeMethod(method);
    assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode());
    method.getResponseBodyAsMultiStatus();
}
 
Example #26
Source File: TestCaldavHttpClient4.java    From davmail with GNU General Public License v2.0 4 votes vote down vote up
public void testPrincipalUrl() throws IOException {
    DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet();
    davPropertyNameSet.add(DavPropertyName.create("principal-URL", Namespace.getNamespace("DAV:")));
    HttpPropfind method = new HttpPropfind("/principals/users/" + session.getEmail(), davPropertyNameSet, 0);
    httpClient.executeDavRequest(method);
}
 
Example #27
Source File: SyncReportInfo.java    From openmeetings with Apache License 2.0 4 votes vote down vote up
public void addProperty(String name, Namespace namespace) {
	this.addProperty(DavPropertyName.create(name, namespace));
}
 
Example #28
Source File: DavPrivilege.java    From cosmo with Apache License 2.0 4 votes vote down vote up
private static final CosmoQName qn(Namespace ns,
                              String local) {
    return new CosmoQName(ns.getURI(), local, ns.getPrefix());
}
 
Example #29
Source File: DavPrivilege.java    From cosmo with Apache License 2.0 4 votes vote down vote up
private static final Namespace ns(CosmoQName qn) {
    return Namespace.getNamespace(qn.getPrefix(), qn.getNamespaceURI());
}
 
Example #30
Source File: Field.java    From davmail with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("SameParameterValue")
protected static void createField(String alias, Namespace namespace, String name, PropertyType propertyType) {
    Field field = new Field(alias, namespace, name, propertyType);
    fieldMap.put(field.alias, field);
}