1 4 package gnu.kawa.servlet; 5 import gnu.lists.*; 6 import gnu.mapping.*; 7 import gnu.bytecode.*; 8 import gnu.expr.*; 9 10 11 12 public class GetResponse extends MethodProc implements Inlineable 13 { 14 public static final GetResponse getResponse = new GetResponse(); 15 16 public static javax.servlet.http.HttpServletResponse getResponse(CallContext ctx) 17 { 18 return ((ServletCallContext) ctx).response; 19 } 20 21 public int numArgs() { return 0; } 22 23 public void apply (CallContext ctx) 24 { 25 ctx.lastArg(); 26 ctx.consumer.writeObject(((ServletCallContext) ctx).response); 27 } 28 29 public void compile (ApplyExp exp, Compilation comp, Target target) 30 { 31 Expression[] args = exp.getArgs(); 32 if (args.length != 0 || ! comp.curLambda.isHandlingTailCalls()) 33 { 34 ApplyExp.compile(exp, comp, target); 35 return; 36 } 37 38 CodeAttr code = comp.getCode(); 39 comp.loadCallContext(); 40 code.emitInvokeStatic(typeGetResponse.getDeclaredMethod("getResponse", 1)); 41 target.compileFromStack(comp, typeHttpServletResponse); 42 } 43 44 public Type getReturnType (Expression[] args) 45 { 46 return typeHttpServletResponse; 47 } 48 49 public static final ClassType typeGetResponse 50 = ClassType.make("gnu.kawa.servlet.GetResponse"); 51 52 public static final ClassType typeHttpServletResponse 53 = ClassType.make("javax.servlet.http.HttpServletResponse"); 54 } 55 | Popular Tags |