Hi,
We are experiencing a problem for jsp execution when we use response filter
for processing text/html MIME type request before responses are sent to the
client.
Underneath code for two sample html and jsp files are given. 'sample.jsp'
page uses
response.sendRedirect() method for invoking 'Test.html' page which
ultimately
renders data on the clients machine.
If I access sample.jsp without setting MIME type response filter, everything
works properly (I get proper output on client). But if I set MIME type
filter for filtering text/html responses, it displays "This document has
been moved to http://localhost/test.html" on the console but displays "Page
cannot be displayed" on the client browser.
Code for the servlet file which we have used for text/html MIME
Type mapping is also given. I hope these sample files will help you for
understanding
the problem.
Can you please help us for solving this problem by giving appropriate
solution ASAP.
Setup details - JavaWebServer 2.0 with JDK 1.2.2, Windows 9x/NT/2000
Thanks,
Akshay
////////////////////////////////////////////////////////
// TestServlet.java
////////////////////////////////////////////////////////
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.net.*;
import java.util.*;
public class TestServlet extends HttpServlet {
public TestServlet() {
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
try{
PrintWriter output = res.getWriter();
BufferedReader input = req.getReader();
System.out.println("T E S T C O N V E R T E R S E R V L E
T");
System.out.println("###########################################");
String line = null;
do{
System.out.println("while condition");
System.out.println(line);
if (line !=null)
{
output.println(line);
}
System.out.println("after
println>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.");
} while (((line = input.readLine()) != null) );
System.out.println("B4 flush................");
output.flush();
System.out.print("\n");
System.out.println("just outside while");
}catch(Exception except) {
System.out.println("CATCH!!!"+except.getMessage());
}
System.out.println("abt to return");
return;
}
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doGet(req, res);
return;
}
}
////////////////////////////////////////////////////////
// sample.jsp
////////////////////////////////////////////////////////
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<form name=frm2>
<input type=text name="dkfjdkjf" value="dkfjdf">
</form>
<%
response.sendRedirect("http://localhost:8080/test.html");
%>
</BODY>
</HTML>
////////////////////////////////////////////////////////
// test.html
////////////////////////////////////////////////////////
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
Hello there!!! This is a test
</BODY>
</HTML>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html