Hi, 

thanks for the explanation.
Can you also please answer to these questions :

- When you have your web app running in Tomcat, what is the value of a url
pattern for CXFServlet ?
- Do requests like
http://localhost:9000/main/index/Application_en-US.properties work properly
in Tomcat ? 
- Does it all work if you put serveHTML() before JaxrsServer is created ?
- What is the layout of your web application ?

By the way, why do you prefer using Jetty instead of Tomcat, given that you
see all working on Tomcat ?

cheers, Sergey



Sam.Wang wrote:
> 
> Hello Sergey:
> 
> Thanks for your reply.
> Ok, let's introduce my project.
> 
> Before I do some research of JAX-RS, I was working on using
> EXTJS+Struts2+CXF(JAX-WS) structure to implement my web application. It
> worked fine, but as you know, there are two web containers in my project,
> the Struts2 is working on Tomcat web server and CXF runtime is running at
> another server which using Jetty to publish web services.
> 
> So I came to here and researched other plans to reduce my structure,
> luckily I found the JAX-RS. I guess it can help me to remove the Struts2
> layer, only ExtJS+CXF(JAX-RS) structure and using JSon+REST. I look simply
> and easily to develop and deploy. 
> 
> And now, I created a demo for testing it(a lot of code come from CXF
> Demos).  but look I said, the properties file can't be access, other files
> work fine. So I guess maybe it is a configuration issue.
> 
> Abou the serverHTML(), I am pleasure to explain it.(you also can get it
> form 
> http://mail-archives.apache.org/mod_mbox/cxf-users/200807.mbox/%[email protected]%3e
> here  )
> 
> ------------------ServerHTML------------------
> 
>       private static void serveHTML() throws Exception {
>               Bus bus = BusFactory.getDefaultBus();
>               ServerRegistry sr = bus.getExtension(ServerRegistry.class);
>               JettyHTTPServerEngineFactory jhsef =
> bus.getExtension(JettyHTTPServerEngineFactory.class);
>               
>                 // here is get the CustomerService service.(The length of
> "sr.getServers()" is 1, only one server be deployed.)
>                 ServerImpl si = (ServerImpl) sr.getServers().get(0);
>               JettyHTTPDestination jhd = (JettyHTTPDestination) 
> si.getDestination();
>               JettyHTTPServerEngine engine = (JettyHTTPServerEngine) 
> jhd.getEngine();
>               org.mortbay.jetty.Server server = engine.getServer();
>               Handler serverHandler = server.getHandler();
>               ContextHandlerCollection contextHandlerCollection =
> (ContextHandlerCollection) serverHandler;
>               HandlerList handlerList = new HandlerList();
>               ResourceHandler resourceHandler = new ResourceHandler();
>                 // add my customized resource handler.
>               handlerList.addHandler(resourceHandler);
>               handlerList.addHandler(contextHandlerCollection);
>               server.setHandler(handlerList);
>               handlerList.start();
>                 // set path for the customized resource.
>               resourceHandler.setResourceBase("./WebContent");
>       }
> 
> -----------------------------------------------
> 
> Thanks so much.
> 
> 
> Sergey Beryozkin wrote:
>> 
>> Hi
>> 
>> It appears when the server is running in a standalone mode the JAX-RS
>> runtime attempts to handle static content requests like
>> http://localhost:9000/main/index/Application_en-US.properties
>> 
>> Can you provide some more information please.
>> When you have your web app running in Tomcat, what is the value of a url
>> pattern for CXFServlet ?
>> Do requests like
>> http://localhost:9000/main/index/Application_en-US.properties work
>> properly in Tomcat ? 
>> 
>> Also, I'm not quite following what is being done in  serveHTML(); Can you
>> explain ? May be also outline the structure of your web app... 
>> I'm wondering, does it have to be done before the JAXRSServer is created
>> ? 
>>  
>> thanks, Sergey
>> 
>> 
>> Sam.Wang wrote:
>>> 
>>> Hello everyone, I have an issue about the static file mapping.
>>> 
>>> The Application_**.properties can't be found in our demo. but it works
>>> well when I bring it out into tomcat.
>>> 
>>> 2009-8-7 13:59:08 org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor
>>> processRequest
>>> Warning: .No root resource matching request path
>>> /main/index/Application_en-US.properties is found.
>>> 2009-8-7 13:59:08
>>> org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
>>> Warning: WebApplicationException has been caught : no cause is available
>>> 
>>> following is my demo code.
>>> 
>>> public class JAXRSServer {
>>> 
>>>     protected JAXRSServer() throws Exception {
>>>             JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>>>             sf.setResourceClasses(CustomerService.class);
>>>             //sf.setResourceProvider(CustomerService.class, new
>>> SingletonResourceProvider(new CustomerService()));
>>>             sf.setAddress("http://localhost:9000/";);
>>> 
>>>             sf.create();
>>>     }
>>> 
>>>     public static void main(String args[]) throws Exception {
>>>             new JAXRSServer();
>>>             serveHTML();
>>>             System.out.println("Server ready...");
>>> 
>>>             Thread.sleep(5 * 600 * 1000);
>>>             System.out.println("Server exiting");
>>>             System.exit(0);
>>>     }
>>> 
>>>     private static void serveHTML() throws Exception {
>>>             Bus bus = BusFactory.getDefaultBus();
>>>             ServerRegistry sr = bus.getExtension(ServerRegistry.class);
>>>             JettyHTTPServerEngineFactory jhsef =
>>> bus.getExtension(JettyHTTPServerEngineFactory.class);
>>>             ServerImpl si = (ServerImpl) sr.getServers().get(0);
>>>             JettyHTTPDestination jhd = (JettyHTTPDestination) 
>>> si.getDestination();
>>>             JettyHTTPServerEngine engine = (JettyHTTPServerEngine)
>>> jhd.getEngine();
>>>             org.mortbay.jetty.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("./WebContent");
>>>     }
>>> 
>>> can everyone give me some suggestion?
>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/static-properties-file-can%27t-be-found-in-JAXRSInInterceptor-tp24859608p24913501.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to