Hi Teemu
I unfortunately don't think you will get any answer to your question. If
you look a few days/weeks back (31. January), you will notice that I
asked the same question and didn't get an answer either, I however want
to enable for extensions using Jetty as the web server.
Lars
On 15-02-2011 19:31, teemu kanstren 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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]