<s>
Rack	B-Application
is	O
a	O
modular	O
interface	O
between	O
web	B-Application
servers	I-Application
and	O
web	B-Application
applications	I-Application
developed	O
in	O
the	O
Ruby	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
With	O
Rack	B-Application
,	O
application	B-Application
programming	I-Application
interfaces	I-Application
(	O
APIs	B-Application
)	O
for	O
web	B-Application
frameworks	I-Application
and	O
middleware	B-General_Concept
are	O
wrapped	O
into	O
a	O
single	O
method	B-Language
call	I-Language
handling	O
HTTP	O
requests	O
and	O
responses	O
.	O
</s>
<s>
Rack	B-Application
is	O
used	O
by	O
many	O
Ruby	B-Language
web	B-Application
frameworks	I-Application
and	O
libraries	B-Library
,	O
such	O
as	O
Ruby	B-Application
on	I-Application
Rails	I-Application
and	O
Sinatra	B-Application
.	O
</s>
<s>
It	O
is	O
available	O
as	O
a	O
Ruby	B-Language
Gem	B-Application
.	O
</s>
<s>
Many	O
Ruby	B-Language
applications	O
are	O
called	O
"	O
rack-compliant	O
"	O
.	O
</s>
<s>
Rack	B-Application
has	O
inspired	O
similar	O
frameworks	O
in	O
JavaScript	B-Application
(	O
jack.js	O
)	O
,	O
Clojure	B-Language
,	O
Perl	B-Language
(	O
Plack	B-Language
)	O
,	O
Common	B-Language
Lisp	I-Language
(	O
Clack	O
)	O
,	O
and	O
.NET	B-Application
(	O
OWIN	B-Application
)	O
.	O
</s>
<s>
The	O
characteristics	O
of	O
a	O
Rack	B-Application
application	O
is	O
that	O
the	O
application	O
object	O
responds	O
to	O
the	O
call	O
method	O
.	O
</s>
<s>
The	O
call	O
method	O
takes	O
in	O
the	O
environment	O
object	O
as	O
argument	O
and	O
returns	O
the	O
Rack	B-Application
response	O
object	O
.	O
</s>
<s>
A	O
Ruby	B-Language
object	O
for	O
reporting	O
errors	O
.	O
</s>
<s>
In	O
case	O
the	O
application	O
is	O
being	O
used	O
as	O
a	O
middleware	B-General_Concept
,	O
the	O
environment	O
can	O
have	O
objects	O
that	O
would	O
provide	O
session	O
information	O
,	O
logging	O
capabilities	O
,	O
information	O
on	O
the	O
size	O
of	O
the	O
data	O
that	O
can	O
be	O
used	O
for	O
read	O
and	O
writes	O
etc	O
.	O
</s>
<s>
The	O
rack	B-Application
server	O
object	O
returns	O
a	O
response	O
which	O
contains	O
three	O
parts	O
:	O
the	O
status	O
,	O
headers	O
and	O
the	O
body	O
.	O
</s>
<s>
The	O
status	O
contains	O
the	O
HTTP	B-Protocol
status	I-Protocol
codes	I-Protocol
such	O
as	O
200,404	O
.	O
</s>
<s>
Rack::Response	O
provides	O
a	O
convenient	O
interface	O
to	O
create	O
a	O
Rack	B-Application
response	O
.	O
</s>
<s>
The	O
class	O
Rack::Response	O
is	O
defined	O
in	O
lib/rack/response.rb	O
.	O
</s>
<s>
To	O
use	O
the	O
Response	O
class	O
,	O
instantiate	O
it	O
from	O
the	O
middleware	B-General_Concept
layer	O
down	O
the	O
stack	O
.	O
</s>
<s>
Rack	B-Application
makes	O
it	O
easy	O
to	O
add	O
a	O
chain	O
of	O
middleware	B-General_Concept
components	O
between	O
the	O
application	O
and	O
the	O
web	B-Application
server	I-Application
.	O
</s>
<s>
Multiple	O
middleware	B-General_Concept
components	O
can	O
be	O
used	O
in	O
the	O
rack	B-Application
which	O
modifies	O
the	O
request/response	O
before	O
handing	O
it	O
over	O
to	O
the	O
next	O
component	O
.	O
</s>
<s>
This	O
is	O
called	O
middleware	B-General_Concept
stack	O
.	O
</s>
<s>
The	O
Rack	B-Application
server	O
adds	O
multiple	O
middle	O
middleware	B-General_Concept
by	O
default	O
for	O
the	O
functionalities	O
like	O
showing	O
exception	O
with	O
all	O
the	O
details	O
,	O
validating	O
the	O
request	O
and	O
responses	O
according	O
to	O
the	O
Rack	B-Application
spec	O
etc	O
.	O
</s>
<s>
A	O
Rack-compatible	O
"	O
Hello	O
World	O
"	O
application	O
in	O
Ruby	B-Language
syntax	O
:	O
</s>
<s>
The	O
server	O
for	O
the	O
above	O
code	O
can	O
be	O
initiated	O
using	O
"	O
rackup	O
helloWorld.ru	O
 "	O
and	O
can	O
be	O
accessed	O
at	O
The	O
default	O
port	O
used	O
by	O
the	O
Rack	B-Application
application	O
is	O
9292	O
.	O
</s>
