Closed cergfix closed 9 years ago
Hi,
Using the core client, you may have to implement the org.jfastcgi.api.RequestAdapter and ResponseAdapter interfaces, and provide instances of those classes to a FastCGIHandler.
I assume that you can use the MockHttpServletRequest/MockHttpServletResponse classes from the spring-test package, and use the servlet component :
//create a handler
FastCGIHandler handler = new FastCGIHandler();
handler.setConnectionFactory(new SingleConnectionFactory("tcp://localhost:9000"));
//create and configure some request/response
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
request.setRequestURI("/page.php");
//call the fastcgi service
handler.service(new ServletRequestAdapter(request.getServletContext(), request), new ServletResponseAdapter(response));
//get the result
int status = response.getStatus();
System.out.println(status);
String content = response.getContentAsString();
System.out.println(content);
Hello,
Are there any simple code examples on how to use the "core" client to connect to the FastCGI service?