File: README.ejb

package info (click to toggle)
libxalan2-java 2.7.1-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 19,468 kB
  • ctags: 26,006
  • sloc: java: 175,784; xml: 28,073; sh: 164; jsp: 43; makefile: 43; sql: 6
file content (113 lines) | stat: -rw-r--r-- 3,906 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
============================================================
CONTENTS OF THIS DOCUMENT:

  o) HOW TO PROVIDE XSL TRANSFORMATIONS AS A WEB SERVICE
  o) HOW TO INVOKE TRANSLETS FROM AN ENTERPRISE JAVA BEAN
  o) TIPS FOR RUNNING THE SAMPLE ON JBOSS-3.0.4_TOMCAT-4.1.12

------------------------------------------------------------
HOW TO PROVIDE XSL TRANSFORMATIONS AS A WEB SERVICE

With XSLTC, XSL transformations can be run from within a
an Enterprise Java Bean (EJB) and exported through a servlet.
This sample code demonstrates how that can be implemented.

The CompiledServlet and CompiledBrazil sample code
demonstrate other approaches to providing XSL transformations
as a web service.

------------------------------------------------------------
HOW TO INVOKE TRANSLETS FROM AN ENTERPRISE JAVA BEAN

 o) Create an EJB that implements SessionBean and has a
    single transform() entry point:

    public class TransformBean implements SessionBean {
        public String transform(String document, String transletName) {
            // instanciate translet
            // build internal DOM
            // run transformation
            :
            :
        }
        :
        :
    }

 o) Create this EJB's remote interface (this is the interface
    your servlet will use to call the bean's entry point):

    public interface TransformRemote extends EJBObject {
        public String transform(String document, String transletName) 
        throws RemoteException;
    }

 o) Create the EJB's home interface, which your servlet
    will use to instantiate the remote interface:

    public interface TransformHome extends EJBHome {
        TransformRemote create()
            throws CreateException, RemoteException;
    }

 o) Create a servlet that uses the EJB's home interface to
    create a remote interface to the EJB, and then calls
    the EJB's transform() method through that remote
    interface:

    public class TransformServlet extends HttpServlet {

        public void init(ServletConfig config) {
            // look up the EJB's home interface using JNDI
        }

        public void doGet (HttpServletRequest request, 
                           HttpServletResponse response) 
            throws ServletException, IOException {
            // create the remote interface
            // pass the parameters from teh request to the EJB
            // display results passed back from EJB
        }
    }

 o) Set up your J2EE_CLASSPATH to include JAXP and the XSLTC
    runtime jars.
 

 o) Compile your XSL stylesheets and place them either in
    your J2EE_CLASSPATH or wrap them in your EJB jar.
    Make sure that the XSLTC TransformerFactory will be used
    by either setting the system property
    "javax.xml.transform.TransformerFactory" with the value
    "org.apache.xalan.xsltc.trax.TransformerFactoryImpl", or
    by making a file with the name
    "META-INF/services/javax.xml.transform.TransformerFactory"
    containing the single line

       org.apache.xalan.xsltc.trax.TransformerFactoryImpl

    available on your J2EE_CLASSPATH.


 o) Deploy your EJB

 o) Call the servlet with the necessary parameters (at least
    an URI to the source XML document and the name of the
    translet class).

------------------------------------------------------------
TIPS FOR RUNNING THE SAMPLE ON JBOSS-3.0.4_TOMCAT-4.1.12

 o) Copy the bundled xalan.jar (a version containing XSLTC) 
    to %Jboss_Home%/server/default/lib directory.

 o) Put the translet .class file in the same directory as 
    the EJB classes.

 o) Set the value of the "translet" parameter to the name 
    of the translet .class

 o) Set the value of the "document" parameter to a valid xml 
    URI
------------------------------------------------------------
END OF README