io.soluble.pjb.servlet.VoidInputHttpServletRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of php-java-bridge Show documentation
Show all versions of php-java-bridge Show documentation
PHPJavaBridge server (soluble fork)
/**
*
*/
package io.soluble.pjb.servlet;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
/**
* A simple HTTP servlet request which is not connected to any input stream.
*
* @author jostb
*/
public class VoidInputHttpServletRequest extends HttpServletRequestWrapper {
public VoidInputHttpServletRequest(HttpServletRequest req) {
super(req);
}
private ServletInputStream in = null;
public ServletInputStream getInputStream() {
if (in != null) return in;
return in = new ServletInputStream() {
public int read() throws IOException {
return -1;
}
};
}
private BufferedReader reader = null;
public BufferedReader getReaader() {
if (reader != null) return reader;
return reader = new BufferedReader(new InputStreamReader(getInputStream()));
}
}