Created
October 17, 2011 14:16
-
-
Save khannedy/1292681 to your computer and use it in GitHub Desktop.
RESTful menggunakan Java dan NetBeans IDE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2011, StripBandunk and/or its affiliates. All rights reserved. | |
* | |
* http://stripbandunk.com/ | |
* | |
* STRIPBANDUNK PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. | |
*/ | |
package khannedy.belajar.hellorest; | |
import javax.ws.rs.GET; | |
import javax.ws.rs.Path; | |
import javax.ws.rs.Produces; | |
import javax.ws.rs.core.MediaType; | |
/** | |
* | |
* @author Eko Kurniawan Khannedy | |
*/ | |
@Path("/hello") | |
public class HelloRest { | |
@GET | |
@Produces({MediaType.TEXT_PLAIN}) | |
public String hello() { | |
return "Hello World"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.mortbay.jetty</groupId> | |
<artifactId>maven-jetty-plugin</artifactId> | |
<version>6.1.26</version> | |
</plugin> | |
.... | |
</plugins> | |
</build> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<servlet> | |
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> | |
<servlet-name>Jersey</servlet-name> | |
<init-param> | |
<param-name>com.sun.jersey.config.property.packages</param-name> | |
<param-value>khannedy.belajar.hellorest</param-value> | |
</init-param> | |
<load-on-startup>1</load-on-startup> | |
</servlet> | |
<servlet-mapping> | |
<servlet-name>Jersey</servlet-name> | |
<url-pattern>/rest/*</url-pattern> | |
</servlet-mapping> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment