FileDocCategorySizeDatePackage
Deblink.javaAPI DocExample1215Tue Jan 25 10:45:14 GMT 2000None

Deblink.java

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

import com.oroinc.text.perl.*;  // PerlTools package

public class Deblink extends HttpServlet {

  Perl5Util perl = new Perl5Util();

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

    String contentType = req.getContentType();  // get the incoming type
    if (contentType == null) return;  // nothing incoming, nothing to do
    res.setContentType(contentType);  // set outgoing type to be incoming type

    PrintWriter out = res.getWriter();

    BufferedReader in = req.getReader();

    try {
      String line = null;
      while ((line = in.readLine()) != null) {
        if (perl.match("#</?blink>#i", line))
          line = perl.substitute("s#</?blink>##ig", line);
        out.println(line);
      }
    }
    catch(MalformedPerl5PatternException e) { // only thrown during development
      log("Problem compiling a regular expression: " + e.getMessage());
    }
  }

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