content_jsp.java
12.6 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.crx.i18n.Dictionary
* javax.jcr.Node
* javax.jcr.Session
* javax.jcr.Workspace
* javax.jcr.nodetype.NodeType
* javax.jcr.version.VersionManager
* javax.servlet.Servlet
* javax.servlet.ServletConfig
* javax.servlet.ServletContext
* javax.servlet.ServletException
* javax.servlet.ServletRequest
* javax.servlet.ServletResponse
* javax.servlet.http.HttpServletRequest
* javax.servlet.http.HttpServletResponse
* javax.servlet.jsp.JspFactory
* javax.servlet.jsp.JspWriter
* javax.servlet.jsp.PageContext
* javax.servlet.jsp.SkipPageException
* org.apache.commons.lang3.StringEscapeUtils
* org.apache.jackrabbit.util.Text
* org.apache.jasper.runtime.HttpJspBase
* org.apache.jasper.runtime.JspRuntimeLibrary
* org.apache.jasper.runtime.JspSourceDependent
*/
package com.day.crx.explorer.impl.jsp.browser;
import com.day.crx.explorer.impl.j2ee.CRXContext;
import com.day.crx.explorer.impl.util.CSRFUtil;
import com.day.crx.explorer.impl.util.RequestData;
import com.day.crx.i18n.Dictionary;
import java.io.IOException;
import java.util.List;
import javax.jcr.Node;
import javax.jcr.Session;
import javax.jcr.Workspace;
import javax.jcr.nodetype.NodeType;
import javax.jcr.version.VersionManager;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspFactory;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.SkipPageException;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.jackrabbit.util.Text;
import org.apache.jasper.runtime.HttpJspBase;
import org.apache.jasper.runtime.JspRuntimeLibrary;
import org.apache.jasper.runtime.JspSourceDependent;
public final class content_jsp
extends HttpJspBase
implements JspSourceDependent {
private static List _jspx_dependants;
private void printError(JspWriter out, String msg) throws IOException {
out.print("<span class=\"error_line\">");
out.print(StringEscapeUtils.escapeHtml4((String)msg));
out.print("</span>");
}
public Object getDependants() {
return _jspx_dependants;
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
Node currentNode;
JspWriter _jspx_out;
JspWriter out;
CRXContext ctx;
PageContext _jspx_page_context;
Dictionary dict;
JspFactory _jspxFactory;
RequestData req;
String docroot;
Session repSession;
block38 : {
block37 : {
_jspxFactory = null;
PageContext pageContext = null;
out = null;
_jspx_out = null;
_jspx_page_context = null;
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html");
_jspx_page_context = pageContext = _jspxFactory.getPageContext((Servlet)this, (ServletRequest)request, (ServletResponse)response, null, false, 8192, true);
pageContext.getServletContext();
pageContext.getServletConfig();
_jspx_out = out = pageContext.getOut();
response.setContentType("text/html; charset=utf-8");
ctx = CRXContext.getInstance(pageContext, request);
repSession = ctx.getSession();
if (repSession != null) break block37;
if (_jspxFactory == null) return;
_jspxFactory.releasePageContext(_jspx_page_context);
return;
}
currentNode = ctx.getNode();
docroot = ctx.getDocroot();
req = ctx.getRequestData();
dict = ctx.getCurrentDictionary();
String[] validReferer = new String[]{"/crx/explorer/browser/index.jsp", "/crx/explorer/browser/content.jsp", "/crx/explorer/browser/tree.jsp"};
if (CSRFUtil.testReferer(request, validReferer)) break block38;
response.sendError(403);
if (_jspxFactory == null) return;
_jspxFactory.releasePageContext(_jspx_page_context);
return;
}
try {
String escPath = ctx.getPath() == null ? "null" : Text.escape((String)ctx.getPath());
out.write("<html>\n<head>\n<script type=\"text/javascript\">\n function syncTree(path) {\n if (path) {\n window.parent.tree.NodeTree.getTree(\"repository\").reloadNodeByPath(path);\n window.parent.setPath(path);\n window.parent.definition.selectItem(path);\n } else {\n window.parent.tree.NodeTree.getTree(\"repository\").reload();\n window.parent.setPath(\"/\");\n window.parent.definition.selectItem(\"/\");\n }\n }\n\n function openNode(path) {\n var src = \"");
out.print(docroot);
out.write("/browser/content.jsp\";\n src+=\"?Path=\"+encodeURIComponent(path);\n src+=\"&_charset_=utf-8\";\n src+=\"&ck=\" + new Date().valueOf();\n window.location=src;\n }\n\n function setView(view) {\n var src = \"");
out.print(docroot);
out.write("/browser/content.jsp\";\n src+=\"?Path=");
out.print(escPath);
out.write("\";\n src+=\"&_charset_=utf-8\";\n src+=\"&ck=\" + new Date().valueOf();\n src+=\"&View=\" + view;\n window.location=src;\n }\n\n function gotoNode(path) {\n window.parent.tree.NodeTree.getTree(\"repository\").selectNodeByPath(path);\n window.parent.setPath(path);\n window.parent.definition.selectItem(path);\n openNode(path);\n }\n</script>");
String action = req.getParameter("action_ops");
String action_arg0 = req.getParameter("action_arg0");
String action_arg1 = req.getParameter("action_arg1");
String action_arg2 = req.getParameter("action_arg2");
String action_arg3 = req.getParameter("action_arg3");
if ("clone".equals(action)) {
try {
boolean removeExisting = Boolean.valueOf(action_arg3);
repSession.getWorkspace().clone(action_arg0, action_arg1, action_arg2, removeExisting);
out.write("<script type=\"text/javascript\">\n syncTree(decodeURIComponent(\"");
out.print(Text.escape((String)action_arg1));
out.write("\"));\n </script>\n ");
}
catch (Exception e) {
this.printError(out, dict.fmt("crex.unable_to_clone_0_from_1_2.txt", (Object)action_arg1, (Object)action_arg0, (Object)e.toString()));
}
}
if ("createActivity".equals(action)) {
try {
Node node = repSession.getWorkspace().getVersionManager().createActivity(action_arg0);
out.write("<script type=\"text/javascript\">\n gotoNode(decodeURIComponent(\"");
out.print(Text.escape((String)node.getPath()));
out.write("\"));\n </script>\n ");
}
catch (Exception e) {
this.printError(out, dict.fmt("crex.unable_to_create_activity_0.txt", (Object)e.toString()));
}
}
if ("showActivity".equals(action)) {
try {
Node node = repSession.getWorkspace().getVersionManager().getActivity();
if (node != null) {
out.write("<script type=\"text/javascript\">\n gotoNode(decodeURIComponent(\"");
out.print(Text.escape((String)node.getPath()));
out.write("\"));\n </script>\n ");
}
}
catch (Exception e) {
this.printError(out, dict.fmt("crex.unable_to_show_activity_0.txt", (Object)e.toString()));
}
}
if ("clearActivity".equals(action)) {
try {
repSession.getWorkspace().getVersionManager().setActivity(null);
out.write("<script type=\"text/javascript\">\n syncTree(\"/\");\n </script>\n ");
}
catch (Exception e) {
this.printError(out, dict.fmt("crex.unable_to_clear_activity_0.txt", (Object)e.toString()));
}
}
if ("move".equals(action)) {
try {
repSession.move(action_arg0, action_arg1);
out.write("<script type=\"text/javascript\">\n syncTree(decodeURIComponent(\"");
out.print(Text.escape((String)action_arg1));
out.write("\"));\n </script>\n ");
}
catch (Exception e) {
this.printError(out, dict.fmt("crex.unable_to_move_0_to_1_2.txt", (Object)action_arg0, (Object)action_arg1, (Object)e.toString()));
}
}
if ("copy".equals(action)) {
try {
repSession.getWorkspace().copy(action_arg0, action_arg1);
out.write("<script type=\"text/javascript\">\n syncTree(decodeURIComponent(\"");
out.print(Text.escape((String)Text.getRelativeParent((String)action_arg1, (int)1)));
out.write("\"));\n </script>\n ");
}
catch (Exception e) {
this.printError(out, dict.fmt("crex.unable_to_copy_0_to_1_2.txt", (Object)action_arg0, (Object)action_arg1, (Object)e.toString()));
}
}
if ("saveAll".equals(action)) {
try {
repSession.getRootNode().save();
out.write("<script type=\"text/javascript\">\n syncTree();\n </script>\n ");
}
catch (Exception e) {
this.printError(out, dict.fmt("crex.unable_to_save_0.txt", (Object)e.toString()));
}
}
if ("refreshAll".equals(action)) {
try {
repSession.getRootNode().refresh("true".equals(action_arg0));
currentNode = null;
out.write("<script type=\"text/javascript\">\n window.parent.gotoPath('/');\n //window.parent.location.reload();\n </script>\n ");
}
catch (Exception e) {
this.printError(out, dict.fmt("crex.unable_to_refresh_all_0.txt", (Object)e.toString()));
}
}
String nt = currentNode == null ? "" : currentNode.getPrimaryNodeType().getName();
if ((nt = req.getParameter("View", nt)).equals("nt:nodeType")) {
JspRuntimeLibrary.include((ServletRequest)request, (ServletResponse)response, (String)"views/nodetype.jsp", (JspWriter)out, (boolean)true);
} else {
JspRuntimeLibrary.include((ServletRequest)request, (ServletResponse)response, (String)"views/itemlist.jsp", (JspWriter)out, (boolean)true);
}
out.write("</html>");
ctx.close();
if (!request.getMethod().equalsIgnoreCase("POST")) return;
response.flushBuffer();
Thread.sleep(50);
return;
}
catch (Throwable t) {
try {
if (t instanceof SkipPageException) return;
out = _jspx_out;
if (out != null && out.getBufferSize() != 0) {
out.clearBuffer();
}
if (_jspx_page_context == null) return;
_jspx_page_context.handlePageException(t);
return;
}
catch (Throwable throwable) {
throw throwable;
}
finally {
if (_jspxFactory != null) {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
}
}