Return-Path: X-Original-To: apmail-ws-dev-archive@www.apache.org Delivered-To: apmail-ws-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 695809359 for ; Thu, 1 Dec 2011 00:40:00 +0000 (UTC) Received: (qmail 4569 invoked by uid 500); 1 Dec 2011 00:39:59 -0000 Delivered-To: apmail-ws-dev-archive@ws.apache.org Received: (qmail 4433 invoked by uid 500); 1 Dec 2011 00:39:59 -0000 Mailing-List: contact dev-help@ws.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ws.apache.org Delivered-To: mailing list dev@ws.apache.org Received: (qmail 4426 invoked by uid 500); 1 Dec 2011 00:39:59 -0000 Delivered-To: apmail-ws-xmlrpc-dev@ws.apache.org Received: (qmail 4423 invoked by uid 99); 1 Dec 2011 00:39:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Dec 2011 00:39:59 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Dec 2011 00:39:54 +0000 Received: from isper.nabble.com ([192.168.236.156]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1RVugX-0007DL-Sl for xmlrpc-dev@ws.apache.org; Wed, 30 Nov 2011 16:39:33 -0800 Message-ID: <32887079.post@talk.nabble.com> Date: Wed, 30 Nov 2011 16:39:33 -0800 (PST) From: Aymac To: xmlrpc-dev@ws.apache.org Subject: Re: ServletWebServer + enabledForExtensions In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: andrew.macdonald@gmail.com References: I don't suppose you ever found a good solution to this problem? I've been trying to resolve the exact same problem as you describe here. Exceptions are being thrown because extensions are not enabled; even though, the config I set does. I've been digging through code as well. I found one place where it calls a newConifg() method, which just creates a config object and extensions are disabled. I'm calling setConfig() everywhere I can find, but they don't appear to get used. I may have to start looking a little more closely at the code to figure this one out, which I was hoping to not have to do. Doing all of this, just to get the client's IP address. Andrew teemu wrote: > > Hello all, > > I have been using Apache XMLRPC with extensions enabled with the > WebServer > class successfully. However, now I had the need to access also the client > IP > address that is making the request to the server. So according to the > instructions on the project web site, I switched to the ServletWebServer. > As > an end result, I manage to access the caller IP address just fine. > However, > I have problems getting ServletWebServer to work with extensions enabled. > > I tried this > > ServletWebServer webServer = new ServletWebServer(new > MyXmlRpcServlet(myPropertyHandlerMapping), port); > webServer.getConfig().setEnabledForExtensions(true); > webServer.start(); > > which used to work with WebServer but not with ServletWebServer. I get > exceptions in my code complaining that the features I use require enabling > the extensions. I thought this should work according to the docs, but > since > it did not, I went with plenty of other attempts including > > -creating a new config object, setting enabledForExtension to true, and > setting this to the server instead of querying the existing one > -modifying the doPost() method of my MyXmlRpcServlet that extends > XmlRpcServlet to always call getXmlRpcServer.getConfig() and setting > enabledForExtension, also the set method above for this > -always creating a new XmlRpcHandlerMapping or caching one in the servlet, > because I thought originally I had a problem with some inputstreams being > used many times (lost the actual exception first) > -various other approach I forget > > None of those worked for me. I always get the exception that the > extensions > are not enabled. > > Then I downloaded the source codes, and tried my best to understand what > is > happening. But all the modules are split and I failed to configure my IDE > to > properly access all methods across modules. Well, putting my Maven issues > aside I then tried to understand where the enabledForExtensions should be > enabled. I ended up somewhere in the XmlRpcWriter class (from my stack > traces), where I got totally confused about all the different > configuration > objects all having the enabledForExtensions flag inside them. One is a > class > level object accessed in writeValue() and another one is passed as a > parameter to write() that calls writeValue(). Similarly other types seemed > to be spread in the code. Eventually I gave up trying to understand this > and > just put in some prints to show what the values are. Both the > configurations > in XmlRpcWriter were always false for enabling extensions in all the > approaches I used. So I never really figured out how I should set this > flag > to actually get it enabled with the ServletWebServer. > > I did notice that there is only one place where the configuration value > for > enabledForExtension is accessed, and that is in the XmlRpcConfigImpl > class, > which all the rest of the config classes seem to extend. So I changed this > to always return true for extensions and recompiled it all. Using this new > version I got my code to work. But I would like to implement this properly > rather than have to recompile my own binaries for the library. > > I am sure I missed something obvious, so perhaps someone could tell me how > the extension value/configuration object traverses the code base and how > should I set it to get it used? > > Thanks, > Teemu > > -- View this message in context: http://old.nabble.com/ServletWebServer-%2B-enabledForExtensions-tp30933900p32887079.html Sent from the Apache Xml-RPC - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org For additional commands, e-mail: dev-help@ws.apache.org