Rest java class is not calling for new jersey version -
Rest java class is not calling for new jersey version -
i trying create simple demo rest-application using latest version of jersey. can create rest phone call using old-version (1.x). don't know, can't create newer version. below pom.xml file.. missing dependency ?
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>testproject</groupid> <artifactid>testproject</artifactid> <version>1.0</version> <packaging>war</packaging> <properties> <jersey.version>2.9</jersey.version> </properties> <dependencies> <!-- <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-core</artifactid> <version>1.17.1</version> </dependency>--> <dependency> <groupid>org.glassfish.jersey.core</groupid> <artifactid>jersey-server</artifactid> <version>${jersey.version}</version> </dependency> <dependency> <groupid>org.glassfish.jersey.core</groupid> <artifactid>jersey-common</artifactid> <version>${jersey.version}</version> </dependency> <dependency> <groupid>org.glassfish.jersey.core</groupid> <artifactid>jersey-client</artifactid> <version>${jersey.version}</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>javax.servlet-api</artifactid> <version>3.0.1</version> <scope>provided</scope> </dependency> </dependencies> </project>
below web.xml file
<web-app id="webapp_id" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>restful web application</display-name> <servlet> <servlet-name>jersey-serlvet</servlet-name> <servlet-class><!--com.sun.jersey.spi.container.servlet.servletcontainer--> org.glassfish.jersey.servlet.servletcontainer </servlet-class> <init-param> <param-name><!--com.sun.jersey.config.property.packages--> jersey.config.server.provider.packages </param-name> <param-value>com.test.rest</param-value> </init-param> <init-param> <param-name>com.sun.jersey.api.json.pojomappingfeature</param-name> <param-value>true</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jersey-serlvet</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> </web-app>
and java file below
@path("/hello") public class helloworldservice { @get @path("/test") public response getmsg( @notnull @queryparam("name") string name) { string output = "name : " + name; homecoming response.status(200).entity(output).build(); } }
what missing ?
rest jersey jersey-2.0
Comments
Post a Comment