Hi Marcus,

It should work. Here is a unit test[1][2] which shows how to set the resource handler to the jetty engine.
[1]https://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
[2]https://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java

Willem

Marcus Redeker wrote:
Hi Glen,

Thanks for looking at this. When I use Spring the ResourceHandler objekt is
created correct from spring and also the setResourceBase() method is called
with correct string. It seems the the <httpj:handlers> tag is not evaluated
correct because the jetty logging does not say that another handler is
registered.

The java code works fine. It does not matter if I create an extra variable
or path the string by itself. I don't want to use the java code anyway.

To avaoid problems with the seperator I am already using the forward slash.
That no problem and works.

Any idea why the <httpj:handlers> tag might not work?

--Marcus


-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von
Glen Mazza
Gesendet: Sonntag, 20. Juli 2008 15:42
An: [email protected]
Betreff: Re: Configure jetty to use static content


Isn't the file divider "\" in Windows--that may be part of the problem.

Also, some debugging appears needed here, from both ends.  Perhaps you
should System.out.println() what you are passing in via Spring as the
resourceBase value--first confirm that indeed the Java code is getting the
"d:/temp/" from the config file.  Next, factor out that hardcoded "d:/temp/"
from your Java code into a String variable and then
setResourceBase(myNewVar) --> does that work?

Glen


Marcus Redeker wrote:
All,

I am trying to use the spring configuration to added a ResourceHandler for static content to jetty.
It does not work when I use the following spring configuration:

========== Spring config ================
  <httpj:engine-factory bus="cxf">
    <httpj:engine port="9000">
      <httpj:handlers>
        <bean class="org.mortbay.jetty.handler.ResourceHandler">
                <property
name="resourceBase"><value>d:/temp/</value></property>
</bean> </httpj:handlers>
    </httpj:engine>
  </httpj:engine-factory>
=========================

But when I use the following java code it does work:

=========== Java code ========================== Bus bus = (Bus)ctx.getBean("cxf"); ServerRegistry sr= bus.getExtension(ServerRegistry.class); ServerImpl si = (ServerImpl) sr.getServers().get(0); JettyHTTPDestination jhd = (JettyHTTPDestination)si.getDestination(); JettyHTTPServerEngine engine = (JettyHTTPServerEngine) jhd.getEngine(); Server server = engine.getServer(); Handler serverHandler = server.getHandler(); ContextHandlerCollection contextHandlerCollection = (ContextHandlerCollection)serverHandler; HandlerList handlerList = new HandlerList(); ResourceHandler resourceHandler = new ResourceHandler(); handlerList.addHandler(resourceHandler);
handlerList.addHandler(contextHandlerCollection);
server.setHandler(handlerList);
handlerList.start();
resourceHandler.setResourceBase("d:/temp/");
========================================

Can you guys help me? I would like to only use spring config and not have to have the extra java code.

Thanks,

Marcus




--
View this message in context:
http://www.nabble.com/Configure-jetty-to-use-static-content-tp18554067p18554
593.html
Sent from the cxf-user mailing list archive at Nabble.com.




Reply via email to