Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: how to write jeresy web applications code using @POT, @PUT @DELETE

  1. #1
    Join Date
    Jul 2013
    Thanked 0 Times in 0 Posts

    Default how to write jeresy web applications code using @POT, @PUT @DELETE

    Hello every Body,

    i am just new with jeresy web applications (restfull applications), so now i know how deal with @Get, but the problem how to make it with @put, @post, and @ delete
    i will write a very simple example.

    import java.util.ArrayList;
    public class ArrList1 {
    protected static ArrayList col1 = new ArrayList();
    	public  void arrList() {

    Now the Jeresy Code
    import javax.ws.rs.Consumes;
    import javax.ws.rs.GET;
    import javax.ws.rs.PUT;
    import javax.ws.rs.Path;
    import javax.ws.rs.PathParam;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.Response;
    public class RestfullJersy extends ArrList1{
    	public Response arrList() {
    		ArrList1 read = new ArrList1();
    //print the value of the cells which is stored in the the Arraylist
    	    for (int i = 0; i < col1.size(); i++){
    	    Object item = col1.get(i);
    		        String result = " Output: \n\nArrayList Output: \n\n" + item ;
    		        return Response.status(200).entity(result).build();

    HTML Code:
        <servlet-name>Jersey Web Application</servlet-name>
        <servlet-name>Jersey Web Application</servlet-name>
    http://localhost:8080/RestFul/jeresy/ArrayList2Jersy and i will get all element in the arraylist (where RestFul is the name of the Project)

    now all what i want how to write code to add new element in the arraylist @POST or update it @PUT or remove it @DELETE

    for example if i want to add new element col1.add(34); how to write it with @POST and what should the URL to call it?

  2. #2
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Madgaon, Goa, India
    Thanked 48 Times in 46 Posts

    Default Re: how to write jeresy web applications code using @POT, @PUT @DELETE

    This thread has been cross posted here:


    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

  3. The Following User Says Thank You to Darryl.Burke For This Useful Post:

    jps (July 25th, 2013)

Similar Threads

  1. [Help] How to delete code sipush in ola 5 ?
    By hiphopxalon in forum Java Code Snippets and Tutorials
    Replies: 0
    Last Post: July 20th, 2013, 11:53 AM
  2. How to put my code onto the window.
    By Shzylo in forum Java Theory & Questions
    Replies: 1
    Last Post: December 18th, 2012, 09:34 PM
  3. this is code for delete button,is there any errors??,plz help guys
    By live89 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 20th, 2012, 12:56 PM
  4. Replies: 3
    Last Post: September 3rd, 2012, 11:36 AM