My resource class:
@Path("/hello")
public class Helloworld{
@GET
public void sayHello()
{
System.out.println("hello world");
}
}
and my context root is testproject.
Totally I have written
1. Resource class (Helloworld)
2. MyRest class which extends Application.
3. web.xml
4. placed necessary jars in lib folder.
I do not mention any CXF uri pattern.
The pattern contributes to the CXF endpoint address, is it "/*" ? if Yes it has to work.
If it is "/somevalue/*" then you need to do
http://localhost:8080/testproject/somevalue/hello
cheers, Sergey
I accessed the uri as http://localhost:8080/testproject/hello.
But I cannot access the Rest resources.
Is there any other files to be configured?
Please suggest me.
Regards
Saravanan Ramamoorthy
Sergey Beryozkin-2 wrote:
Hi
Hi Sergey,
I have written a class that extends Application and registers all the
resource service class.
Here is my class:
public class MyRest extends Application{
@Override
public Set<Class<?>> getClasses() {
// TODO Auto-generated method stub
Set<Class<?>> s = new HashSet<Class<?>>();
s.add(Helloworld.class);
return s;
}
and my web.xml is:
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.test.MyRest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
When I start the server , it says
Setting the server's publish address to be /
I cannot able to find the endpoint.
(http://localhost:8080/contextroot/pathname)It always says 404 not found.
Is there anything I have missed out.
What is the value of the CXFServlet uri ? What is the root @Path of
Helloworld.class ? Ex, if you have a 'contextroot', CXF uri
pattern equal to "/services" and @Path starting from "/hello" then it
should be (http://localhost:8080/contextroot/services/hello,
etc... 404 may also be returned if the resource class has been selected
but no matching method has been found...It all should be
logged
cheers, Sergey
Please suggest me.
Regards
Saravanan R
Sergey Beryozkin-2 wrote:
Hi
Please try CXFJaxrsNonSpringServlet :
http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-ConfiguringJAXRSservicesincontainerwithoutSpring
cheers, Sergey
Hi Experts,
Could anyone please explain how to publish JAX RS endpoint using cxf
without
spring.
I can able to run the application using JAXRSServerFactoryBean using
cxf
in
java.
Please suggest me when deploying as a war file , how to publish these
JAX-RS
files when load on start up.
Regards
Saravanan Ramamoorthy
--
View this message in context:
http://old.nabble.com/JAX-RS---how-to-publish-endpoint-using-cxf-tp27334669p27334669.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
View this message in context:
http://old.nabble.com/JAX-RS---how-to-publish-endpoint-using-cxf-tp27334669p27340855.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
View this message in context:
http://old.nabble.com/JAX-RS---how-to-publish-endpoint-using-cxf-tp27334669p27341326.html
Sent from the cxf-user mailing list archive at Nabble.com.