Package org.apache.jackrabbit.webdav.client.methods

Examples of org.apache.jackrabbit.webdav.client.methods.PutMethod


                Value[] jcrValues = new Value[values.length];
                for (int i = 0; i < values.length; i++) {
                    jcrValues[i] = ValueFormat.getJCRValue(values[i], resolver, valueFactory);
                }
                DavProperty<List<XmlSerializable>> vp = createValuesProperty(jcrValues);
                PutMethod method = new PutMethod(uri);
                method.setRequestBody(vp);

                methods.add(method);
            } catch (IOException e) {
                throw new RepositoryException(e);
            }
View Full Code Here


            } else {
                RequestEntity ent = getEntity(value);
                String uri = getItemUri(propertyId, sessionInfo);
                // TODO: use PUT in order to avoid the ValuesProperty-PROPPATCH call.
                // TODO: actually not quite correct for PROPPATCH assert that prop really exists.
                PutMethod method = new PutMethod(uri);
                method.setRequestHeader(HEADER_CONTENT_TYPE, JcrValueType.contentTypeFromType(value.getType()));
                method.setRequestEntity(ent);
                methods.add(method);
            }
        }
View Full Code Here

         */
        public void addProperty(NodeId parentId, Name propertyName, QValue value) throws RepositoryException {
            checkConsumed();
            String uri = getItemUri(parentId, propertyName, sessionInfo);

            PutMethod method = new PutMethod(uri);
            method.setRequestHeader(HEADER_CONTENT_TYPE, JcrValueType.contentTypeFromType(value.getType()));
            method.setRequestEntity(getEntity(value));
            methods.add(method);
        }
View Full Code Here

                Value[] jcrValues = new Value[values.length];
                for (int i = 0; i < values.length; i++) {
                    jcrValues[i] = ValueFormat.getJCRValue(values[i], resolver, valueFactory);
                }
                ValuesProperty vp = new ValuesProperty(jcrValues);
                PutMethod method = new PutMethod(uri);
                method.setRequestBody(vp);

                methods.add(method);
            } catch (IOException e) {
                throw new RepositoryException(e);
            }
View Full Code Here

            } else {
                RequestEntity ent = getEntity(value);
                String uri = getItemUri(propertyId, sessionInfo);
                // TODO: use PUT in order to avoid the ValuesProperty-PROPPATCH call.
                // TODO: actually not quite correct for PROPPATCH assert that prop really exists.
                PutMethod method = new PutMethod(uri);
                method.setRequestHeader(HEADER_CONTENT_TYPE, JcrValueType.contentTypeFromType(value.getType()));
                method.setRequestEntity(ent);
                methods.add(method);
            }
        }
View Full Code Here

         */
        public void addProperty(NodeId parentId, Name propertyName, QValue value) throws RepositoryException {
            checkConsumed();
            String uri = getItemUri(parentId, propertyName, sessionInfo);

            PutMethod method = new PutMethod(uri);
            method.setRequestHeader(HEADER_CONTENT_TYPE, JcrValueType.contentTypeFromType(value.getType()));
            method.setRequestEntity(getEntity(value));
            methods.add(method);
        }
View Full Code Here

                Value[] jcrValues = new Value[values.length];
                for (int i = 0; i < values.length; i++) {
                    jcrValues[i] = ValueFormat.getJCRValue(values[i], resolver, valueFactory);
                }
                DavProperty<List<XmlSerializable>> vp = createValuesProperty(jcrValues);
                PutMethod method = new PutMethod(uri);
                method.setRequestBody(vp);

                methods.add(method);
            } catch (IOException e) {
                throw new RepositoryException(e);
            }
View Full Code Here

            } else {
                RequestEntity ent = getEntity(value);
                String uri = getItemUri(propertyId, sessionInfo);
                // TODO: use PUT in order to avoid the ValuesProperty-PROPPATCH call.
                // TODO: actually not quite correct for PROPPATCH assert that prop really exists.
                PutMethod method = new PutMethod(uri);
                method.setRequestHeader(HEADER_CONTENT_TYPE, JcrValueType.contentTypeFromType(value.getType()));
                method.setRequestEntity(ent);
                methods.add(method);
            }
        }
View Full Code Here

    public String storeAttachment(Property[] arg0, AttachmentMetadata metadata, InputStream payload) throws IOException {
        String sanitize = TASUtil.sanitize(metadata.getFilename());
        String uploadUrl = getUploadFolder() + "/" + sanitize;

        PutMethod put = new PutMethod(uploadUrl);
        put.setRequestEntity(new InputStreamRequestEntity(payload));
        put.setRequestHeader("Content-type", metadata.getMimeType());

        try {
            int result = httpclient.executeMethod(put);
            if (log.isDebugEnabled()) {
                log.debug("Response status code: " + result);
                log.debug("Response body: ");
                log.debug(put.getResponseBodyAsString());
            }

            return uploadUrl;
        } catch (Exception e) {
            throw new IOException(e.getMessage());
        } finally {
            // Release current connection to the connection pool
            put.releaseConnection();
        }
    }
View Full Code Here

                    }
                }

                try
                {
                    final PutMethod method = new PutMethod(urlStr);
                    method.setRequestEntity(entity);
                    setupMethod(method);
                    execute(method);
                    setUserName(fileName, urlStr);
                }
                catch (final FileSystemException ex)
                {
                    if (!isCheckedIn)
                    {
                        try
                        {
                            final UncheckoutMethod method = new UncheckoutMethod(urlStr);
                            setupMethod(method);
                            execute(method);
                            isCheckedIn = true;
                        }
                        catch (final Exception e)
                        {
                            // Ignore the exception. Going to throw original.
                        }
                        throw ex;
                    }
                }
                if (!fileExists)
                {
                    createVersion(urlStr);
                    try
                    {
                        final DavPropertySet props = getPropertyNames(fileName);
                        isCheckedIn = !props.contains(VersionControlledResource.CHECKED_OUT);
                    }
                    catch (final FileNotFoundException fnfe)
                    {
                        // Ignore the error
                    }
                }
                if (!isCheckedIn)
                {
                  final CheckinMethod checkin = new CheckinMethod(urlStr);
                  setupMethod(checkin);
                  execute(checkin);
                }
            }
            else
            {
                final PutMethod method = new PutMethod(urlStr);
                method.setRequestEntity(entity);
                setupMethod(method);
                execute(method);
                try
                {
                    setUserName(fileName, urlStr);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.webdav.client.methods.PutMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.