Hi jason,
thanks for the response,
I've ignored the content stuff by just commenting it. Still I have a problem.
Pls see that after the control enters into the while loop the readline fetches
only null and hence the whole code doesnt work but hangs and afer some time it
says 500 internal error (Request timed out).
Pls also note that i havent done any mistake with the HTML file or configuration
with JWS.
And whenever i open the html file blinky.html Deblink is automatically activated
which iam able to check by giving System.out.println("Deblink working") at the
begining. I use JWS and i get the msg in the console of the JWS.

Hope iam clear. Expecting ur reply,
Srinivasan.R
MayFair Center,
Satyam Infoway Ltd,
Secunderabad





R Srinivasan
12/14/99 03:37 AM

To:   [EMAIL PROTECTED]
cc:

Subject:  Servlet Chaining - returns Null content type  (Document link not
      converted)


Hi all,
Iam just trying out some examples in jason hunterz.
As a typical example, iam running the following program which will remove all
blinks from any html page displayed.
Iam using jws 2.0 running in win nt

The program is this
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Deblink extends HttpServlet{

     public void doGet(HttpServletRequest req, HttpServletResponse res)
          throws ServletException,IOException{

          System.out.println("Deblink Started:);
          String contentType = req.getContentType();
          System.out.println("Content type is " + contentType); // juss to test
things out
          if(contentType == null) return;
          res.setContentType(contentType);

          PrintWriter out = res.getWriter();
          BufferedReader in = req.getReader();
          String line = null;
          while((line = in.readLine()) != null){
               System.out.println("entered loop");
               line=replace(line,"<BLINK>","");
               line=replace(line,"</BLINK>","");
               out.println(line);
          }
     }

     public void doPost(HttpServletRequest req, HttpServletResponse res)
          throws ServletException,IOException{

          doGet(req,res);

     }

     private String replace(String line, String oldString, String newString){
          int index = 0;
          while((index = line.indexOf(oldString,index))>=0){
               //Replace old string with the new string (inefficiently)
               line = line.substring(0,index)+
               newString + line.substring(index+oldString.length());

               index = index + newString.length();
          }
          return line;


     }
}

which naturally should remove all blinks in all html pages. I've made necessary
changes into jws config to make Deblink servlet to run whenever an html is
requested.

But all i get is null content type and the whole document is null, which i found
out by just adding System.out.println("Content type is " + contentType);

Just tried my best, but cudnt come with an answer. Can somebody help?

Srinivasan.R
Satyam Infoway Ltd.,
May Fair Center,
Secunderabad

___________________________________________________________________________
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

Reply via email to