Search squid archive

RE: url_rewrite_program in Java

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx] 
Sent: Thursday, January 14, 2010 5:08 PM
To: squid-users@xxxxxxxxxxxxxxx
Subject: Re:  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@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxx>


[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux