KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jsp > getPublicationXml_jsp


1 package org.apache.jsp;
2
3 import javax.servlet.*;
4 import javax.servlet.http.*;
5 import javax.servlet.jsp.*;
6 import org.apache.jasper.runtime.*;
7
8 public class getPublicationXml_jsp extends HttpJspBase {
9
10
11   private static java.util.Vector JavaDoc _jspx_includes;
12
13   public java.util.List JavaDoc getIncludes() {
14     return _jspx_includes;
15   }
16
17   public void _jspService(HttpServletRequest request, HttpServletResponse response)
18         throws java.io.IOException JavaDoc, ServletException {
19
20     JspFactory _jspxFactory = null;
21     javax.servlet.jsp.PageContext JavaDoc pageContext = null;
22     HttpSession session = null;
23     ServletContext application = null;
24     ServletConfig config = null;
25     JspWriter out = null;
26     Object JavaDoc page = this;
27     JspWriter _jspx_out = null;
28
29
30     try {
31       _jspxFactory = JspFactory.getDefaultFactory();
32       response.setContentType("text/html;charset=ISO-8859-1");
33       pageContext = _jspxFactory.getPageContext(this, request, response,
34                 null, true, 8192, true);
35       application = pageContext.getServletContext();
36       config = pageContext.getServletConfig();
37       session = pageContext.getSession();
38       out = pageContext.getOut();
39       _jspx_out = out;
40
41
42     // standard stuff
43
response.setContentType("text/xml");
44     String JavaDoc sPublicationId = request.getParameter("id");
45     int iVersion = Integer.parseInt(request.getParameter("version"));
46     
47     String JavaDoc sXml = "";
48     
49     if( request.getSession().getAttribute("currentXml")==null ) {
50     
51         org.nextime.ion.framework.business.Publication oPublication = null;
52         try {
53             org.nextime.ion.framework.mapping.Mapping.begin();
54             oPublication = org.nextime.ion.framework.business.Publication.getInstance(sPublicationId);
55         } catch( Exception JavaDoc e ) {
56             // oh
57
e.printStackTrace();
58         } finally {
59             // no dirty transaction here
60
org.nextime.ion.framework.mapping.Mapping.rollback();
61         }
62         
63         // get back xml content
64
// replaceAll(".*<\\x3Fxml.*\\x3F>","")
65
sXml = oPublication.getVersion(iVersion).getDataAsString();
66     
67     } else {
68         
69         sXml = request.getSession().getAttribute("currentXml")+"";
70         request.getSession().removeAttribute("currentXml");
71     }
72     
73     sXml = sXml.substring( sXml.indexOf("<publication") );
74     
75     // a l'ancienne pke ca L?FJKFKJFKFD
76
sXml = sXml.replaceAll("ion:lang","xml:lang");
77     
78     // hack for € symbol
79
sXml = sXml.replaceAll("&euro;","€");
80     
81     System.out.println(sXml);
82
83       out.write("\r\n\r\n");
84       out.write("\r\n");
85       out.print(sXml);
86     } catch (Throwable JavaDoc t) {
87       out = _jspx_out;
88       if (out != null && out.getBufferSize() != 0)
89         out.clearBuffer();
90       if (pageContext != null) pageContext.handlePageException(t);
91     } finally {
92       if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
93     }
94   }
95 }
96
Popular Tags