KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > facelets > compiler > LiteralXMLInstruction


1 package com.sun.facelets.compiler;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.el.ELContext;
6 import javax.el.ExpressionFactory;
7 import javax.faces.context.FacesContext;
8 import javax.faces.context.ResponseWriter;
9
10 final class LiteralXMLInstruction implements Instruction {
11
12     private final static char[] STOP = new char[0];
13     
14     private final char[] instruction;
15     private final int len;
16     
17     public LiteralXMLInstruction(String JavaDoc literal) {
18         this.instruction = literal.toCharArray();
19         this.len = this.instruction.length;
20     }
21
22     public void write(FacesContext context) throws IOException JavaDoc {
23         ResponseWriter rw = context.getResponseWriter();
24         rw.writeText(STOP, 0, 0); // hack to get closing elements
25
rw.write(this.instruction, 0, this.len);
26     }
27
28     public Instruction apply(ExpressionFactory factory, ELContext ctx) {
29         return this;
30     }
31
32     public boolean isLiteral() {
33         return true;
34     }
35
36 }
37
Popular Tags