Slots Source Code
<< Slots Central
SlotWrapper.java
package com.felstar.slots;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
/**
*
* @author Default
*/
public class SlotWrapper extends HttpServletResponseWrapper{
public SlotWrapper(HttpServletResponse response) {
super(response);
}
protected StringWriter stringWriter=new StringWriter()
{
};
protected ServletOutputStream myServletOutputStream=new ServletOutputStream()
{
public void write(int c)
{
stringWriter.write(c);
};
public void close()
{
// super.close();
}
};
protected PrintWriter myPrintWriter=new PrintWriter(stringWriter)
{
public void close()
{
// super.close();
}
};
public String include(HttpServletRequest request,String path) throws ServletException,IOException
{
RequestDispatcher disp=request.getRequestDispatcher(path);
disp.include(request,this);
String st=getString();
clear();
return st;
}
public String getString()
{
return stringWriter.toString();
}
public void clear()
{
stringWriter.getBuffer().setLength(0);
}
public PrintWriter getWriter() throws IOException {
return myPrintWriter;
}
// resin 2.x calls getOutputStream, resin 3.x and tomcat 5.x call getWriter()
public ServletOutputStream getOutputStream()
throws java.io.IOException
{
return myServletOutputStream;
}
}
<< Slots Central
<< Software Reality Front Page
|