Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 44214 invoked from network); 10 Jun 2004 18:45:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 10 Jun 2004 18:45:11 -0000 Received: (qmail 9543 invoked by uid 500); 10 Jun 2004 18:44:51 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 9355 invoked by uid 500); 10 Jun 2004 18:44:49 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 9228 invoked by uid 99); 10 Jun 2004 18:44:48 -0000 Received: from [208.42.156.2] (HELO conn.mc.mpls.visi.com) (208.42.156.2) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 10 Jun 2004 11:44:48 -0700 Received: from mahes.visi.com (mahes-int.visi.com [208.42.77.150]) by conn.mc.mpls.visi.com (Postfix) with ESMTP id 9AB7A813C for ; Thu, 10 Jun 2004 13:44:26 -0500 (CDT) Received: from mahes.visi.com (localhost [127.0.0.1]) by mahes.visi.com (8.12.9/8.12.5) with ESMTP id i5AIiQYF037232 for ; Thu, 10 Jun 2004 13:44:26 -0500 (CDT) (envelope-from hoju@visi.com) Received: (from www@localhost) by mahes.visi.com (8.12.9/8.12.5/Submit) id i5AIiQeY037231 for tomcat-user@jakarta.apache.org; Thu, 10 Jun 2004 18:44:26 GMT X-Authentication-Warning: mahes.visi.com: www set sender to hoju@visi.com using -f Received: from simnatfw1.thehartford.com (simnatfw1.thehartford.com [162.136.193.1]) by my.visi.com (IMP) with HTTP for ; Thu, 10 Jun 2004 18:44:26 +0000 Message-ID: <1086893066.40c8ac0a3a8cc@my.visi.com> Date: Thu, 10 Jun 2004 18:44:26 +0000 From: Jacob Kjome To: Tomcat Users List Subject: Re: 2nd inquiry: how to - programmatically - authenticate oneself as Tomcat manager? References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) 4.0-cvs X-Originating-IP: 162.136.193.1 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Quoting Bill Barker : > 1) Assuming boring system encodings, and something to do Base64 encoding: > String creds = username+":"+password; > String b64creds = Base64Util.encode(creds.getBytes()); > tmc.addRequestProperty("Authorization","Basic "+b64creds); > > 2) Not with Basic. You might be able to rig something with Form. > That's not true. You can do: http://username:password@www.mysite.com/ so: URL tomcatMgr = new URL("http://manager:mypassword@localhost:8080/manager/undeploy?path=/any"); Jake > > "Jerry Miernik" wrote in message > news:F67EB38120F7BB4BB972C786095802072B5690@ipcbu-exchange.amer.unity.cisco.com... > The question is related to undeploying a webapplication > from a Java code. A connection to tomcat manager using > .... > URL tomcatMgr = > new URL("http://localhost:8080/manager/undeploy?path=/any"); > URLConnection tmc = tomcatMgr.openConnection(); > .... > > results in: > java.io.IOException:Server returned HTTP response code: 401 > > The questions: > 1. Is there a way to deliver - programmatically - username > and password for the undeploy to take effect? > > 2. Could the username and password be parameters in the > undeploy request? Or an earlier request? > > 3. This Java program is trying to undeploy itself, inside > a jspInit() method. Is this technically possible? > (do not see why not, except for the problem with user > name and password). > > Thanks, > Jerry. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org