<s>
Direct	B-Language
Web	I-Language
Remoting	I-Language
,	O
or	O
DWR	B-Language
,	O
is	O
a	O
Java	B-Language
open-source	B-Application
library	O
that	O
helps	O
developers	O
write	O
web	O
sites	O
that	O
include	O
Ajax	B-General_Concept
technology	O
.	O
</s>
<s>
It	O
allows	O
code	O
in	O
a	O
web	O
browser	O
to	O
use	O
Java	B-Language
functions	O
running	O
on	O
a	O
web	O
server	O
as	O
if	O
those	O
functions	O
were	O
within	O
the	O
browser	O
.	O
</s>
<s>
The	O
DWR	B-Language
project	O
was	O
started	O
by	O
Joe	O
Walker	O
in	O
2004	O
,	O
1.0	O
released	O
at	O
August	O
29	O
,	O
2005	O
.	O
</s>
<s>
Code	O
to	O
allow	O
JavaScript	B-Language
to	O
retrieve	O
data	O
from	O
a	O
servlet-based	O
web	O
server	O
using	O
Ajax	B-General_Concept
principles	O
.	O
</s>
<s>
A	O
JavaScript	B-Language
library	O
that	O
makes	O
it	O
easier	O
for	O
the	O
website	O
developer	O
to	O
dynamically	O
update	O
the	O
web	O
page	O
with	O
the	O
retrieved	O
data	O
.	O
</s>
<s>
DWR	B-Language
takes	O
a	O
novel	O
approach	O
to	O
Ajax	B-General_Concept
by	O
dynamically	O
generating	O
JavaScript	B-Language
code	O
based	O
on	O
Java	B-Language
classes	O
.	O
</s>
<s>
Thus	O
the	O
web	O
developer	O
can	O
use	O
Java	B-Language
code	I-Language
from	O
JavaScript	B-Language
as	O
if	O
it	O
were	O
local	O
to	O
the	O
web	O
browser	O
;	O
whereas	O
in	O
reality	O
the	O
Java	B-Language
code	I-Language
runs	O
in	O
the	O
web	O
server	O
and	O
has	O
full	O
access	O
to	O
web	O
server	O
resources	O
.	O
</s>
<s>
For	O
security	O
reasons	O
the	O
web	O
developer	O
must	O
configure	O
exactly	O
which	O
Java	B-Language
classes	O
are	O
safe	O
to	O
export	O
(	O
which	O
is	O
often	O
called	O
web.xml	O
or	O
dwr.xml	O
)	O
.	O
</s>
<s>
This	O
method	O
of	O
remoting	B-Operating_System
functions	O
from	O
Java	B-Language
to	O
JavaScript	B-Language
gives	O
DWR	B-Language
users	O
a	O
feel	O
much	O
like	O
conventional	O
RPC	B-Operating_System
mechanisms	O
like	O
RMI	B-Language
or	O
SOAP	B-Protocol
,	O
with	O
the	O
benefit	O
that	O
it	O
runs	O
over	O
the	O
web	O
without	O
requiring	O
web	O
browser	O
plug-ins	O
.	O
</s>
<s>
DWR	B-Language
does	O
not	O
consider	O
the	O
web	O
browser	O
/	O
web	O
server	O
protocol	O
to	O
be	O
important	O
,	O
and	O
prefers	O
to	O
ensure	O
that	O
the	O
programmer	O
's	O
interface	O
is	O
natural	O
.	O
</s>
<s>
The	O
greatest	O
challenge	O
to	O
this	O
is	O
to	O
marry	O
the	O
asynchronous	O
nature	O
of	O
Ajax	B-General_Concept
with	O
the	O
synchronous	O
nature	O
of	O
normal	O
Java	B-Language
method	O
calls	O
.	O
</s>
<s>
DWR	B-Language
solves	O
this	O
problem	O
by	O
allowing	O
the	O
web	O
developer	O
to	O
specify	O
a	O
function	O
to	O
be	O
called	O
when	O
the	O
data	O
is	O
returned	O
using	O
an	O
extra	O
method	O
parameter	O
.	O
</s>
<s>
The	O
value	O
returned	O
from	O
the	O
java	B-Language
function	O
will	O
be	O
passed	O
to	O
the	O
callback	O
method	O
.	O
</s>
<s>
The	O
callback	O
is	O
that	O
function	O
inside	O
the	O
JSON	B-General_Concept
object	O
passed	O
as	O
an	O
additional	O
parameter	O
to	O
the	O
remoted	O
function	O
.	O
</s>
<s>
With	O
version	O
2.0	O
,	O
DWR	B-Language
supports	O
Comet	B-General_Concept
(	O
also	O
called	O
"	O
Reverse	B-General_Concept
Ajax	I-General_Concept
)	O
where	O
Java	B-Language
code	I-Language
running	O
on	O
the	O
server	O
can	O
deliberately	O
send	O
dedicated	O
JavaScript	B-Language
to	O
a	O
browser	O
.	O
</s>
