code: protected void doPut( HttpServletRequest req, HttpServletResponse resp )
          throws ServletException, IOException
      {
          String path = req.getPathInfo();
          String context;
          if ( path == null )
          {
              path = req.getServletPath();
              context = req.getContextPath();
          }
          else
          {
              context = req.getContextPath() + req.getServletPath();
          }
          if ( path.endsWith( "/" ) )
          {
              resp.sendError( HttpURLConnection.HTTP_BAD_METHOD );
              return;
          }
          if ( path.startsWith( "/" ) )
          {
              path = path.substring( 1 );
          }
          String[] parts = path.split( "/" );
          if ( parts.length == 0 )
          {
              resp.sendError( HttpURLConnection.HTTP_BAD_METHOD );
              return;
          }
          String name = parts[parts.length - 1];
          if ( StringUtils.isEmpty( name ) )
          {
              resp.sendError( HttpURLConnection.HTTP_BAD_METHOD );
              return;
          }
          DirectoryEntry parent = fileSystem.getRoot();
          for ( int i = 0; i < parts.length - 1; i++ )
          {
              parent = new DefaultDirectoryEntry( fileSystem, parent, parts[i] );
          }
          ServletInputStream inputStream = null;
          try
          {
              inputStream = req.getInputStream();
              FileEntry put = fileSystem.put( parent, name, inputStream );
              if ( put != null )
              {
                  resp.setStatus( HttpURLConnection.HTTP_OK );
                  return;
              }
          }
          finally
          {
              IOUtils.closeQuietly( inputStream );
          }
          resp.sendError( HttpURLConnection.HTTP_BAD_METHOD );
      }
docs: {@inheritDoc}