Hello Sergey: Thanks for your reply! I change the order of questions and try to answer.
1. What is the layout of your web application ? -My project is split three parts, the first is the CXF(JAX-WS-Server) server and all business logic be implemented it. The CXF server is responsible for create/publish web service via Jetty, these services are used by Client part. -The Client part is implemented via MS WPF, it call those webserivces to execute some business logic. -And I have a web application, just we talked in this thread. This web application only does some configured logic and no complex operations, it is a configuration system and be implemented via EXTJS(A Rich Ajax Web Framework). It works on tomcat, uses the CXF(JAX-WS-Client) to call webservices. -My purpose is deploy this web application to Jetty, and use REST style to develop. That is the reason why I want to reduce Struts layer. 2. When you have your web app running in Tomcat, what is the value of a url pattern for CXFServlet ? - Actually, I don't understand this question. Perhaps I did not say clearly, sorry. 3. Do requests like http://localhost:9000/main/index/Application_en-US.properties work properly in Tomcat ? - Yes, it works properly. I have found the reason why It can't be found when it be deploy in Jetty. It's my mistake, I used the "PUT" method to request it before. 4. Does it all work if you put serveHTML() before JaxrsServer is created ? - Yes, all is worked in my demo project. 5. By the way, why do you prefer using Jetty instead of Tomcat, given that you see all working on Tomcat ? - In tomcat, except Struts servlet, I have not use any special technology, even the JSP. This web application only contains HTML, CSS, JS files. So I want to use the ExtJS+CXF(JAX-RS-JSON)<REST Style> to implement this web application. Sergey, do you have any good ideas for implementing the web application? Or some wrong ideas or bad design in there? Thanks! By Sam Sergey Beryozkin wrote: > > 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-tp24859608p24915136.html Sent from the cxf-user mailing list archive at Nabble.com.
