<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>prj_name</display-name>
<!-- Helps locate the applicationContext.xml file -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-hibernate.xml,/WEB-INF/Erp-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>any_name</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>any_name</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- Configuration for Jersey Web Services starts here -->
<servlet>
<servlet-name>jersey</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<!-- The package in which the Resource classes located-->
<param-value>org.pathto.jersey.resource</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey</servlet-name>
<!-- Enables us to access the WS by pointing your browser to this URL : http://localhost:8080/any_name/{service-path}-->
<url-pattern>/*</url-pattern>
</servlet-mapping>
<!-- Configuration for Jersey Web Services ends here -->
<session-config>
<session-timeout>10</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
package org.pathto.jersey.resource;
@Path("hello") // The path by which we access the service
public class ServicesImpl implemets Services
{
@GET // The HTTP method by which we access the service
@Produces("application/html") // The output MIME Type
public String getMethod()
{
return "<b>Hello World, Welcome to Jersey + Spring Integrattion</b>";
}
}
<bean id="wservices" class="org.pathto.jersey.resource.ServicesImpl" />
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (1)
Author
Commented: