23.07.2013 Views

O'Reilly - Java Message Service

O'Reilly - Java Message Service

O'Reilly - Java Message Service

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Java</strong> <strong>Message</strong> <strong>Service</strong><br />

JNDI ENC. In addition to providing a bean with access to resources such as JDBC,<br />

<strong>Java</strong>Mail, JTA, and URL and JMS connection factories, the JNDI ENC is used to access<br />

properties and other enterprise beans. Resources accessed from the JNDI ENC are<br />

managed implicitly by the EJB server so that they are pooled and then are automatically<br />

enrolled in transactions as needed.<br />

All enterprise beans (session, entity, and message-driven) can be developed separately,<br />

packaged in a JAR file and distributed. As components, packaged beans can be reused and<br />

combined with various other beans to solve any number of application requirements. In<br />

addition, enterprise beans are portable so that they can be combined and deployed on any<br />

application server that is EJB-compliant.<br />

Session and entity beans are accessed as distributed objects via <strong>Java</strong> RMI-IIOP, which<br />

provides some level of location transparency; clients can access the beans on the server<br />

somewhat like local objects. Entity and session beans are based on the RPC distributed<br />

computing paradigm. <strong>Message</strong>-driven beans are JMS clients that process JMS messages;<br />

they are not accessed as distributed objects. <strong>Message</strong>-driven beans are based on the<br />

asynchronous enterprise messaging paradigm.<br />

There is a lot more to Enterprise <strong>Java</strong>Beans than is provided in this simple overview. You<br />

can learn more about EJB by reading Enterprise <strong>Java</strong>Beans, by Richard Monson-Haefel<br />

(<strong>O'Reilly</strong>).<br />

8.1.2 Servlets<br />

The servlet specification defines a server-side component model that can be implemented<br />

by web server vendors. Servlets provide a simple but powerful API for generating web<br />

pages dynamically. (Although servlets can be used for many different request-reply<br />

protocols, they are predominantly used to process HTTP requests for web pages.)<br />

Servlets are developed in the same fashion as enterprise beans; they are <strong>Java</strong> classes that<br />

extend a base component class and may have a deployment descriptor. Servlets do not<br />

implicitly support transactions and are not accessed as distributed objects. Servlets respond<br />

to requests recieved from an input stream, usually HTTP, and respond by writing to an<br />

output stream. Once a servlet is developed and packaged in a JAR file, it can be deployed<br />

in a web server. When a servlet is deployed, it is assigned to handle requests for a specific<br />

web page or assist other servlets in handling page requests.<br />

The servlet specification is simple and elegant. It's a powerful server-side component<br />

model. You can learn more about servlets in <strong>Java</strong> Servlet Programming, by Jason<br />

Hunter and William Crawford (<strong>O'Reilly</strong>).<br />

8.1.3 <strong>Java</strong>Server Pages<br />

<strong>Java</strong>Server Pages ( JSP) is an extension of the servlet component model that simplifies the<br />

process of generating HTML dynamically. JSP essentially allows you to incorporate <strong>Java</strong><br />

directly into an HTML page as a scripting language. JSP pages (text documents) are<br />

translated and compiled into <strong>Java</strong> servlets, which are then run in a web server just like any<br />

other servlet - some servers do the compilation automatically at runtime. JSP can also be<br />

used to generate XML documents dynamically.<br />

124

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!