Posts

Showing posts from March, 2021

JAXRS-JSON OR XML

  @GET @Path ( "/allMessages" ) public Response getMessages () { return Response .status( Response . Status . OK ) . entity ( messageService . getAllMessages ()) . build (); } https://www.baeldung.com/jax-rs-response Dependency is needed from the website

JAX-RS_ in intellij

 Create project with java enterprise. Project template as web application next,# In specification selecti RESTful web services(JAX-RS).  Create the project: Add the maven framework if needed. Add this dependencies: < dependency > < groupId >org.glassfish.jersey.containers</ groupId > < artifactId >jersey-container-servlet</ artifactId > < version >${jersey.version}</ version > </ dependency > < dependency > < groupId >org.glassfish.jersey.inject</ groupId > < artifactId >jersey-hk2</ artifactId > < version >${jersey.version}</ version > </ dependency > Add this properties: < jersey.version >2.29.1</ jersey.version > In webapp/WEB-INF/web.xml, add < servlet > < servlet-name >API Root</ servlet-name > < servlet-class >org.glassfish.jersey.servlet.ServletContainer</ servlet-class > < init-param > < pa