Mercurial Hosting > nabble
comparison src/nabble/view/web/embed/EmbedInfo.java @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7ecd1a4ef557 |
---|---|
1 | |
2 package nabble.view.web.embed; | |
3 | |
4 import nabble.model.Site; | |
5 import nabble.model.Node; | |
6 import nabble.view.lib.Jtp; | |
7 import nabble.view.lib.Shared; | |
8 | |
9 import javax.servlet.ServletException; | |
10 import javax.servlet.http.HttpServlet; | |
11 import javax.servlet.http.HttpServletRequest; | |
12 import javax.servlet.http.HttpServletResponse; | |
13 import java.io.IOException; | |
14 import java.io.PrintWriter; | |
15 | |
16 | |
17 public final class EmbedInfo extends HttpServlet { | |
18 | |
19 protected void service(HttpServletRequest request, HttpServletResponse response) | |
20 throws ServletException, IOException | |
21 { | |
22 Jtp.dontCache(response); | |
23 | |
24 PrintWriter out = response.getWriter(); | |
25 String nodeID = request.getParameter("node"); | |
26 if (nodeID == null) { | |
27 response.sendError(HttpServletResponse.SC_NOT_FOUND); | |
28 return; | |
29 } | |
30 | |
31 String clientID = request.getParameter("cid"); | |
32 String hash = request.getParameter("hash"); | |
33 String conf = request.getParameter("conf"); | |
34 | |
35 Site site = Jtp.getSite(request); | |
36 Node embeddedNode = site==null ? null : site.getNode(Long.parseLong(nodeID)); | |
37 | |
38 out.print( "\r\n<html>\r\n <head>\r\n <script src=\"" ); | |
39 out.print( (Shared.getJQueryPath()) ); | |
40 out.print( "\"></script>\r\n <script type=\"text/javascript\">\r\n var hash = \"" ); | |
41 out.print( (hash) ); | |
42 out.print( "\";\r\n var what = '" ); | |
43 out.print( (embeddedNode == null? "" : embeddedNode.getKind() == Node.Kind.APP? Jtp.viewName(embeddedNode).toLowerCase():"topic") ); | |
44 out.print( "';\r\n function canScroll() { return " ); | |
45 out.print( (conf == null || conf.indexOf("noscroll") == -1) ); | |
46 out.print( "; }\r\n\r\n var clientID = '" ); | |
47 out.print( (clientID) ); | |
48 out.print( "';\r\n\r\n " ); | |
49 /* Runs when everything here is ready */ | |
50 out.print( "\r\n function start() {\r\n try {\r\n parent.nabbleready.location = \"/util/Empty.jtp\";\r\n } catch(err) {\r\n setTimeout(start, 100);\r\n }\r\n }\r\n start();\r\n </script>\r\n </head>\r\n <body>\r\n </body>\r\n</html>\r\n" ); | |
51 | |
52 } | |
53 } | |
54 |