SlideShare is now on Android. 15 million presentations at your fingertips.  Get the app

×
  • Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
 

RESTful Web services using JAX-RS

by on May 14, 2012

  • 18,863 views

RESTful Web services using JAX-RS at Java Day, Istanbul, May 2012

RESTful Web services using JAX-RS at Java Day, Istanbul, May 2012

Statistics

Views

Total Views
18,863
Views on SlideShare
18,643
Embed Views
220

Actions

Likes
9
Downloads
270
Comments
1

13 Embeds 220

http://glassfish.collected.info 169
http://feeds.feedburner.com 24
http://hero-worshiper6.zulti.com 9
http://www.linkedin.com 4
http://webcache.googleusercontent.com 3
http://blogs.oracle.com 3
http://feedproxy.google.com 2
http://www.hanrss.com 1
http://translate.googleusercontent.com 1
http://www.directrss.co.il 1
http://hero-worshiper6.mymoviepundit.com 1
http://de.flavors.me 1
http://127.0.0.1:8795 1
More...

Accessibility

Categories

Upload Details

Uploaded via SlideShare as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • GopalKrishna20 Gopal Krishna at I.T - The Official Page Hi Arun,
    I am working with Jersy to RESTFUL JSON output.
    is it possible to send custom object as a @Pathparam using get method and i need json as output using RESTFUL.

    I mean instead of sending all the parameters URI like ----> custom/1/aaa/addr shall we custom/pojo

    Client Side:

    class Pojo{
    int id=1;
    String name='aaa';
    String addr='addr';
    //setter & getters

    }

    Main class:

    public static void main(String... a)
    {
    Pojo pojo = new Pojo();

    System.out.println(service.path('rest').path('custom/pojo').accept(MediaType.APPLICATION_JSON).get(String.class));
    }


    server side:

    @Path('/custom')
    class Custom
    {
    @GET
    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
    @Path('{pojo}')
    public Pojo getJsonOutput(@PathParam('pojo') Pojo p) {
    if(1==p.getId() && 'aaa'.equals(p.getName()) && 'addr'.equals(p.getAddr())


    return new Pojo();

    else

    return null;
    }
    }


    class Pojo{
    int id=1;
    String name='aaa';
    String addr='addr';
    String firstName='aaa';
    String lastName='bbb';
    String firstAddr='ccc';
    String lastAddr='ddd';
    String mobnumber='123457896';

    //Setters & Getters

    }
    1 year ago
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

RESTful Web services using JAX-RS RESTful Web services using JAX-RS Presentation Transcript