RE: [squid-users] url_rewrite_program in Java

From: Lu, Roy <rlu_at_FACorelogic.com>
Date: Fri, 15 Jan 2010 09:22:24 -0800

That was the idea though. The perl version of the same code below works:

------------------------------------------
Squid.conf:
url_rewrite_program /usr/local/squid/sbin/RewriteHelper.pl
------------------------------------------

RewriteHelper.pl

#!/usr/bin/perl

$| = 1;

while (<>) {
    chomp;

    print STDERR "received input: $_\n";

    print "$_\n";

}
------------------------------------------

-----Original Message-----
From: David Brown [mailto:david_at_davidwbrown.name]
Sent: Thursday, January 14, 2010 5:08 PM
To: squid-users_at_squid-cache.org
Subject: Re: [squid-users] url_rewrite_program in Java

I'm no Java expert but isn't your readline hanging the process by
waiting for input followed by a carriage return/linefeed sequence?

On Thu, 14 Jan 2010 15:00:35 -0800
"Lu, Roy" <rlu_at_FACorelogic.com> wrote:

> Does anyone have an example of a url rewrite program in Java. I tried
> with the following code but it did not work.
>
> ----------------------------
> Squid.conf:
> url_rewrite_program /usr/bin/java -classpath /usr/local/squid/sbin
> RewriteHelper
> ----------------------------
> RewriteHelper.java:
>
> import java.io.*;
>
> public class RewriteHelper {
>
> public static void main(String[] args) throws Throwable {
> try {
> BufferedReader in = new BufferedReader(new
> InputStreamReader(System.in));
> String input;
>
> while(true) {
> input = in.readLine();
> System.out.println(input);
> }
>
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> ----------------------------
> It seems that Squid only regards 'java' as the rewrite program, not
the
> entire command with the java class, i.e., '/usr/bin/java -classpath
> /usr/local/squid/sbin RewriteHelper'.
>
> Thanks.
> Roy
>
>
************************************************************************
******************
> This message may contain confidential or proprietary information
intended only for the use of the
> addressee(s) named above or may contain information that is legally
privileged. If you are
> not the intended addressee, or the person responsible for delivering
it to the intended addressee,
> you are hereby notified that reading, disseminating, distributing or
copying this message is strictly
> prohibited. If you have received this message by mistake, please
immediately notify us by
> replying to the message and delete the original message and any copies
immediately thereafter.
>
> Thank you.
>
************************************************************************
******************
> FACLD
>

-- 
David Brown <david_at_davidwbrown.name>
Received on Fri Jan 15 2010 - 17:22:35 MST

This archive was generated by hypermail 2.2.0 : Fri Jan 15 2010 - 12:00:03 MST