001: /*
002: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003: * notice. All rights reserved.
004: */
005: package com.tc.weblogic.transform;
006:
007: import com.tc.asm.ClassAdapter;
008: import com.tc.asm.ClassVisitor;
009: import com.tc.asm.Label;
010: import com.tc.asm.MethodVisitor;
011: import com.tc.asm.Opcodes;
012: import com.tc.object.bytecode.ByteCodeUtil;
013: import com.tc.object.bytecode.ClassAdapterFactory;
014:
015: public class WebAppServletContextAdapter extends ClassAdapter implements
016: Opcodes, ClassAdapterFactory {
017:
018: public WebAppServletContextAdapter() {
019: super (null);
020: }
021:
022: private WebAppServletContextAdapter(ClassVisitor cv,
023: ClassLoader caller) {
024: super (cv);
025: }
026:
027: public ClassAdapter create(ClassVisitor visitor, ClassLoader loader) {
028: return new WebAppServletContextAdapter(visitor, loader);
029: }
030:
031: public void visit(int version, int access, String name,
032: String signature, String super Name, String[] interfaces) {
033: interfaces = ByteCodeUtil.addInterfaces(interfaces,
034: new String[] { "com/terracotta/session/WebAppConfig" });
035: super .visit(version, access, name, signature, super Name,
036: interfaces);
037: }
038:
039: public void visitEnd() {
040: addIsWeblogic8();
041: addSesssionAttributeListeners();
042: addSessionListener();
043: addSessionCookieComment();
044: addSessionCookieDomain();
045: addSessionCookieMaxAge();
046: addSessionCookieName();
047: addSessionCookiePath();
048: addSessionCookieSecure();
049: addSessionCookieEnabled();
050: addSessionIdLength();
051: addSessionTimeoutSeconds();
052: addServerId();
053: addSessionTrackingEnabled();
054: addSessionUrlRewritingEnabled();
055: addSessionDelimiter();
056: super .visitEnd();
057: }
058:
059: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
060: // The method being added is used by most of the ohers being added to switch between wl8
061: // and wl9 versions.
062: public void addIsWeblogic8() {
063: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
064: "__tc_isWeblogic8", "()Z", null, null);
065: mv.visitCode();
066: Label l0 = new Label();
067: Label l1 = new Label();
068: Label l2 = new Label();
069: mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Exception");
070: mv.visitLabel(l0);
071: mv.visitLineNumber(42, l0);
072: mv.visitVarInsn(ALOAD, 0);
073: mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object",
074: "getClass", "()Ljava/lang/Class;");
075: mv.visitLdcInsn("sessionCookieName");
076: mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class",
077: "getDeclaredField",
078: "(Ljava/lang/String;)Ljava/lang/reflect/Field;");
079: mv.visitInsn(POP);
080: mv.visitLabel(l1);
081: mv.visitLineNumber(43, l1);
082: mv.visitInsn(ICONST_1);
083: mv.visitInsn(IRETURN);
084: mv.visitLabel(l2);
085: mv.visitLineNumber(44, l2);
086: mv.visitVarInsn(ASTORE, 1);
087: Label l3 = new Label();
088: mv.visitLabel(l3);
089: mv.visitLineNumber(46, l3);
090: mv.visitInsn(ICONST_0);
091: mv.visitInsn(IRETURN);
092: Label l4 = new Label();
093: mv.visitLabel(l4);
094: mv.visitLocalVariable("this",
095: "Lweblogic/servlet/internal/WebAppServletContext;",
096: null, l0, l4, 0);
097: mv.visitMaxs(2, 2);
098: mv.visitEnd();
099: }
100:
101: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
102: private void addSesssionAttributeListeners() {
103: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
104: "__tc_session_getHttpSessionAttributeListeners",
105: "()[Ljavax/servlet/http/HttpSessionAttributeListener;",
106: null, null);
107: mv.visitCode();
108: Label l0 = new Label();
109: mv.visitLabel(l0);
110: mv.visitLineNumber(76, l0);
111: mv.visitVarInsn(ALOAD, 0);
112: mv.visitMethodInsn(INVOKEVIRTUAL,
113: "weblogic/servlet/internal/WebAppServletContext",
114: "__tc_isWeblogic8", "()Z");
115: Label l1 = new Label();
116: mv.visitJumpInsn(IFEQ, l1);
117: Label l2 = new Label();
118: mv.visitLabel(l2);
119: mv.visitLineNumber(77, l2);
120: mv.visitVarInsn(ALOAD, 0);
121: mv.visitFieldInsn(GETFIELD,
122: "weblogic/servlet/internal/WebAppServletContext",
123: "sessAttrListeners", "Ljava/util/List;");
124: Label l3 = new Label();
125: mv.visitJumpInsn(IFNONNULL, l3);
126: Label l4 = new Label();
127: mv.visitLabel(l4);
128: mv.visitLineNumber(78, l4);
129: mv.visitInsn(ICONST_0);
130: mv.visitTypeInsn(ANEWARRAY,
131: "javax/servlet/http/HttpSessionAttributeListener");
132: mv.visitInsn(ARETURN);
133: mv.visitLabel(l3);
134: mv.visitLineNumber(80, l3);
135: mv.visitVarInsn(ALOAD, 0);
136: mv.visitFieldInsn(GETFIELD,
137: "weblogic/servlet/internal/WebAppServletContext",
138: "sessAttrListeners", "Ljava/util/List;");
139: mv.visitInsn(ICONST_0);
140: mv.visitTypeInsn(ANEWARRAY,
141: "javax/servlet/http/HttpSessionAttributeListener");
142: mv.visitMethodInsn(INVOKEINTERFACE, "java/util/List",
143: "toArray", "([Ljava/lang/Object;)[Ljava/lang/Object;");
144: mv.visitTypeInsn(CHECKCAST,
145: "[Ljavax/servlet/http/HttpSessionAttributeListener;");
146: mv.visitInsn(ARETURN);
147: mv.visitLabel(l1);
148: mv.visitLineNumber(83, l1);
149: mv.visitVarInsn(ALOAD, 0);
150: mv.visitMethodInsn(INVOKEVIRTUAL,
151: "weblogic/servlet/internal/WebAppServletContext",
152: "getEventsManager",
153: "()Lweblogic/servlet/internal/EventsManager;");
154: mv.visitMethodInsn(INVOKEVIRTUAL,
155: "weblogic/servlet/internal/EventsManager",
156: "__tc_session_getHttpSessionAttributeListeners",
157: "()[Ljavax/servlet/http/HttpSessionAttributeListener;");
158: mv.visitInsn(ARETURN);
159: Label l5 = new Label();
160: mv.visitLabel(l5);
161: mv.visitLocalVariable("this",
162: "Lweblogic/servlet/internal/WebAppServletContext;",
163: null, l0, l5, 0);
164: mv.visitMaxs(2, 1);
165: mv.visitEnd();
166: }
167:
168: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
169: private void addSessionListener() {
170: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
171: "__tc_session_getHttpSessionListener",
172: "()[Ljavax/servlet/http/HttpSessionListener;", null,
173: null);
174: mv.visitCode();
175: Label l0 = new Label();
176: mv.visitLabel(l0);
177: mv.visitLineNumber(89, l0);
178: mv.visitVarInsn(ALOAD, 0);
179: mv.visitMethodInsn(INVOKEVIRTUAL,
180: "weblogic/servlet/internal/WebAppServletContext",
181: "__tc_isWeblogic8", "()Z");
182: Label l1 = new Label();
183: mv.visitJumpInsn(IFEQ, l1);
184: Label l2 = new Label();
185: mv.visitLabel(l2);
186: mv.visitLineNumber(90, l2);
187: mv.visitVarInsn(ALOAD, 0);
188: mv.visitFieldInsn(GETFIELD,
189: "weblogic/servlet/internal/WebAppServletContext",
190: "sessListeners", "Ljava/util/List;");
191: Label l3 = new Label();
192: mv.visitJumpInsn(IFNONNULL, l3);
193: Label l4 = new Label();
194: mv.visitLabel(l4);
195: mv.visitLineNumber(91, l4);
196: mv.visitInsn(ICONST_0);
197: mv.visitTypeInsn(ANEWARRAY,
198: "javax/servlet/http/HttpSessionListener");
199: mv.visitInsn(ARETURN);
200: mv.visitLabel(l3);
201: mv.visitLineNumber(93, l3);
202: mv.visitVarInsn(ALOAD, 0);
203: mv.visitFieldInsn(GETFIELD,
204: "weblogic/servlet/internal/WebAppServletContext",
205: "sessListeners", "Ljava/util/List;");
206: mv.visitInsn(ICONST_0);
207: mv.visitTypeInsn(ANEWARRAY,
208: "javax/servlet/http/HttpSessionListener");
209: mv.visitMethodInsn(INVOKEINTERFACE, "java/util/List",
210: "toArray", "([Ljava/lang/Object;)[Ljava/lang/Object;");
211: mv.visitTypeInsn(CHECKCAST,
212: "[Ljavax/servlet/http/HttpSessionListener;");
213: mv.visitInsn(ARETURN);
214: mv.visitLabel(l1);
215: mv.visitLineNumber(96, l1);
216: mv.visitVarInsn(ALOAD, 0);
217: mv.visitMethodInsn(INVOKEVIRTUAL,
218: "weblogic/servlet/internal/WebAppServletContext",
219: "getEventsManager",
220: "()Lweblogic/servlet/internal/EventsManager;");
221: mv.visitMethodInsn(INVOKEVIRTUAL,
222: "weblogic/servlet/internal/EventsManager",
223: "__tc_session_getHttpSessionListener",
224: "()[Ljavax/servlet/http/HttpSessionListener;");
225: mv.visitInsn(ARETURN);
226: Label l5 = new Label();
227: mv.visitLabel(l5);
228: mv.visitLocalVariable("this",
229: "Lweblogic/servlet/internal/WebAppServletContext;",
230: null, l0, l5, 0);
231: mv.visitMaxs(2, 1);
232: mv.visitEnd();
233: }
234:
235: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
236: private void addSessionCookieComment() {
237: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
238: "__tc_session_getCookieComment",
239: "()Ljava/lang/String;", null, null);
240: mv.visitCode();
241: Label l0 = new Label();
242: mv.visitLabel(l0);
243: mv.visitLineNumber(102, l0);
244: mv.visitVarInsn(ALOAD, 0);
245: mv.visitMethodInsn(INVOKEVIRTUAL,
246: "weblogic/servlet/internal/WebAppServletContext",
247: "__tc_isWeblogic8", "()Z");
248: Label l1 = new Label();
249: mv.visitJumpInsn(IFEQ, l1);
250: Label l2 = new Label();
251: mv.visitLabel(l2);
252: mv.visitLineNumber(103, l2);
253: mv.visitVarInsn(ALOAD, 0);
254: mv.visitFieldInsn(GETFIELD,
255: "weblogic/servlet/internal/WebAppServletContext",
256: "sessionCookieComment", "Ljava/lang/String;");
257: mv.visitInsn(ARETURN);
258: mv.visitLabel(l1);
259: mv.visitLineNumber(105, l1);
260: mv.visitVarInsn(ALOAD, 0);
261: mv.visitFieldInsn(GETFIELD,
262: "weblogic/servlet/internal/WebAppServletContext",
263: "sessionContext",
264: "Lweblogic/servlet/internal/session/SessionContext;");
265: mv
266: .visitMethodInsn(
267: INVOKEVIRTUAL,
268: "weblogic/servlet/internal/session/SessionContext",
269: "getConfigMgr",
270: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
271: mv
272: .visitMethodInsn(
273: INVOKEVIRTUAL,
274: "weblogic/servlet/internal/session/SessionConfigManager",
275: "getCookieComment", "()Ljava/lang/String;");
276: mv.visitInsn(ARETURN);
277: Label l3 = new Label();
278: mv.visitLabel(l3);
279: mv.visitLocalVariable("this",
280: "Lweblogic/servlet/internal/WebAppServletContext;",
281: null, l0, l3, 0);
282: mv.visitMaxs(1, 1);
283: mv.visitEnd();
284: }
285:
286: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
287: private void addSessionCookieDomain() {
288: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
289: "__tc_session_getCookieDomain", "()Ljava/lang/String;",
290: null, null);
291: mv.visitCode();
292: Label l0 = new Label();
293: mv.visitLabel(l0);
294: mv.visitLineNumber(111, l0);
295: mv.visitVarInsn(ALOAD, 0);
296: mv.visitMethodInsn(INVOKEVIRTUAL,
297: "weblogic/servlet/internal/WebAppServletContext",
298: "__tc_isWeblogic8", "()Z");
299: Label l1 = new Label();
300: mv.visitJumpInsn(IFEQ, l1);
301: Label l2 = new Label();
302: mv.visitLabel(l2);
303: mv.visitLineNumber(112, l2);
304: mv.visitVarInsn(ALOAD, 0);
305: mv.visitFieldInsn(GETFIELD,
306: "weblogic/servlet/internal/WebAppServletContext",
307: "sessionCookieDomain", "Ljava/lang/String;");
308: mv.visitInsn(ARETURN);
309: mv.visitLabel(l1);
310: mv.visitLineNumber(114, l1);
311: mv.visitVarInsn(ALOAD, 0);
312: mv.visitFieldInsn(GETFIELD,
313: "weblogic/servlet/internal/WebAppServletContext",
314: "sessionContext",
315: "Lweblogic/servlet/internal/session/SessionContext;");
316: mv
317: .visitMethodInsn(
318: INVOKEVIRTUAL,
319: "weblogic/servlet/internal/session/SessionContext",
320: "getConfigMgr",
321: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
322: mv
323: .visitMethodInsn(
324: INVOKEVIRTUAL,
325: "weblogic/servlet/internal/session/SessionConfigManager",
326: "getCookieDomain", "()Ljava/lang/String;");
327: mv.visitInsn(ARETURN);
328: Label l3 = new Label();
329: mv.visitLabel(l3);
330: mv.visitLocalVariable("this",
331: "Lweblogic/servlet/internal/WebAppServletContext;",
332: null, l0, l3, 0);
333: mv.visitMaxs(1, 1);
334: mv.visitEnd();
335: }
336:
337: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
338: private void addSessionCookieMaxAge() {
339: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
340: "__tc_session_getCookieMaxAgeSecs", "()I", null, null);
341: mv.visitCode();
342: Label l0 = new Label();
343: mv.visitLabel(l0);
344: mv.visitLineNumber(120, l0);
345: mv.visitVarInsn(ALOAD, 0);
346: mv.visitMethodInsn(INVOKEVIRTUAL,
347: "weblogic/servlet/internal/WebAppServletContext",
348: "__tc_isWeblogic8", "()Z");
349: Label l1 = new Label();
350: mv.visitJumpInsn(IFEQ, l1);
351: Label l2 = new Label();
352: mv.visitLabel(l2);
353: mv.visitLineNumber(121, l2);
354: mv.visitVarInsn(ALOAD, 0);
355: mv.visitFieldInsn(GETFIELD,
356: "weblogic/servlet/internal/WebAppServletContext",
357: "sessionCookieMaxAgeSecs", "I");
358: mv.visitInsn(IRETURN);
359: mv.visitLabel(l1);
360: mv.visitLineNumber(123, l1);
361: mv.visitVarInsn(ALOAD, 0);
362: mv.visitFieldInsn(GETFIELD,
363: "weblogic/servlet/internal/WebAppServletContext",
364: "sessionContext",
365: "Lweblogic/servlet/internal/session/SessionContext;");
366: mv
367: .visitMethodInsn(
368: INVOKEVIRTUAL,
369: "weblogic/servlet/internal/session/SessionContext",
370: "getConfigMgr",
371: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
372: mv
373: .visitMethodInsn(
374: INVOKEVIRTUAL,
375: "weblogic/servlet/internal/session/SessionConfigManager",
376: "getCookieMaxAgeSecs", "()I");
377: mv.visitInsn(IRETURN);
378: Label l3 = new Label();
379: mv.visitLabel(l3);
380: mv.visitLocalVariable("this",
381: "Lweblogic/servlet/internal/WebAppServletContext;",
382: null, l0, l3, 0);
383: mv.visitMaxs(1, 1);
384: mv.visitEnd();
385: }
386:
387: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
388: private void addSessionCookieName() {
389: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
390: "__tc_session_getCookieName", "()Ljava/lang/String;",
391: null, null);
392: mv.visitCode();
393: Label l0 = new Label();
394: mv.visitLabel(l0);
395: mv.visitLineNumber(129, l0);
396: mv.visitVarInsn(ALOAD, 0);
397: mv.visitMethodInsn(INVOKEVIRTUAL,
398: "weblogic/servlet/internal/WebAppServletContext",
399: "__tc_isWeblogic8", "()Z");
400: Label l1 = new Label();
401: mv.visitJumpInsn(IFEQ, l1);
402: Label l2 = new Label();
403: mv.visitLabel(l2);
404: mv.visitLineNumber(130, l2);
405: mv.visitVarInsn(ALOAD, 0);
406: mv.visitFieldInsn(GETFIELD,
407: "weblogic/servlet/internal/WebAppServletContext",
408: "sessionCookieName", "Ljava/lang/String;");
409: mv.visitInsn(ARETURN);
410: mv.visitLabel(l1);
411: mv.visitLineNumber(132, l1);
412: mv.visitVarInsn(ALOAD, 0);
413: mv.visitFieldInsn(GETFIELD,
414: "weblogic/servlet/internal/WebAppServletContext",
415: "sessionContext",
416: "Lweblogic/servlet/internal/session/SessionContext;");
417: mv
418: .visitMethodInsn(
419: INVOKEVIRTUAL,
420: "weblogic/servlet/internal/session/SessionContext",
421: "getConfigMgr",
422: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
423: mv
424: .visitMethodInsn(
425: INVOKEVIRTUAL,
426: "weblogic/servlet/internal/session/SessionConfigManager",
427: "getCookieName", "()Ljava/lang/String;");
428: mv.visitInsn(ARETURN);
429: Label l3 = new Label();
430: mv.visitLabel(l3);
431: mv.visitLocalVariable("this",
432: "Lweblogic/servlet/internal/WebAppServletContext;",
433: null, l0, l3, 0);
434: mv.visitMaxs(1, 1);
435: mv.visitEnd();
436: }
437:
438: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
439: private void addSessionCookiePath() {
440: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
441: "__tc_session_getCookiePath", "()Ljava/lang/String;",
442: null, null);
443: mv.visitCode();
444: Label l0 = new Label();
445: mv.visitLabel(l0);
446: mv.visitLineNumber(138, l0);
447: mv.visitVarInsn(ALOAD, 0);
448: mv.visitMethodInsn(INVOKEVIRTUAL,
449: "weblogic/servlet/internal/WebAppServletContext",
450: "__tc_isWeblogic8", "()Z");
451: Label l1 = new Label();
452: mv.visitJumpInsn(IFEQ, l1);
453: Label l2 = new Label();
454: mv.visitLabel(l2);
455: mv.visitLineNumber(139, l2);
456: mv.visitVarInsn(ALOAD, 0);
457: mv.visitFieldInsn(GETFIELD,
458: "weblogic/servlet/internal/WebAppServletContext",
459: "sessionCookiePath", "Ljava/lang/String;");
460: mv.visitInsn(ARETURN);
461: mv.visitLabel(l1);
462: mv.visitLineNumber(141, l1);
463: mv.visitVarInsn(ALOAD, 0);
464: mv.visitFieldInsn(GETFIELD,
465: "weblogic/servlet/internal/WebAppServletContext",
466: "sessionContext",
467: "Lweblogic/servlet/internal/session/SessionContext;");
468: mv
469: .visitMethodInsn(
470: INVOKEVIRTUAL,
471: "weblogic/servlet/internal/session/SessionContext",
472: "getConfigMgr",
473: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
474: mv
475: .visitMethodInsn(
476: INVOKEVIRTUAL,
477: "weblogic/servlet/internal/session/SessionConfigManager",
478: "getCookiePath", "()Ljava/lang/String;");
479: mv.visitInsn(ARETURN);
480: Label l3 = new Label();
481: mv.visitLabel(l3);
482: mv.visitLocalVariable("this",
483: "Lweblogic/servlet/internal/WebAppServletContext;",
484: null, l0, l3, 0);
485: mv.visitMaxs(1, 1);
486: mv.visitEnd();
487: }
488:
489: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
490: private void addSessionCookieSecure() {
491: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
492: "__tc_session_getCookieSecure", "()Z", null, null);
493: mv.visitCode();
494: Label l0 = new Label();
495: mv.visitLabel(l0);
496: mv.visitLineNumber(147, l0);
497: mv.visitVarInsn(ALOAD, 0);
498: mv.visitMethodInsn(INVOKEVIRTUAL,
499: "weblogic/servlet/internal/WebAppServletContext",
500: "__tc_isWeblogic8", "()Z");
501: Label l1 = new Label();
502: mv.visitJumpInsn(IFEQ, l1);
503: Label l2 = new Label();
504: mv.visitLabel(l2);
505: mv.visitLineNumber(148, l2);
506: mv.visitVarInsn(ALOAD, 0);
507: mv.visitFieldInsn(GETFIELD,
508: "weblogic/servlet/internal/WebAppServletContext",
509: "sessionCookieSecure", "Z");
510: mv.visitInsn(IRETURN);
511: mv.visitLabel(l1);
512: mv.visitLineNumber(150, l1);
513: mv.visitVarInsn(ALOAD, 0);
514: mv.visitFieldInsn(GETFIELD,
515: "weblogic/servlet/internal/WebAppServletContext",
516: "sessionContext",
517: "Lweblogic/servlet/internal/session/SessionContext;");
518: mv
519: .visitMethodInsn(
520: INVOKEVIRTUAL,
521: "weblogic/servlet/internal/session/SessionContext",
522: "getConfigMgr",
523: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
524: mv
525: .visitMethodInsn(
526: INVOKEVIRTUAL,
527: "weblogic/servlet/internal/session/SessionConfigManager",
528: "isCookieSecure", "()Z");
529: mv.visitInsn(IRETURN);
530: Label l3 = new Label();
531: mv.visitLabel(l3);
532: mv.visitLocalVariable("this",
533: "Lweblogic/servlet/internal/WebAppServletContext;",
534: null, l0, l3, 0);
535: mv.visitMaxs(1, 1);
536: mv.visitEnd();
537: }
538:
539: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
540: private void addSessionCookieEnabled() {
541: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
542: "__tc_session_getCookiesEnabled", "()Z", null, null);
543: mv.visitCode();
544: Label l0 = new Label();
545: mv.visitLabel(l0);
546: mv.visitLineNumber(156, l0);
547: mv.visitVarInsn(ALOAD, 0);
548: mv.visitMethodInsn(INVOKEVIRTUAL,
549: "weblogic/servlet/internal/WebAppServletContext",
550: "__tc_isWeblogic8", "()Z");
551: Label l1 = new Label();
552: mv.visitJumpInsn(IFEQ, l1);
553: Label l2 = new Label();
554: mv.visitLabel(l2);
555: mv.visitLineNumber(157, l2);
556: mv.visitVarInsn(ALOAD, 0);
557: mv.visitFieldInsn(GETFIELD,
558: "weblogic/servlet/internal/WebAppServletContext",
559: "sessionCookiesEnabled", "Z");
560: mv.visitInsn(IRETURN);
561: mv.visitLabel(l1);
562: mv.visitLineNumber(159, l1);
563: mv.visitVarInsn(ALOAD, 0);
564: mv.visitFieldInsn(GETFIELD,
565: "weblogic/servlet/internal/WebAppServletContext",
566: "sessionContext",
567: "Lweblogic/servlet/internal/session/SessionContext;");
568: mv
569: .visitMethodInsn(
570: INVOKEVIRTUAL,
571: "weblogic/servlet/internal/session/SessionContext",
572: "getConfigMgr",
573: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
574: mv
575: .visitMethodInsn(
576: INVOKEVIRTUAL,
577: "weblogic/servlet/internal/session/SessionConfigManager",
578: "isSessionCookiesEnabled", "()Z");
579: mv.visitInsn(IRETURN);
580: Label l3 = new Label();
581: mv.visitLabel(l3);
582: mv.visitLocalVariable("this",
583: "Lweblogic/servlet/internal/WebAppServletContext;",
584: null, l0, l3, 0);
585: mv.visitMaxs(1, 1);
586: mv.visitEnd();
587: }
588:
589: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
590: private void addSessionIdLength() {
591: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
592: "__tc_session_getIdLength", "()I", null, null);
593: mv.visitCode();
594: Label l0 = new Label();
595: mv.visitLabel(l0);
596: mv.visitLineNumber(165, l0);
597: mv.visitVarInsn(ALOAD, 0);
598: mv.visitMethodInsn(INVOKEVIRTUAL,
599: "weblogic/servlet/internal/WebAppServletContext",
600: "__tc_isWeblogic8", "()Z");
601: Label l1 = new Label();
602: mv.visitJumpInsn(IFEQ, l1);
603: Label l2 = new Label();
604: mv.visitLabel(l2);
605: mv.visitLineNumber(166, l2);
606: mv.visitVarInsn(ALOAD, 0);
607: mv.visitFieldInsn(GETFIELD,
608: "weblogic/servlet/internal/WebAppServletContext",
609: "sessionIDLength", "I");
610: mv.visitInsn(IRETURN);
611: mv.visitLabel(l1);
612: mv.visitLineNumber(168, l1);
613: mv.visitVarInsn(ALOAD, 0);
614: mv.visitFieldInsn(GETFIELD,
615: "weblogic/servlet/internal/WebAppServletContext",
616: "sessionContext",
617: "Lweblogic/servlet/internal/session/SessionContext;");
618: mv
619: .visitMethodInsn(
620: INVOKEVIRTUAL,
621: "weblogic/servlet/internal/session/SessionContext",
622: "getConfigMgr",
623: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
624: mv
625: .visitMethodInsn(
626: INVOKEVIRTUAL,
627: "weblogic/servlet/internal/session/SessionConfigManager",
628: "getIDLength", "()I");
629: mv.visitInsn(IRETURN);
630: Label l3 = new Label();
631: mv.visitLabel(l3);
632: mv.visitLocalVariable("this",
633: "Lweblogic/servlet/internal/WebAppServletContext;",
634: null, l0, l3, 0);
635: mv.visitMaxs(1, 1);
636: mv.visitEnd();
637: }
638:
639: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
640: private void addServerId() {
641: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
642: "__tc_session_getServerId", "()Ljava/lang/String;",
643: null, null);
644: mv.visitCode();
645: Label l0 = new Label();
646: mv.visitLabel(l0);
647: mv.visitLineNumber(184, l0);
648: mv.visitVarInsn(ALOAD, 0);
649: mv.visitFieldInsn(GETFIELD,
650: "weblogic/servlet/internal/WebAppServletContext",
651: "httpServer", "Lweblogic/servlet/internal/HttpServer;");
652: mv.visitMethodInsn(INVOKEVIRTUAL,
653: "weblogic/servlet/internal/HttpServer",
654: "getServerHash", "()Ljava/lang/String;");
655: mv.visitInsn(ARETURN);
656: Label l1 = new Label();
657: mv.visitLabel(l1);
658: mv.visitLocalVariable("this",
659: "Lweblogic/servlet/internal/WebAppServletContext;",
660: null, l0, l1, 0);
661: mv.visitMaxs(1, 1);
662: mv.visitEnd();
663: }
664:
665: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
666: private void addSessionDelimiter() {
667: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
668: "__tc_session_getSessionDelimiter",
669: "()Ljava/lang/String;", null, null);
670: mv.visitCode();
671: Label l0 = new Label();
672: mv.visitLabel(l0);
673: mv.visitLineNumber(208, l0);
674: mv.visitLdcInsn("!");
675: mv.visitInsn(ARETURN);
676: Label l1 = new Label();
677: mv.visitLabel(l1);
678: mv.visitLocalVariable("this",
679: "Lweblogic/servlet/internal/WebAppServletContext;",
680: null, l0, l1, 0);
681: mv.visitMaxs(1, 1);
682: mv.visitEnd();
683: }
684:
685: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
686: private void addSessionTimeoutSeconds() {
687: MethodVisitor mv = cv
688: .visitMethod(ACC_PUBLIC,
689: "__tc_session_getSessionTimeoutSecs", "()I",
690: null, null);
691: mv.visitCode();
692: mv.visitVarInsn(ALOAD, 0);
693: mv.visitMethodInsn(INVOKEVIRTUAL,
694: "weblogic/servlet/internal/WebAppServletContext",
695: "__tc_isWeblogic8", "()Z");
696: Label wls92 = new Label();
697: mv.visitJumpInsn(IFEQ, wls92);
698: mv.visitVarInsn(ALOAD, 0);
699: mv.visitMethodInsn(INVOKEVIRTUAL,
700: "weblogic/servlet/internal/WebAppServletContext",
701: "getSessionTimeout", "()I");
702: mv.visitInsn(IRETURN);
703: mv.visitLabel(wls92);
704: mv.visitVarInsn(ALOAD, 0);
705: mv.visitFieldInsn(GETFIELD,
706: "weblogic/servlet/internal/WebAppServletContext",
707: "sessionContext",
708: "Lweblogic/servlet/internal/session/SessionContext;");
709: mv
710: .visitMethodInsn(
711: INVOKEVIRTUAL,
712: "weblogic/servlet/internal/session/SessionContext",
713: "getConfigMgr",
714: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
715: mv
716: .visitMethodInsn(
717: INVOKEVIRTUAL,
718: "weblogic/servlet/internal/session/SessionConfigManager",
719: "getSessionTimeoutSecs", "()I");
720: mv.visitInsn(IRETURN);
721: mv.visitMaxs(1, 1);
722: mv.visitEnd();
723: }
724:
725: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
726: private void addSessionTrackingEnabled() {
727: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
728: "__tc_session_getTrackingEnabled", "()Z", null, null);
729: mv.visitCode();
730: Label l0 = new Label();
731: mv.visitLabel(l0);
732: mv.visitLineNumber(189, l0);
733: mv.visitVarInsn(ALOAD, 0);
734: mv.visitMethodInsn(INVOKEVIRTUAL,
735: "weblogic/servlet/internal/WebAppServletContext",
736: "__tc_isWeblogic8", "()Z");
737: Label l1 = new Label();
738: mv.visitJumpInsn(IFEQ, l1);
739: Label l2 = new Label();
740: mv.visitLabel(l2);
741: mv.visitLineNumber(190, l2);
742: mv.visitVarInsn(ALOAD, 0);
743: mv.visitFieldInsn(GETFIELD,
744: "weblogic/servlet/internal/WebAppServletContext",
745: "sessionTrackingEnabled", "Z");
746: mv.visitInsn(IRETURN);
747: mv.visitLabel(l1);
748: mv.visitLineNumber(192, l1);
749: mv.visitVarInsn(ALOAD, 0);
750: mv.visitFieldInsn(GETFIELD,
751: "weblogic/servlet/internal/WebAppServletContext",
752: "sessionContext",
753: "Lweblogic/servlet/internal/session/SessionContext;");
754: mv
755: .visitMethodInsn(
756: INVOKEVIRTUAL,
757: "weblogic/servlet/internal/session/SessionContext",
758: "getConfigMgr",
759: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
760: mv
761: .visitMethodInsn(
762: INVOKEVIRTUAL,
763: "weblogic/servlet/internal/session/SessionConfigManager",
764: "isSessionTrackingEnabled", "()Z");
765: mv.visitInsn(IRETURN);
766: Label l3 = new Label();
767: mv.visitLabel(l3);
768: mv.visitLocalVariable("this",
769: "Lweblogic/servlet/internal/WebAppServletContext;",
770: null, l0, l3, 0);
771: mv.visitMaxs(1, 1);
772: mv.visitEnd();
773: }
774:
775: // see the dummy WebAppServletContext class in dso-weblogic-stubs for this method post-asm.
776: private void addSessionUrlRewritingEnabled() {
777: MethodVisitor mv = cv.visitMethod(ACC_PUBLIC,
778: "__tc_session_getURLRewritingEnabled", "()Z", null,
779: null);
780: mv.visitCode();
781: Label l0 = new Label();
782: mv.visitLabel(l0);
783: mv.visitLineNumber(198, l0);
784: mv.visitVarInsn(ALOAD, 0);
785: mv.visitMethodInsn(INVOKEVIRTUAL,
786: "weblogic/servlet/internal/WebAppServletContext",
787: "__tc_isWeblogic8", "()Z");
788: Label l1 = new Label();
789: mv.visitJumpInsn(IFEQ, l1);
790: Label l2 = new Label();
791: mv.visitLabel(l2);
792: mv.visitLineNumber(199, l2);
793: mv.visitVarInsn(ALOAD, 0);
794: mv.visitFieldInsn(GETFIELD,
795: "weblogic/servlet/internal/WebAppServletContext",
796: "sessionURLRewritingEnabled", "Z");
797: mv.visitInsn(IRETURN);
798: mv.visitLabel(l1);
799: mv.visitLineNumber(201, l1);
800: mv.visitVarInsn(ALOAD, 0);
801: mv.visitFieldInsn(GETFIELD,
802: "weblogic/servlet/internal/WebAppServletContext",
803: "sessionContext",
804: "Lweblogic/servlet/internal/session/SessionContext;");
805: mv
806: .visitMethodInsn(
807: INVOKEVIRTUAL,
808: "weblogic/servlet/internal/session/SessionContext",
809: "getConfigMgr",
810: "()Lweblogic/servlet/internal/session/SessionConfigManager;");
811: mv
812: .visitMethodInsn(
813: INVOKEVIRTUAL,
814: "weblogic/servlet/internal/session/SessionConfigManager",
815: "isUrlRewritingEnabled", "()Z");
816: mv.visitInsn(IRETURN);
817: Label l3 = new Label();
818: mv.visitLabel(l3);
819: mv.visitLocalVariable("this",
820: "Lweblogic/servlet/internal/WebAppServletContext;",
821: null, l0, l3, 0);
822: mv.visitMaxs(1, 1);
823: mv.visitEnd();
824: }
825: }
|