public Response put(Session session, String path, InputStream inputStream, String fileNodeType,
                       String contentNodeType, List<String> mixins, List<String> tokens, MultivaluedMap<String, String> allowedAutoVersionPath)
   {
      try
      {

         Node node = null;
         boolean isVersioned;
         try
         {
            node = (Node)session.getItem(path);
         }
         catch (PathNotFoundException pexc)
         {
            nullResourceLocks.checkLock(session, path, tokens);
         }

         if (node == null)
         {
            node = session.getRootNode().addNode(TextUtil.relativizePath(path, false), fileNodeType);
            // We set the new path
            path = node.getPath();
            node.addNode("jcr:content", contentNodeType);
            updateContent(node, inputStream, mixins);
            isVersioned = isVersionSupported(node.getPath(), session.getWorkspace().getName(), allowedAutoVersionPath);
            if (isVersioned && node.canAddMixin(VersionHistoryUtils.MIX_VERSIONABLE))
            {
               node.addMixin(VersionHistoryUtils.MIX_VERSIONABLE);
            }
            node.getSession().save();
         }
         else
         {
            isVersioned = isVersionSupported(node.getPath(), session.getWorkspace().getName(), allowedAutoVersionPath);
            if (isVersioned)
            {

               VersionHistoryUtils.createVersion(node);
               updateContent(node, inputStream, mixins);

            }
            else
            {
               updateContent(node, inputStream, mixins);
            }
         }

         session.save();
      }
      catch (LockException exc)
      {
         if(log.isDebugEnabled())
         {
            log.debug(exc.getMessage(), exc);
         }
         return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build();

      }
      catch (AccessDeniedException exc)
      {
         if(log.isDebugEnabled())
         {
            log.debug(exc.getMessage(), exc);
         }
         return Response.status(HTTPStatus.FORBIDDEN).entity(exc.getMessage()).build();

      }
      catch (RepositoryException exc)
      {
         if(log.isDebugEnabled())
         {
            log.debug(exc.getMessage(), exc);
         }
         return Response.status(HTTPStatus.CONFLICT).entity(exc.getMessage()).build();
      }
      catch (Exception exc)
      {
         if(log.isDebugEnabled())
         {
            log.debug(exc.getMessage(), exc);
         }
         return Response.status(HTTPStatus.CONFLICT).entity(exc.getMessage()).build();
      }
      if (uriBuilder != null)
      {
         return Response.created(uriBuilder.path(session.getWorkspace().getName()).path(path).build()).build();
      }

      // to save compatibility if uriBuilder is not provided
      return Response.status(HTTPStatus.CREATED).build();

   }
public Response put ( Session session , String path , InputStream inputStream , String fileNodeType , String contentNodeType , List < String > mixins , List < String > tokens , MultivaluedMap < String , String > allowedAutoVersionPath ) { try { Node node = null ; boolean isVersioned ; try { node = ( Node ) session . getItem ( path ) ; } catch ( PathNotFoundException pexc ) { nullResourceLocks . checkLock ( session , path , tokens ) ; } if ( node == null ) { node = session . getRootNode ( ) . addNode ( TextUtil . relativizePath ( path , false ) , fileNodeType ) ; path = node . getPath ( ) ; node . addNode ( "jcr:content" , contentNodeType ) ; updateContent ( node , inputStream , mixins ) ; isVersioned = isVersionSupported ( node . getPath ( ) , session . getWorkspace ( ) . getName ( ) , allowedAutoVersionPath ) ; if ( isVersioned && node . canAddMixin ( VersionHistoryUtils . MIX_VERSIONABLE ) ) { node . addMixin ( VersionHistoryUtils . MIX_VERSIONABLE ) ; } node . getSession ( ) . save ( ) ; } else { isVersioned = isVersionSupported ( node . getPath ( ) , session . getWorkspace ( ) . getName ( ) , allowedAutoVersionPath ) ; if ( isVersioned ) { VersionHistoryUtils . createVersion ( node ) ; updateContent ( node , inputStream , mixins ) ; } else { updateContent ( node , inputStream , mixins ) ; } } session . save ( ) ; } catch ( LockException exc ) { if ( log . isDebugEnabled ( ) ) { log . debug ( exc . getMessage ( ) , exc ) ; } return Response . status ( HTTPStatus . LOCKED ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( AccessDeniedException exc ) { if ( log . isDebugEnabled ( ) ) { log . debug ( exc . getMessage ( ) , exc ) ; } return Response . status ( HTTPStatus . FORBIDDEN ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( RepositoryException exc ) { if ( log . isDebugEnabled ( ) ) { log . debug ( exc . getMessage ( ) , exc ) ; } return Response . status ( HTTPStatus . CONFLICT ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( Exception exc ) { if ( log . isDebugEnabled ( ) ) { log . debug ( exc . getMessage ( ) , exc ) ; } return Response . status ( HTTPStatus . CONFLICT ) . entity ( exc . getMessage ( ) ) . build ( ) ; } if ( uriBuilder != null ) { return Response . created ( uriBuilder . path ( session . getWorkspace ( ) . getName ( ) ) . path ( path ) . build ( ) ) . build ( ) ; } return Response . status ( HTTPStatus . CREATED ) . build ( ) ; }
Webdav Put method implementation.

@param session current session
@param path resource path
@param inputStream stream that contains resource content
@param fileNodeType the node type of file node
@param contentNodeType the node type of content
@param mixins the list of mixins
@param tokens tokens
@param allowedAutoVersionPath
@return the instance of javax.ws.rs.core.Response