  Let $L^m_p(R^n)$, $p\in [1,\infty]$, be the homogeneous Sobolev space, and
let $E\subset R^n$ be a closed set. For each $p>n$ and each non-negative
integer $m$ we give an intrinsic characterization of the restrictions to $E$ of
$m$-jets generated by functions $F\in L^{m+1}_p(R^n)$. Our trace criterion is
expressed in terms of variations of corresponding Taylor remainders of $m$-jets
evaluated on a certain family of "well separated" two point subsets of $E$. For
$p=\infty$ this result coincides with the classical Whitney-Glaeser extension
theorem for $m$-jets.
  Our approach is based on a representation of the Sobolev space
$L^{m+1}_p(R^n)$, $p>n$, as a union of $C^{m,(d)}(R^n)$-spaces where $d$
belongs to a family of metrics on $R^n$ with certain "nice" properties. Here
$C^{m,(d)}(R^n)$ is the space of $C^m$-functions on $R^n$ whose partial
derivatives of order $m$ are Lipschitz functions with respect to $d$.
  This enables us to show that, for every non-negative integer $m$ and every
$p\in (n,\infty)$, the very same classical linear Whitney extension operator
provides an almost optimal extension of $m$-jets generated by
$L^{m+1}_p$-functions.
