SlideShare uma empresa Scribd logo
1 de 218
Arquitetura: chega de
      mesmice
      Guilherme Silveira
Guilherme Silveira
guilherme.silveira@caelum.com.br
são paulo
são paulo
são paulo
são paulo
são paulo
Guilherme Silveira
               guilherme.silveira@caelum.com.br




2002 guj.com.br
2003 vraptor
2004 caelum.com.br
     xp, xstream
2006 scrum
2009 restfulie, lean
2010 tectura.com.br
bank.com     calendar.com




travel.com   company.com
CORBA
heaven?
EJB
heaven?
SOAP
heaven?
what is REST?
what is the future
 of integration
 over the web?
what was REST?
Restful Web


              Services
Restful Web

create a saas account

                        Services
Restful Web

create a saas account


   freeze account
                        Services
Restful Web

create a saas account


   freeze account
                        Services

 reactivate account
Web




Restful         Services
Web
          http




Restful          Services
Web
           http

          port 80




Restful             Services
Web
           http

          port 80


      firewall heaven


Restful             Services
Web Services


Restful
Web Services

             xml, json
Restful
Web Services

              xml, json
Restful
             get, post, ...
Restful Web Services
          as of 2009




  But what about Hypermidia?
    What about consumers?
Restful Web Services
          as of 2009




  But what about Hypermidia?
    What about consumers?
   There is much more!
unresttrips.com: flight details



<?xml version="1.0" encoding="UTF-8" standalum="yes"?>
<flight>
  <information>
    <from>sao paulo</from>
    <to>seoul</to>
  </information>
  <value>900.00</value>
</flight>
service locator when integrating:
                         coupling++

                            unrest
                             pay


                    unresttrips.com

 guilherme
service locator when integrating:
                         coupling++

                            unrest
                             pay


                    unresttrips.com

 guilherme
resttrips.com: flight details



<?xml version="1.0" encoding="UTF-8" standalum="yes"?>
<flight>
  <information>
    <from>sao paulo</from>
    <to>seoul</to>
  </information>
  <value>900.00</value>
  <link rel="payment"
              href="http://resttrips.com/payment/custom"/
</flight>
resttrips.com: flight details



<?xml version="1.0" encoding="UTF-8" standalum="yes"?>
<flight>
  <information>
    <from>sao paulo</from>
    <to>seoul</to>
  </information>
  <value>900.00</value>
  <link rel="payment"
              href="http://resttrips.com/payment/custom"/
</flight>
resttrips.com: making the payment




flight = Client.at('http://resttrips.com/f/574XR4').get();

confirmation = flight.getLink("payment").
                  patch(cardInformation, value);
resttrips.com: making the payment




flight = Client.at('http://resttrips.com/f/574XR4').get();

confirmation = flight.getLink("payment").
                  patch(cardInformation, value);
resttrips.com: changing its payment provider


<?xml version="1.0" encoding="UTF-8" standalum="yes"?>
<flight>
  <information>
    <from>sao paulo</from>
    <to>seoul</to>
  </information>
  <value>900.00</value>
  <link rel="payment"
              href="http://paysite.com/custom"/>
</flight>
resttrips.com: changing its payment provider


<?xml version="1.0" encoding="UTF-8" standalum="yes"?>
<flight>
  <information>
    <from>sao paulo</from>
    <to>seoul</to>
  </information>
  <value>900.00</value>
  <link rel="payment"
              href="http://paysite.com/custom"/>
</flight>
dependency injection when integrating:

                             coupling--

                              restrips
                                pay

                        resttrips.com


   guilherme




                              paysite.com
dependency injection when integrating:

                             coupling--

                              restrips
                                pay

                        resttrips.com


   guilherme




                              paysite.com
trip = resource
        http://kayak.com/f/574XR4




payment = resource
        any_uri_unknown_at_compile_time
não viajo sozinho
meu amigo
@sergio_caelum
meu amigo
@sergio_caelum




 Bilu bilu
resttrips.com: sharing a trip


flight = Client.at('http://resttrips.com/f/574XR4').get();

confirmation = flight.getLink("payment").
                  patch(cardInformation, value/2);

// send the payment link to another part of the web

flight = Client.at('http://resttrips.com/f/574XR4').get();

confirmation = flight.getLink("payment").
                  patch(cardInformation, value/2);
resttrips.com: sharing a trip


flight = Client.at('http://resttrips.com/f/574XR4').get();

confirmation = flight.getLink("payment").
                  patch(cardInformation, value/2);

// send the payment link to another part of the web

flight = Client.at('http://resttrips.com/f/574XR4').get();

confirmation = flight.getLink("payment").
                  patch(cardInformation, value/2);
resttrips.com: sharing a trip


flight = Client.at('http://resttrips.com/f/574XR4').get();

confirmation = flight.getLink("payment").
                  patch(cardInformation, value/2);

// send the payment link to another part of the web

flight = Client.at('http://resttrips.com/f/574XR4').get();

confirmation = flight.getLink("payment").
                  patch(cardInformation, value/2);
resttrips.com: sharing a trip


flight = Client.at('http://resttrips.com/f/574XR4').get();

confirmation = flight.getLink("payment").
                  patch(cardInformation, value/2);

// send the payment link to another part of the web

flight = Client.at('http://resttrips.com/f/574XR4').get();

confirmation = flight.getLink("payment").
                  patch(cardInformation, value/2);
calendar: integrating my systems


myself = Client.at('http://users.calendar.com')
                                .with(auth).get();

myself.link("calendar").patch(flight.link("self"));
calendar: integrating my systems


myself = Client.at('http://users.calendar.com')
                                .with(auth).get();

myself.link("calendar").patch(flight.link("self"));
calendar: more examples



me.link("calendar").patch(link_to_birthday_list)
me.link("calendar").patch(link_to_hotel_reservation)
me.link("calendar").patch(link_to_trip_details)
so what?
so what?




Any update on the flight ==> reflects here
Any update on the hotel ==> reflects here
Any update on the meeting ==> reflects here
so what?



                               r at e!
                           nteg
                   se   ,i
               t u
        ’t j us
    do n
Any update on the flight ==> reflects here
Any update on the hotel ==> reflects here
Any update on the meeting ==> reflects here
so what? that was just keeping an URI.
so what? that was just keeping an URI.




       Remove ==> Cancels the flight
       Remove ==> Cancels the reservation
       Remove ==> Emails your coworkers
so what? that was just keeping an URI.



                                         ro l!
                                    co nt
                          a li ze
                     en tr
                no tc
           do
       Remove ==> Cancels the flight
       Remove ==> Cancels the reservation
       Remove ==> Emails your coworkers
integration over the web




INTEGRATION is DECENTRALIZING the CONTROL
          delegating to multiple agents
              distributed systems
does our ‘rest’
sites in 2010 work
      this way?
so what? that was just keeping an URI.




       Remove ==> Cancels the flight
       Remove ==> Cancels the reservation
       Remove ==> Emails your coworkers
so what? that was just keeping an URI.




                                    a t?
                               fo rm
                       hi ch
               bu tw

       Remove ==> Cancels the flight
       Remove ==> Cancels the reservation
       Remove ==> Emails your coworkers
mas qual o formato do
pagamento ou calendário?
#json, #xml,
#soap #etc?
qual #json, #xml
      #etc?
exercise
who is that guy?
quem é essa?
fácil? e ela?
fácil? e ela?




                          lha!
                        fi
                in ha
          é m
   n ão
conteúdo sem semântica
    não tem valor!
so what?
so what?




micro formats, media types, rdf etc
so what?



                                    nk s!
                               er li
                         hyp
                   w ith
            a ts
       fo rm
  icro
m

micro formats, media types, rdf etc
integration over the web
#json,
@sergio_caelum
#?
de onde veio o # e o @?
“watching @guilhermecaelum
  #qconsp *10 great talk”


              Atenção: esse tweet é só
                  uma sugestão!
controlled
vocabulary
emergiu no twitter,
  por exemplo
inventar antes o
controlled vocabulary?
top down? Big Design Up Front




   O monstro do lago SOAP, longa de 2001
economizando

# busca um voo
def voos_de(site)
  base = Restfulie.at(site).get
  voos = base.link("opensearch").get.fill("flight").with(:from =>
"GRU", :to => "JFK").get
end

voos   = voos_de("kayak")
voos   << voos_de("tam")
voos   << voos_de("gol")
voos   << voos_de("cvc")

voo_mais_barato(voos).link("payment").post(inferno_do_cartao)
banco


voo = voo_mais_barato(voos)

banco = Restfulie.at("meubanco").auth(eu).get

auth = banco.cartoes["lisa"]
               .authorization(1.min, voo.preco)
voo.link("payment").post(auth)

mais_barato(voos).link("payment")...
email
email

guilherme           super viagem
email

guilherme           super viagem
email

guilherme           super viagem



                      caelum
email

guilherme           super viagem



                      caelum
email

guilherme           super viagem



                      caelum



                       kayak
email

guilherme           super viagem



                      caelum



                       kayak
email

guilherme           super viagem



                      caelum



                       kayak
Put your server to REST
    leonard richardsons model
Server Maturity
              1 uri, 1 http verb

/services.do?action=install&...
Server Maturity
                  1 uri, 1 http verb

/services.do?action=install&...

@Path("/services")
public class Services {

  @GET
  public Response services(
    @QueryParam("action") String action) {

    ServiceFactory factory = new ServiceFactory();
    Service service = factory.getServiceFor(action);
    return service.execute();
  }

}
Server Maturity
                1 uri, 1 http verb


public class InstallService {

  public Response execute() {
    return Response.ok()
             .type("application/xml")
             .entity("<service>...</service>")
             .build();
  }

}
But?
1 uri, 1 http verb



/services.do?action=install&...



 I know them all beforehand.
1 uri, 1 http verb



/services.do?action=install&...




Any change will break all our clients!
a priori knowledge
a priori knowledge
        =
a priori knowledge
        =
    coupling++
Server Maturity
           Multiple uris, 1 http verb

/install?...
Server Maturity
             Multiple uris, 1 http verb

/install?...

 @Path("/services")
 public class Services {

   @GET @Path("install")
   public Response install() {
     return new InstallService().execute();
   }

   @GET @Path("uninstall")
   public Response uninstall() {
     return new UninstallService().execute();
   }
but...
GET hell


GET should not imply in
  undesireable effects
POST hell


GET could help us with
        cache!
Server Maturity
  Multiple uris, multiple verbs




         POST /cloud
 GET /cloud/1547437/software
POST /cloud/1547437/software
rails + restfulie
  rubyonrails.org
rails + restfulie
                   rubyonrails.org
class SoftwaresController < ApplicationController
  
  acts_as_restfulie
  respond_to :xml, :json
  
  def create
    @item = Item.create(params[:item])
    respond_with @item, :status => :created
  end
  
  def show
    @item = Item.find(params[:id])
    respond_with @item
  end
end
Vraptor
vraptor.org/en
Vraptor
                     vraptor.org/en
@Resource
public class SoftwareResource {

  public void install() {
    Software software = SoftwareRepository.register
                                            (software);
    response.created(software);
  }

  public void uninstall() {
    response.deleted(software);
  }

}
JAX-RS

@Path("/softwares")
public class SoftwareResource {

  @POST @Consumes("application/xml")
  public Response install(Software software) {
    software = SoftwareRepository.register(software);
    long id = software.getId();
    URI uri = UriBuilder.fromPath("/softwares/" + id)
                                       .build();
    software.install();
    return Response.created(uri).build();
  }
JAX-RS


  @DELETE @Path("{id}")
  public Response uninstall(@PathParam("id") Long id) {
    Software software = SoftwareRepository.retrieve(id);
    software.uninstall();
    return Response.ok().build();
  }
Uniform Interface++
   Resources++
Http verbs example
POST creates

PUT replaces

PATCH updates

DELETE removes

GET retrieves

OPTIONS tells me what i can do

...
Is a Restful service
   a cute CRUD?
yes
but there is more!
hypermedia
  enter amazon.com
hypermedia
  enter amazon.com

    search (GET)
hypermedia
    enter amazon.com

      search (GET)




 create a payment (POST)
hypermedia
    enter amazon.com

      search (GET)

      search (GET)



 create a payment (POST)
hypermedia
    enter amazon.com

      search (GET)

      search (GET)

  create a basket (POST)

 create a payment (POST)
hypermedia
    enter amazon.com       follow links


      search (GET)

      search (GET)

  create a basket (POST)

 create a payment (POST)
hypermedia
    enter amazon.com       follow links


      search (GET)

      search (GET)
                            fill forms
  create a basket (POST)

 create a payment (POST)
Cloud API

GET /user/15    retrieves an user
Cloud API

   GET /user/15         retrieves an user


follow GET machines   accesses its machines
Cloud API

   GET /user/15          retrieves an user


follow GET machines   accesses its machines


  follow POST self    installs a new machine
Cloud API

   GET /user/15          retrieves an user


follow GET machines   accesses its machines


  follow POST self    installs a new machine

follow POST payment         pay for it
retrieves an user


$ curl http://localhost:9998/user/574 -i
HTTP/1.1 200 OK
...
user

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<user>
    <link rel="machines" href="/user/574/machines"/>
    <name>guilherme silveira</name>
    <website>www.caelum.com.br</site>
   <link rel="payment" href="/payment/custom"/>
    ...
</user>
user

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<user>
    <link rel="machines" href="/user/574/machines"/>
    <name>guilherme silveira</name>
    <website>www.caelum.com.br</site>
   <link rel="payment" href="/payment/custom"/>
    ...
</user>
maschine maschine maschine



$ curl http://localhost:9998/user/574/machines -i
HTTP/1.1 200 OK
Content-Type: application/xml
maschine
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<machines xmlns:ns2="http://www.w3.org/2005/Atom">
  <machine>
    <ns2:link rel="self" href="/user/574/machines/1"/>
    <ns2:link rel="software" href="/machines1/softwares"/>
    <id>1</id>
    <host>www.caelum.com.br</host>
    <softwares>
      <software>
        <id>1234</id>
        <ns2:link rel="self" href="/softwares/1234"/>
      </software>
    </softwares>
  </machine>
</machines>
maschine
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<machines xmlns:ns2="http://www.w3.org/2005/Atom">
  <machine>
    <ns2:link rel="self" href="/user/574/machines/1"/>
    <ns2:link rel="software" href="/machines1/softwares"/>
    <id>1</id>
    <host>www.caelum.com.br</host>
    <softwares>
      <software>
        <id>1234</id>
        <ns2:link rel="self" href="/softwares/1234"/>
      </software>
    </softwares>
  </machine>
</machines>
payment


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<user>
    <link rel="machines" href="/user/574/machines"/>
    <name>guilherme silveira</name>
    <website>www.caelum.com.br</site>
   <link rel="payment" href="/payment/custom"/>
    ...
</user>
payment


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<user>
    <link rel="machines" href="/user/574/machines"/>
    <name>guilherme silveira</name>
    <website>www.caelum.com.br</site>
   <link rel="payment" href="/payment/custom"/>
    ...
</user>
#buthow?
@XmlRootElement
@XmlType(propOrder= {"id", "host", "softwares", "links"})
public class Machine {
  private final all variables here;

  @XmlElement(name="link", namespace="http://www.w3.org/2005/Atom")
  public List<Link> getLinks() {
    return Arrays.asList(
      Link.to("/machines/" + getId(), "self"),
      Link.to("/machines/" + getId() + "/softwares", "softwares")
    );
  }

  @XmlElementWrapper(name="softwares")
  @XmlElement(name="software")
  public List<Software> getSoftwares() {
    return softwares;
  }

  public void install(Software software) {
    getSoftwares().add(software);
  }

  public void uninstall(Software software) {
    getSoftwares().remove(software);
  }

}                                              Machine.java
@XmlRootElement
@XmlType(propOrder= {"id", "host", "softwares", "links"})
public class Machine {
  private final all variables here;

  @XmlElement(name="link", namespace="http://www.w3.org/2005/Atom")
  public List<Link> getLinks() {
    return Arrays.asList(
      Link.to("/machines/" + getId(), "self"),
      Link.to("/machines/" + getId() + "/softwares", "softwares")
    );
  }

  @XmlElementWrapper(name="softwares")
  @XmlElement(name="software")
  public List<Software> getSoftwares() {
    return softwares;
  }

  public void install(Software software) {
    getSoftwares().add(software);
  }

  public void uninstall(Software software) {
    getSoftwares().remove(software);
  }

}                                              Machine.java
@Path("/machines")
public class MachineResource {        MachineResource
  @Path("{id}/softwares")
  public SoftwareResource softwares(@PathParam("id") Long id) {
    Machine machine = new MachineRepository().retrieve(id);
    if (machine != null) {
      SoftwareResource softwareResource = new SoftwareResource();

 
 softwareResource.setMachine(machine);
      return softwareResource;
    }
    throw new WebApplicationException(404);

 }


   @POST @Consumes("application/xml")

   public Response create(Machine machine) {

   
 Long id = new MachineRepository().save(machine);

   
 return Response.created(UriBuilder.fromPath("/" + id).build()).build();

   }


   @GET @Path("{id}")

   @Produces("application/xml")

   public Machine show(@PathParam("id") Long id) {

   
 return new MachineRepository().retrieve(id);

   }


   @GET

   @Produces("application/xml")

   public Machines list() {

   
 Machines machines = new Machines();

   
 machines.setMachine(new MachineRepository().list());

   
 return machines;
@Path("/machines")
public class MachineResource {        MachineResource
  @Path("{id}/softwares")
  public SoftwareResource softwares(@PathParam("id") Long id) {
    Machine machine = new MachineRepository().retrieve(id);
    if (machine != null) {
      SoftwareResource softwareResource = new SoftwareResource();

 
 softwareResource.setMachine(machine);
      return softwareResource;
    }
    throw new WebApplicationException(404);

 }


   @POST @Consumes("application/xml")

   public Response create(Machine machine) {

   
 Long id = new MachineRepository().save(machine);

   
 return Response.created(UriBuilder.fromPath("/" + id).build()).build();

   }


   @GET @Path("{id}")

   @Produces("application/xml")

   public Machine show(@PathParam("id") Long id) {

   
 return new MachineRepository().retrieve(id);

   }


   @GET

   @Produces("application/xml")

   public Machines list() {

   
 Machines machines = new Machines();

   
 machines.setMachine(new MachineRepository().list());

   
 return machines;
Server Model
according to
Leonard Richardson, 2008




                           one uri + one verb
Server Model
according to
Leonard Richardson, 2008




                               Ugly
                           one uri + one verb
Server Model
according to
Leonard Richardson, 2008




                           multiple
                            uris



                            one uri + one verb
Server Model
according to
Leonard Richardson, 2008



                                      Less ugly
                           multiple
                            uris



                            one uri + one verb
Server Model
according to
Leonard Richardson, 2008


                                       multiple
                                        verbs
                           multiple
                            uris



                            one uri + one verb
Server Model
according to
Leonard Richardson, 2008
                           cute CRUD
                                       multiple
                                        verbs
                           multiple
                            uris



                            one uri + one verb
Server Model                      rest
according to
Leonard Richardson, 2008        hypermedia


                                       multiple
                                        verbs
                           multiple
                            uris



                            one uri + one verb
JAX-RS wishlist

  VRaptor and Restfulie
examples
vraptor.org/en
1. conventions?


@Path("/services")
public class Services {

  @GET
  public Response services(
    @QueryParam("action") String action) {

    ServiceFactory factory = new ServiceFactory();
    Service service = factory.getServiceFor(action);
    return service.execute();
  }

}
Convention over Configuration


@Resource
public class Services {
	
	 private final ServiceFactory factory;
	
	 public Services(ServiceFactory factory) {
	 	 this.factory = factory;
	 }

	 public void services(String action) {
	 	 factory.getServiceFor(action).execute();
	 }

}
do you want to avoid
    copy+paste?
yes!
yes!
2. TDD: hard to test
@Path("/products")
public class Products {
                                   coupled to the
  @GET                            implementation
  public Response create(
    @QueryParam("what") String what) {

    // persists
    return Response.ok()
             .type("application/xml")
             .entity("<product>...</product>")
             .build();
  }

}
TDD: mock it
                                 coupled to the interface
                                        couple--

@Resource
public class Services {
	
	 private final Response response;
	
	 public Services(Response response) {
	 	 this.response = response;
	 }

	 public void services(String action) {
	 	 response.getServiceFor(action).execute();
	 }

}
TDD: mock it
                                 coupled to the interface
                                        couple--

@Resource
public class Services {
	
	 private final Response response;
	
	 public Services(Response response) {
	 	 this.response = response;
	 }

	 public void services(String action) {
	 	 response.getServiceFor(action).execute();
	 }

}
3. Content negotiation by hand

@Path("/softwares")
public class SoftwareResource {

  @POST @Consumes("application/xml")
  public Response install(Software software) {
    software = SoftwareRepository.register(software);
    long id = software.getId();
    URI uri = UriBuilder.fromPath("/softwares/" + id)
                                       .build();
    software.install();
    return Response.created(uri).build();
  }
Let us do it for you.


@Resource
public class SoftwareResource {

  @Post @Consumes
  public void install(Software software) {
    software = SoftwareRepository.register(software);
    response.created(software);
  }

}
Let us do it for you.


@Resource
public class SoftwareResource {

  @Post @Consumes
  public void install(Software software) {
    software = SoftwareRepository.register(software);
    response.created(software);
  }

}
4. URI coupling

                                   writing the URI once


...

  @GET @Path("/softwares/{id}")
  public Response install(@QueryParam("id") Software
software) {
    // ...
  }
4. URI coupling
                                  writing the URI again
                                       several times
@Path("/softwares")
public class SoftwareResource {

  @POST @Consumes("application/xml")
  public Response install(Software software) {
    software = SoftwareRepository.register(software);
    long id = software.getId();
    URI uri = UriBuilder.fromPath("/softwares/" + id)
                                       .build();
    software.install();
    return Response.created(uri).build();
  }
4. URI coupling
                                            code
@Path("/softwares")
public class SoftwareResource {

  @POST @Consumes("application/xml")
  public Response install(Software software) {
    software = SoftwareRepository.register(software);
    long id = software.getId();
    URI uri = UriBuilder.fromPath("/softwares/" + id)
                                       .build();
    software.install();
    return Response.created(uri).build();
  }
ZERO uri replication


@Resource
public class SoftwareResource {

  @Post @Consumes
  public void install(Software software) {
    // ...
    response.use(SoftwareResource.class).show(software);
  }

}
ZERO uri replication


@Resource
public class SoftwareResource {

  @Post @Consumes
  public void install(Software software) {
    // ...
    response.use(SoftwareResource.class).show(software);
  }

}
5. Parameter list


@Path("/machines")
public class MachineResource {

  @Path("{id}/softwares")
  public SoftwareResource softwares(@PathParam("id") Long id) {
    Machine machine = new MachineRepository().retrieve(id);
    if (machine == null) {
      throw new WebApplicationException(404);
    }
    // ...

 }


}
Yes, we can do it.


@Resource
public class MachineResource {

  @Post ("{m.id}/softwares")
  public SoftwareResource softwares(Machine m) {
    Machine machine = new MachineRepository().retrieve(m
    // ...

 }

}



              parameter converter chain of responsability
Yes, we can do it.


@Resource
public class MachineResource {

  @Post ("{m.id}/softwares")
  public SoftwareResource softwares(Machine m) {
    Machine machine = new MachineRepository().retrieve(m
    // ...

 }

}



              parameter converter chain of responsability
example
restfulie.caelumobjects.com
Response response = client.at
    ("http://localhost:9998/user/574").get();




        6. Client internal DSLs
Response response = client.at
    ("http://localhost:9998/user/574").get();

User user = response.getResource();
System.out.println("user: " + user.getName());




        6. Client internal DSLs
User user = response.getResource();
System.out.println("user: " + user.getName());

Link link = resource(user).getLink("machine");
response = link.follow().post(new Machine());
Link link = resource(user).getLink("machine");
response = link.follow().post(new Machine());


double amount = resource(user).refresh().
                                        getAmountDue();
double amount = resource(user).refresh().
                                        getAmountDue();


link = resource(user).getLink("payment");
Payment payment = new Payment(amount);
response = link.follow().post(payment);
link = resource(user).getLink("payment");
Payment payment = new Payment(amount);
response = link.follow().post(payment);

System.out.println("payment completed");
link = resource(user).getLink("payment");
Payment payment = new Payment(amount);
response = link.follow().post(payment);

System.out.println("payment completed");




      i was looking for a DSL
       and i did not know it!
bottom up
   design by committe
       mime type?
     microformato
  controlled vocabulary
hypermídia
viabilizando a integração através da web
obrigado
code samples


Lucas Cavalcanti
(java server)
@lucascs


           Anderson Leite (ruby)
               @anderson_leite
Further reading
Further reading
Roy Fielding dissertation
Further reading
Roy Fielding dissertation

Rest in Practice, Jim Webber and others
Further reading
Roy Fielding dissertation

Rest in Practice, Jim Webber and others

Restful Webservices Cookbook, Subbu Allamaraju
Further reading
Roy Fielding dissertation

Rest in Practice, Jim Webber and others

Restful Webservices Cookbook, Subbu Allamaraju

Restful Web Services, Richardson and Ruby
Further reading
Roy Fielding dissertation

Rest in Practice, Jim Webber and others

Restful Webservices Cookbook, Subbu Allamaraju

Restful Web Services, Richardson and Ruby

JAX-RS specification
Further reading
Roy Fielding dissertation

Rest in Practice, Jim Webber and others

Restful Webservices Cookbook, Subbu Allamaraju

Restful Web Services, Richardson and Ruby

JAX-RS specification

Infoq articles on REST
Further reading
Roy Fielding dissertation

Rest in Practice, Jim Webber and others

Restful Webservices Cookbook, Subbu Allamaraju

Restful Web Services, Richardson and Ruby

JAX-RS specification

Infoq articles on REST

Restfulie guide
Interviews and
 Presentations
Interviews and
             Presentations
Stefan Tilkov interview on InfoQ
Interviews and
             Presentations
Stefan Tilkov interview on InfoQ

  http://bit.ly/9RUXKL
Interviews and
             Presentations
Stefan Tilkov interview on InfoQ

  http://bit.ly/9RUXKL

Leonard Richardson’s presentation at QCon
Interviews and
             Presentations
Stefan Tilkov interview on InfoQ

  http://bit.ly/9RUXKL

Leonard Richardson’s presentation at QCon

  http://bit.ly/dj2W66
Interviews and
             Presentations
Stefan Tilkov interview on InfoQ

  http://bit.ly/9RUXKL

Leonard Richardson’s presentation at QCon

  http://bit.ly/dj2W66

Martin Fowler on REST
Interviews and
              Presentations
Stefan Tilkov interview on InfoQ

  http://bit.ly/9RUXKL

Leonard Richardson’s presentation at QCon

  http://bit.ly/dj2W66

Martin Fowler on REST

  http://bit.ly/bx61ci
Interviews and
 Presentations
Interviews and
             Presentations
Ian Robinson and Jim Webber interview
Interviews and
             Presentations
Ian Robinson and Jim Webber interview

 http://bit.ly/aEuzj3
Interviews and
             Presentations
Ian Robinson and Jim Webber interview

 http://bit.ly/aEuzj3

Jan Algermissen classification
Interviews and
             Presentations
Ian Robinson and Jim Webber interview

 http://bit.ly/aEuzj3

Jan Algermissen classification

 http://bit.ly/cycFBF
Interviews and
              Presentations
Ian Robinson and Jim Webber interview

  http://bit.ly/aEuzj3

Jan Algermissen classification

  http://bit.ly/cycFBF

Guilherme Silveira on REST clients
Interviews and
              Presentations
Ian Robinson and Jim Webber interview

  http://bit.ly/aEuzj3

Jan Algermissen classification

  http://bit.ly/cycFBF

Guilherme Silveira on REST clients

  http://bit.ly/aHCglv
code samples
code samples
JAX-RS
code samples
JAX-RS

 http://jcp.org/en/jsr/detail?id=311
code samples
JAX-RS

  http://jcp.org/en/jsr/detail?id=311

Rails
code samples
JAX-RS

  http://jcp.org/en/jsr/detail?id=311

Rails

  http://rubyonrails.org
code samples
JAX-RS

  http://jcp.org/en/jsr/detail?id=311

Rails

  http://rubyonrails.org

Restfulie
code samples
JAX-RS

  http://jcp.org/en/jsr/detail?id=311

Rails

  http://rubyonrails.org

Restfulie

  http://restfulie.caelumobjects.com
code samples
JAX-RS

  http://jcp.org/en/jsr/detail?id=311

Rails

  http://rubyonrails.org

Restfulie

  http://restfulie.caelumobjects.com

VRaptor
code samples
JAX-RS

  http://jcp.org/en/jsr/detail?id=311

Rails

  http://rubyonrails.org

Restfulie

  http://restfulie.caelumobjects.com

VRaptor

  http://vraptor.org/en

Mais conteúdo relacionado

Destaque

noSql + rest: Arquitetura Contemporanea
noSql + rest: Arquitetura ContemporaneanoSql + rest: Arquitetura Contemporanea
noSql + rest: Arquitetura ContemporaneaGuilherme Silveira
 
Brief Introduction to REST
Brief Introduction to RESTBrief Introduction to REST
Brief Introduction to RESTColin Harrington
 
Software de qualidade e qualidade de código
Software de qualidade e qualidade de códigoSoftware de qualidade e qualidade de código
Software de qualidade e qualidade de códigoGuilherme Silveira
 
O grandiosismo dos loucos - Agile Brazil 2011, Cecilia Fernandes e Guilherme ...
O grandiosismo dos loucos - Agile Brazil 2011, Cecilia Fernandes e Guilherme ...O grandiosismo dos loucos - Agile Brazil 2011, Cecilia Fernandes e Guilherme ...
O grandiosismo dos loucos - Agile Brazil 2011, Cecilia Fernandes e Guilherme ...Guilherme Silveira
 
Depois de Scrum e XP: não pare de aprender, não pare de inovar
Depois de Scrum e XP: não pare de aprender, não pare de inovarDepois de Scrum e XP: não pare de aprender, não pare de inovar
Depois de Scrum e XP: não pare de aprender, não pare de inovarGuilherme Silveira
 
Deploy continuo, integraçao continua não basta
Deploy continuo, integraçao continua não bastaDeploy continuo, integraçao continua não basta
Deploy continuo, integraçao continua não bastaGuilherme Silveira
 
Smart Building Automation using Heterogeneous Wireless Sensor Networks (in gr...
Smart Building Automation using Heterogeneous Wireless Sensor Networks (in gr...Smart Building Automation using Heterogeneous Wireless Sensor Networks (in gr...
Smart Building Automation using Heterogeneous Wireless Sensor Networks (in gr...Dimitrios Amaxilatis
 
REST Methodologies
REST MethodologiesREST Methodologies
REST Methodologiesjrodbx
 
Equipes ágeis em 2012 - Lições aprendidas
Equipes ágeis em 2012 - Lições aprendidasEquipes ágeis em 2012 - Lições aprendidas
Equipes ágeis em 2012 - Lições aprendidasGuilherme Silveira
 

Destaque (20)

Rest clients
Rest clientsRest clients
Rest clients
 
Rest clients
Rest clientsRest clients
Rest clients
 
noSql + rest: Arquitetura Contemporanea
noSql + rest: Arquitetura ContemporaneanoSql + rest: Arquitetura Contemporanea
noSql + rest: Arquitetura Contemporanea
 
Brief Introduction to REST
Brief Introduction to RESTBrief Introduction to REST
Brief Introduction to REST
 
Software de qualidade e qualidade de código
Software de qualidade e qualidade de códigoSoftware de qualidade e qualidade de código
Software de qualidade e qualidade de código
 
Agile performance testing
Agile performance testingAgile performance testing
Agile performance testing
 
Rest workflows
Rest workflowsRest workflows
Rest workflows
 
Rest @ Qcon 2010
Rest @ Qcon 2010Rest @ Qcon 2010
Rest @ Qcon 2010
 
O grandiosismo dos loucos - Agile Brazil 2011, Cecilia Fernandes e Guilherme ...
O grandiosismo dos loucos - Agile Brazil 2011, Cecilia Fernandes e Guilherme ...O grandiosismo dos loucos - Agile Brazil 2011, Cecilia Fernandes e Guilherme ...
O grandiosismo dos loucos - Agile Brazil 2011, Cecilia Fernandes e Guilherme ...
 
Depois de Scrum e XP: não pare de aprender, não pare de inovar
Depois de Scrum e XP: não pare de aprender, não pare de inovarDepois de Scrum e XP: não pare de aprender, não pare de inovar
Depois de Scrum e XP: não pare de aprender, não pare de inovar
 
Using the web for real
Using the web for realUsing the web for real
Using the web for real
 
Introduction to JAX-RS
Introduction to JAX-RSIntroduction to JAX-RS
Introduction to JAX-RS
 
REST
RESTREST
REST
 
Rest clients
Rest clientsRest clients
Rest clients
 
Deploy continuo, integraçao continua não basta
Deploy continuo, integraçao continua não bastaDeploy continuo, integraçao continua não basta
Deploy continuo, integraçao continua não basta
 
Smart Building Automation using Heterogeneous Wireless Sensor Networks (in gr...
Smart Building Automation using Heterogeneous Wireless Sensor Networks (in gr...Smart Building Automation using Heterogeneous Wireless Sensor Networks (in gr...
Smart Building Automation using Heterogeneous Wireless Sensor Networks (in gr...
 
Arquitetura: chega de mesmice
Arquitetura: chega de mesmiceArquitetura: chega de mesmice
Arquitetura: chega de mesmice
 
REST Methodologies
REST MethodologiesREST Methodologies
REST Methodologies
 
Equipes ágeis em 2012 - Lições aprendidas
Equipes ágeis em 2012 - Lições aprendidasEquipes ágeis em 2012 - Lições aprendidas
Equipes ágeis em 2012 - Lições aprendidas
 
REST overview
REST overviewREST overview
REST overview
 

Semelhante a Arquitetura: chega de mesmice

Mobile Patrons: Better Services on the Go (For Techie)
Mobile Patrons: Better Services on the Go (For Techie)Mobile Patrons: Better Services on the Go (For Techie)
Mobile Patrons: Better Services on the Go (For Techie)Vincci Kwong
 
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)Brian Sam-Bodden
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Anatoly Sharifulin
 
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webA reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webWallace Reis
 
The Web beyond "usernames & passwords" (OSDC12)
The Web beyond "usernames & passwords" (OSDC12)The Web beyond "usernames & passwords" (OSDC12)
The Web beyond "usernames & passwords" (OSDC12)Francois Marier
 
Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605Robin Fernandes
 
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Atlassian
 
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tMojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tCosimo Streppone
 
Sencha Touch e PhoneGap: SouJava - IBM Maio 2013
Sencha Touch e PhoneGap: SouJava - IBM Maio 2013Sencha Touch e PhoneGap: SouJava - IBM Maio 2013
Sencha Touch e PhoneGap: SouJava - IBM Maio 2013Loiane Groner
 
The Future of Progressive Web Apps - Google for Indonesia
The Future of Progressive Web Apps - Google for IndonesiaThe Future of Progressive Web Apps - Google for Indonesia
The Future of Progressive Web Apps - Google for IndonesiaRobert Nyman
 
Do you want a SDK with that API? (Nordic APIS April 2014)
Do you want a SDK with that API? (Nordic APIS April 2014)Do you want a SDK with that API? (Nordic APIS April 2014)
Do you want a SDK with that API? (Nordic APIS April 2014)Nordic APIs
 
Passwords suck, but centralized proprietary services are not the answer
Passwords suck, but centralized proprietary services are not the answerPasswords suck, but centralized proprietary services are not the answer
Passwords suck, but centralized proprietary services are not the answerFrancois Marier
 
The Future of the Web - Cold Front conference 2016
The Future of the Web - Cold Front conference 2016The Future of the Web - Cold Front conference 2016
The Future of the Web - Cold Front conference 2016Robert Nyman
 
The dark side of the app - Todi Appy Days 2015
The dark side of the app - Todi Appy Days 2015The dark side of the app - Todi Appy Days 2015
The dark side of the app - Todi Appy Days 2015Todi Appy Days
 
The dark side of the app
The dark side of the appThe dark side of the app
The dark side of the appSimone Di Maulo
 
Building Persona: federated and privacy-sensitive identity for the Web (Open ...
Building Persona: federated and privacy-sensitive identity for the Web (Open ...Building Persona: federated and privacy-sensitive identity for the Web (Open ...
Building Persona: federated and privacy-sensitive identity for the Web (Open ...Francois Marier
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSAntonio Peric-Mazar
 
The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010Fabien Potencier
 

Semelhante a Arquitetura: chega de mesmice (20)

Arquitetura chega de mesmice
Arquitetura  chega de mesmiceArquitetura  chega de mesmice
Arquitetura chega de mesmice
 
Mobile Patrons: Better Services on the Go (For Techie)
Mobile Patrons: Better Services on the Go (For Techie)Mobile Patrons: Better Services on the Go (For Techie)
Mobile Patrons: Better Services on the Go (For Techie)
 
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webA reviravolta do desenvolvimento web
A reviravolta do desenvolvimento web
 
The Web beyond "usernames & passwords" (OSDC12)
The Web beyond "usernames & passwords" (OSDC12)The Web beyond "usernames & passwords" (OSDC12)
The Web beyond "usernames & passwords" (OSDC12)
 
Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605
 
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
 
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tMojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
 
Sencha Touch e PhoneGap: SouJava - IBM Maio 2013
Sencha Touch e PhoneGap: SouJava - IBM Maio 2013Sencha Touch e PhoneGap: SouJava - IBM Maio 2013
Sencha Touch e PhoneGap: SouJava - IBM Maio 2013
 
The Future of Progressive Web Apps - Google for Indonesia
The Future of Progressive Web Apps - Google for IndonesiaThe Future of Progressive Web Apps - Google for Indonesia
The Future of Progressive Web Apps - Google for Indonesia
 
Do you want a SDK with that API? (Nordic APIS April 2014)
Do you want a SDK with that API? (Nordic APIS April 2014)Do you want a SDK with that API? (Nordic APIS April 2014)
Do you want a SDK with that API? (Nordic APIS April 2014)
 
Payments On Rails
Payments On RailsPayments On Rails
Payments On Rails
 
Passwords suck, but centralized proprietary services are not the answer
Passwords suck, but centralized proprietary services are not the answerPasswords suck, but centralized proprietary services are not the answer
Passwords suck, but centralized proprietary services are not the answer
 
The Future of the Web - Cold Front conference 2016
The Future of the Web - Cold Front conference 2016The Future of the Web - Cold Front conference 2016
The Future of the Web - Cold Front conference 2016
 
The dark side of the app - Todi Appy Days 2015
The dark side of the app - Todi Appy Days 2015The dark side of the app - Todi Appy Days 2015
The dark side of the app - Todi Appy Days 2015
 
The dark side of the app
The dark side of the appThe dark side of the app
The dark side of the app
 
Building Persona: federated and privacy-sensitive identity for the Web (Open ...
Building Persona: federated and privacy-sensitive identity for the Web (Open ...Building Persona: federated and privacy-sensitive identity for the Web (Open ...
Building Persona: federated and privacy-sensitive identity for the Web (Open ...
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJS
 
The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010The state of Symfony2 - SymfonyDay 2010
The state of Symfony2 - SymfonyDay 2010
 

Mais de Guilherme Silveira

Introducao a machine learning na educacao
Introducao a machine learning na educacaoIntroducao a machine learning na educacao
Introducao a machine learning na educacaoGuilherme Silveira
 
Caelum 2010 - Rest Arquitetura Irreponsavel?
Caelum 2010 - Rest Arquitetura Irreponsavel?Caelum 2010 - Rest Arquitetura Irreponsavel?
Caelum 2010 - Rest Arquitetura Irreponsavel?Guilherme Silveira
 
Caelum 2009 Rest Ao Restful - CEJUG 2009
Caelum 2009   Rest Ao Restful - CEJUG 2009Caelum 2009   Rest Ao Restful - CEJUG 2009
Caelum 2009 Rest Ao Restful - CEJUG 2009Guilherme Silveira
 

Mais de Guilherme Silveira (6)

Introducao a machine learning na educacao
Introducao a machine learning na educacaoIntroducao a machine learning na educacao
Introducao a machine learning na educacao
 
Arquitetura: chega de mesmice
Arquitetura: chega de mesmiceArquitetura: chega de mesmice
Arquitetura: chega de mesmice
 
Um produto por semana
Um produto por semanaUm produto por semana
Um produto por semana
 
Caelum 2010 - Rest Arquitetura Irreponsavel?
Caelum 2010 - Rest Arquitetura Irreponsavel?Caelum 2010 - Rest Arquitetura Irreponsavel?
Caelum 2010 - Rest Arquitetura Irreponsavel?
 
REST in Practice
REST in PracticeREST in Practice
REST in Practice
 
Caelum 2009 Rest Ao Restful - CEJUG 2009
Caelum 2009   Rest Ao Restful - CEJUG 2009Caelum 2009   Rest Ao Restful - CEJUG 2009
Caelum 2009 Rest Ao Restful - CEJUG 2009
 

Último

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Último (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Arquitetura: chega de mesmice

  • 1. Arquitetura: chega de mesmice Guilherme Silveira
  • 8. Guilherme Silveira guilherme.silveira@caelum.com.br 2002 guj.com.br 2003 vraptor 2004 caelum.com.br xp, xstream 2006 scrum 2009 restfulie, lean 2010 tectura.com.br
  • 9. bank.com calendar.com travel.com company.com
  • 14. what is the future of integration over the web?
  • 16. Restful Web Services
  • 17. Restful Web create a saas account Services
  • 18. Restful Web create a saas account freeze account Services
  • 19. Restful Web create a saas account freeze account Services reactivate account
  • 20. Web Restful Services
  • 21. Web http Restful Services
  • 22. Web http port 80 Restful Services
  • 23. Web http port 80 firewall heaven Restful Services
  • 25. Web Services xml, json Restful
  • 26. Web Services xml, json Restful get, post, ...
  • 27. Restful Web Services as of 2009 But what about Hypermidia? What about consumers?
  • 28. Restful Web Services as of 2009 But what about Hypermidia? What about consumers? There is much more!
  • 29. unresttrips.com: flight details <?xml version="1.0" encoding="UTF-8" standalum="yes"?> <flight> <information> <from>sao paulo</from> <to>seoul</to> </information>   <value>900.00</value> </flight>
  • 30. service locator when integrating: coupling++ unrest pay unresttrips.com guilherme
  • 31. service locator when integrating: coupling++ unrest pay unresttrips.com guilherme
  • 32. resttrips.com: flight details <?xml version="1.0" encoding="UTF-8" standalum="yes"?> <flight> <information> <from>sao paulo</from> <to>seoul</to> </information>   <value>900.00</value> <link rel="payment" href="http://resttrips.com/payment/custom"/ </flight>
  • 33. resttrips.com: flight details <?xml version="1.0" encoding="UTF-8" standalum="yes"?> <flight> <information> <from>sao paulo</from> <to>seoul</to> </information>   <value>900.00</value> <link rel="payment" href="http://resttrips.com/payment/custom"/ </flight>
  • 34. resttrips.com: making the payment flight = Client.at('http://resttrips.com/f/574XR4').get(); confirmation = flight.getLink("payment"). patch(cardInformation, value);
  • 35. resttrips.com: making the payment flight = Client.at('http://resttrips.com/f/574XR4').get(); confirmation = flight.getLink("payment"). patch(cardInformation, value);
  • 36. resttrips.com: changing its payment provider <?xml version="1.0" encoding="UTF-8" standalum="yes"?> <flight> <information> <from>sao paulo</from> <to>seoul</to> </information>   <value>900.00</value> <link rel="payment" href="http://paysite.com/custom"/> </flight>
  • 37. resttrips.com: changing its payment provider <?xml version="1.0" encoding="UTF-8" standalum="yes"?> <flight> <information> <from>sao paulo</from> <to>seoul</to> </information>   <value>900.00</value> <link rel="payment" href="http://paysite.com/custom"/> </flight>
  • 38. dependency injection when integrating: coupling-- restrips pay resttrips.com guilherme paysite.com
  • 39. dependency injection when integrating: coupling-- restrips pay resttrips.com guilherme paysite.com
  • 40. trip = resource http://kayak.com/f/574XR4 payment = resource any_uri_unknown_at_compile_time
  • 41.
  • 42.
  • 43.
  • 44.
  • 48. resttrips.com: sharing a trip flight = Client.at('http://resttrips.com/f/574XR4').get(); confirmation = flight.getLink("payment"). patch(cardInformation, value/2); // send the payment link to another part of the web flight = Client.at('http://resttrips.com/f/574XR4').get(); confirmation = flight.getLink("payment"). patch(cardInformation, value/2);
  • 49. resttrips.com: sharing a trip flight = Client.at('http://resttrips.com/f/574XR4').get(); confirmation = flight.getLink("payment"). patch(cardInformation, value/2); // send the payment link to another part of the web flight = Client.at('http://resttrips.com/f/574XR4').get(); confirmation = flight.getLink("payment"). patch(cardInformation, value/2);
  • 50. resttrips.com: sharing a trip flight = Client.at('http://resttrips.com/f/574XR4').get(); confirmation = flight.getLink("payment"). patch(cardInformation, value/2); // send the payment link to another part of the web flight = Client.at('http://resttrips.com/f/574XR4').get(); confirmation = flight.getLink("payment"). patch(cardInformation, value/2);
  • 51. resttrips.com: sharing a trip flight = Client.at('http://resttrips.com/f/574XR4').get(); confirmation = flight.getLink("payment"). patch(cardInformation, value/2); // send the payment link to another part of the web flight = Client.at('http://resttrips.com/f/574XR4').get(); confirmation = flight.getLink("payment"). patch(cardInformation, value/2);
  • 52. calendar: integrating my systems myself = Client.at('http://users.calendar.com') .with(auth).get(); myself.link("calendar").patch(flight.link("self"));
  • 53. calendar: integrating my systems myself = Client.at('http://users.calendar.com') .with(auth).get(); myself.link("calendar").patch(flight.link("self"));
  • 56. so what? Any update on the flight ==> reflects here Any update on the hotel ==> reflects here Any update on the meeting ==> reflects here
  • 57. so what? r at e! nteg se ,i t u ’t j us do n Any update on the flight ==> reflects here Any update on the hotel ==> reflects here Any update on the meeting ==> reflects here
  • 58. so what? that was just keeping an URI.
  • 59. so what? that was just keeping an URI. Remove ==> Cancels the flight Remove ==> Cancels the reservation Remove ==> Emails your coworkers
  • 60. so what? that was just keeping an URI. ro l! co nt a li ze en tr no tc do Remove ==> Cancels the flight Remove ==> Cancels the reservation Remove ==> Emails your coworkers
  • 61. integration over the web INTEGRATION is DECENTRALIZING the CONTROL delegating to multiple agents distributed systems
  • 62. does our ‘rest’ sites in 2010 work this way?
  • 63. so what? that was just keeping an URI. Remove ==> Cancels the flight Remove ==> Cancels the reservation Remove ==> Emails your coworkers
  • 64. so what? that was just keeping an URI. a t? fo rm hi ch bu tw Remove ==> Cancels the flight Remove ==> Cancels the reservation Remove ==> Emails your coworkers
  • 65. mas qual o formato do pagamento ou calendário?
  • 69. who is that guy?
  • 72. fácil? e ela? lha! fi in ha é m n ão
  • 73. conteúdo sem semântica não tem valor!
  • 75. so what? micro formats, media types, rdf etc
  • 76. so what? nk s! er li hyp w ith a ts fo rm icro m micro formats, media types, rdf etc
  • 79. #?
  • 80. de onde veio o # e o @?
  • 81. “watching @guilhermecaelum #qconsp *10 great talk” Atenção: esse tweet é só uma sugestão!
  • 83. emergiu no twitter, por exemplo
  • 85. top down? Big Design Up Front O monstro do lago SOAP, longa de 2001
  • 86. economizando # busca um voo def voos_de(site)   base = Restfulie.at(site).get   voos = base.link("opensearch").get.fill("flight").with(:from => "GRU", :to => "JFK").get end voos = voos_de("kayak") voos << voos_de("tam") voos << voos_de("gol") voos << voos_de("cvc") voo_mais_barato(voos).link("payment").post(inferno_do_cartao)
  • 87. banco voo = voo_mais_barato(voos) banco = Restfulie.at("meubanco").auth(eu).get auth = banco.cartoes["lisa"] .authorization(1.min, voo.preco) voo.link("payment").post(auth) mais_barato(voos).link("payment")...
  • 88. email
  • 89.
  • 90. email guilherme super viagem
  • 91. email guilherme super viagem
  • 92. email guilherme super viagem caelum
  • 93. email guilherme super viagem caelum
  • 94. email guilherme super viagem caelum kayak
  • 95. email guilherme super viagem caelum kayak
  • 96. email guilherme super viagem caelum kayak
  • 97. Put your server to REST leonard richardsons model
  • 98. Server Maturity 1 uri, 1 http verb /services.do?action=install&...
  • 99. Server Maturity 1 uri, 1 http verb /services.do?action=install&... @Path("/services") public class Services {   @GET   public Response services(     @QueryParam("action") String action) {     ServiceFactory factory = new ServiceFactory();     Service service = factory.getServiceFor(action);     return service.execute();   } }
  • 100. Server Maturity 1 uri, 1 http verb public class InstallService {   public Response execute() {     return Response.ok()              .type("application/xml")              .entity("<service>...</service>")              .build();   } }
  • 101. But?
  • 102. 1 uri, 1 http verb /services.do?action=install&... I know them all beforehand.
  • 103. 1 uri, 1 http verb /services.do?action=install&... Any change will break all our clients!
  • 106. a priori knowledge = coupling++
  • 107. Server Maturity Multiple uris, 1 http verb /install?...
  • 108. Server Maturity Multiple uris, 1 http verb /install?... @Path("/services") public class Services {   @GET @Path("install")   public Response install() {     return new InstallService().execute();   }   @GET @Path("uninstall")   public Response uninstall() {     return new UninstallService().execute();   }
  • 109. but...
  • 110. GET hell GET should not imply in undesireable effects
  • 111. POST hell GET could help us with cache!
  • 112. Server Maturity Multiple uris, multiple verbs POST /cloud GET /cloud/1547437/software POST /cloud/1547437/software
  • 113. rails + restfulie rubyonrails.org
  • 114. rails + restfulie rubyonrails.org class SoftwaresController < ApplicationController      acts_as_restfulie   respond_to :xml, :json      def create     @item = Item.create(params[:item])     respond_with @item, :status => :created   end      def show     @item = Item.find(params[:id])     respond_with @item   end end
  • 116. Vraptor vraptor.org/en @Resource public class SoftwareResource {   public void install() {     Software software = SoftwareRepository.register (software);     response.created(software);   }   public void uninstall() {     response.deleted(software);   } }
  • 117. JAX-RS @Path("/softwares") public class SoftwareResource {   @POST @Consumes("application/xml")   public Response install(Software software) {     software = SoftwareRepository.register(software);     long id = software.getId();     URI uri = UriBuilder.fromPath("/softwares/" + id)                                        .build();     software.install();     return Response.created(uri).build();   }
  • 118. JAX-RS   @DELETE @Path("{id}")   public Response uninstall(@PathParam("id") Long id) {     Software software = SoftwareRepository.retrieve(id);     software.uninstall();     return Response.ok().build();   }
  • 119. Uniform Interface++ Resources++
  • 120. Http verbs example POST creates PUT replaces PATCH updates DELETE removes GET retrieves OPTIONS tells me what i can do ...
  • 121. Is a Restful service a cute CRUD?
  • 122. yes
  • 123. but there is more!
  • 124. hypermedia enter amazon.com
  • 125. hypermedia enter amazon.com search (GET)
  • 126. hypermedia enter amazon.com search (GET) create a payment (POST)
  • 127. hypermedia enter amazon.com search (GET) search (GET) create a payment (POST)
  • 128. hypermedia enter amazon.com search (GET) search (GET) create a basket (POST) create a payment (POST)
  • 129. hypermedia enter amazon.com follow links search (GET) search (GET) create a basket (POST) create a payment (POST)
  • 130. hypermedia enter amazon.com follow links search (GET) search (GET) fill forms create a basket (POST) create a payment (POST)
  • 131. Cloud API GET /user/15 retrieves an user
  • 132. Cloud API GET /user/15 retrieves an user follow GET machines accesses its machines
  • 133. Cloud API GET /user/15 retrieves an user follow GET machines accesses its machines follow POST self installs a new machine
  • 134. Cloud API GET /user/15 retrieves an user follow GET machines accesses its machines follow POST self installs a new machine follow POST payment pay for it
  • 135. retrieves an user $ curl http://localhost:9998/user/574 -i HTTP/1.1 200 OK ...
  • 136. user <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <user>     <link rel="machines" href="/user/574/machines"/>     <name>guilherme silveira</name>     <website>www.caelum.com.br</site>    <link rel="payment" href="/payment/custom"/>     ... </user>
  • 137. user <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <user>     <link rel="machines" href="/user/574/machines"/>     <name>guilherme silveira</name>     <website>www.caelum.com.br</site>    <link rel="payment" href="/payment/custom"/>     ... </user>
  • 138. maschine maschine maschine $ curl http://localhost:9998/user/574/machines -i HTTP/1.1 200 OK Content-Type: application/xml
  • 139. maschine <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <machines xmlns:ns2="http://www.w3.org/2005/Atom">   <machine>     <ns2:link rel="self" href="/user/574/machines/1"/>     <ns2:link rel="software" href="/machines1/softwares"/>     <id>1</id>     <host>www.caelum.com.br</host>     <softwares>       <software>         <id>1234</id>         <ns2:link rel="self" href="/softwares/1234"/>       </software>     </softwares>   </machine> </machines>
  • 140. maschine <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <machines xmlns:ns2="http://www.w3.org/2005/Atom">   <machine>     <ns2:link rel="self" href="/user/574/machines/1"/>     <ns2:link rel="software" href="/machines1/softwares"/>     <id>1</id>     <host>www.caelum.com.br</host>     <softwares>       <software>         <id>1234</id>         <ns2:link rel="self" href="/softwares/1234"/>       </software>     </softwares>   </machine> </machines>
  • 141. payment <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <user>     <link rel="machines" href="/user/574/machines"/>     <name>guilherme silveira</name>     <website>www.caelum.com.br</site>    <link rel="payment" href="/payment/custom"/>     ... </user>
  • 142. payment <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <user>     <link rel="machines" href="/user/574/machines"/>     <name>guilherme silveira</name>     <website>www.caelum.com.br</site>    <link rel="payment" href="/payment/custom"/>     ... </user>
  • 144. @XmlRootElement @XmlType(propOrder= {"id", "host", "softwares", "links"}) public class Machine {   private final all variables here;   @XmlElement(name="link", namespace="http://www.w3.org/2005/Atom")   public List<Link> getLinks() {     return Arrays.asList(       Link.to("/machines/" + getId(), "self"),       Link.to("/machines/" + getId() + "/softwares", "softwares")     );   }   @XmlElementWrapper(name="softwares")   @XmlElement(name="software")   public List<Software> getSoftwares() {     return softwares;   }   public void install(Software software) {     getSoftwares().add(software);   }   public void uninstall(Software software) {     getSoftwares().remove(software);   } } Machine.java
  • 145. @XmlRootElement @XmlType(propOrder= {"id", "host", "softwares", "links"}) public class Machine {   private final all variables here;   @XmlElement(name="link", namespace="http://www.w3.org/2005/Atom")   public List<Link> getLinks() {     return Arrays.asList(       Link.to("/machines/" + getId(), "self"),       Link.to("/machines/" + getId() + "/softwares", "softwares")     );   }   @XmlElementWrapper(name="softwares")   @XmlElement(name="software")   public List<Software> getSoftwares() {     return softwares;   }   public void install(Software software) {     getSoftwares().add(software);   }   public void uninstall(Software software) {     getSoftwares().remove(software);   } } Machine.java
  • 146. @Path("/machines") public class MachineResource { MachineResource @Path("{id}/softwares") public SoftwareResource softwares(@PathParam("id") Long id) { Machine machine = new MachineRepository().retrieve(id); if (machine != null) { SoftwareResource softwareResource = new SoftwareResource(); softwareResource.setMachine(machine); return softwareResource; } throw new WebApplicationException(404); } @POST @Consumes("application/xml") public Response create(Machine machine) { Long id = new MachineRepository().save(machine); return Response.created(UriBuilder.fromPath("/" + id).build()).build(); } @GET @Path("{id}") @Produces("application/xml") public Machine show(@PathParam("id") Long id) { return new MachineRepository().retrieve(id); } @GET @Produces("application/xml") public Machines list() { Machines machines = new Machines(); machines.setMachine(new MachineRepository().list()); return machines;
  • 147. @Path("/machines") public class MachineResource { MachineResource @Path("{id}/softwares") public SoftwareResource softwares(@PathParam("id") Long id) { Machine machine = new MachineRepository().retrieve(id); if (machine != null) { SoftwareResource softwareResource = new SoftwareResource(); softwareResource.setMachine(machine); return softwareResource; } throw new WebApplicationException(404); } @POST @Consumes("application/xml") public Response create(Machine machine) { Long id = new MachineRepository().save(machine); return Response.created(UriBuilder.fromPath("/" + id).build()).build(); } @GET @Path("{id}") @Produces("application/xml") public Machine show(@PathParam("id") Long id) { return new MachineRepository().retrieve(id); } @GET @Produces("application/xml") public Machines list() { Machines machines = new Machines(); machines.setMachine(new MachineRepository().list()); return machines;
  • 148. Server Model according to Leonard Richardson, 2008 one uri + one verb
  • 149. Server Model according to Leonard Richardson, 2008 Ugly one uri + one verb
  • 150. Server Model according to Leonard Richardson, 2008 multiple uris one uri + one verb
  • 151. Server Model according to Leonard Richardson, 2008 Less ugly multiple uris one uri + one verb
  • 152. Server Model according to Leonard Richardson, 2008 multiple verbs multiple uris one uri + one verb
  • 153. Server Model according to Leonard Richardson, 2008 cute CRUD multiple verbs multiple uris one uri + one verb
  • 154. Server Model rest according to Leonard Richardson, 2008 hypermedia multiple verbs multiple uris one uri + one verb
  • 155. JAX-RS wishlist VRaptor and Restfulie
  • 157. 1. conventions? @Path("/services") public class Services {   @GET   public Response services(     @QueryParam("action") String action) {     ServiceFactory factory = new ServiceFactory();     Service service = factory.getServiceFor(action);     return service.execute();   } }
  • 158. Convention over Configuration @Resource public class Services { private final ServiceFactory factory; public Services(ServiceFactory factory) { this.factory = factory; } public void services(String action) { factory.getServiceFor(action).execute(); } }
  • 159. do you want to avoid copy+paste?
  • 160. yes!
  • 161. yes!
  • 162. 2. TDD: hard to test @Path("/products") public class Products { coupled to the   @GET implementation   public Response create(     @QueryParam("what") String what) {     // persists     return Response.ok()              .type("application/xml")              .entity("<product>...</product>")              .build();   } }
  • 163. TDD: mock it coupled to the interface couple-- @Resource public class Services { private final Response response; public Services(Response response) { this.response = response; } public void services(String action) { response.getServiceFor(action).execute(); } }
  • 164. TDD: mock it coupled to the interface couple-- @Resource public class Services { private final Response response; public Services(Response response) { this.response = response; } public void services(String action) { response.getServiceFor(action).execute(); } }
  • 165. 3. Content negotiation by hand @Path("/softwares") public class SoftwareResource {   @POST @Consumes("application/xml")   public Response install(Software software) {     software = SoftwareRepository.register(software);     long id = software.getId();     URI uri = UriBuilder.fromPath("/softwares/" + id)                                        .build(); software.install();     return Response.created(uri).build();   }
  • 166. Let us do it for you. @Resource public class SoftwareResource { @Post @Consumes   public void install(Software software) {     software = SoftwareRepository.register(software);     response.created(software);   } }
  • 167. Let us do it for you. @Resource public class SoftwareResource { @Post @Consumes   public void install(Software software) {     software = SoftwareRepository.register(software);     response.created(software);   } }
  • 168. 4. URI coupling writing the URI once ...   @GET @Path("/softwares/{id}")   public Response install(@QueryParam("id") Software software) { // ...   }
  • 169. 4. URI coupling writing the URI again several times @Path("/softwares") public class SoftwareResource {   @POST @Consumes("application/xml")   public Response install(Software software) {     software = SoftwareRepository.register(software);     long id = software.getId();     URI uri = UriBuilder.fromPath("/softwares/" + id)                                        .build(); software.install();     return Response.created(uri).build();   }
  • 170. 4. URI coupling code @Path("/softwares") public class SoftwareResource {   @POST @Consumes("application/xml")   public Response install(Software software) {     software = SoftwareRepository.register(software);     long id = software.getId();     URI uri = UriBuilder.fromPath("/softwares/" + id)                                        .build(); software.install();     return Response.created(uri).build();   }
  • 171. ZERO uri replication @Resource public class SoftwareResource { @Post @Consumes   public void install(Software software) {     // ...     response.use(SoftwareResource.class).show(software);   } }
  • 172. ZERO uri replication @Resource public class SoftwareResource { @Post @Consumes   public void install(Software software) {     // ...     response.use(SoftwareResource.class).show(software);   } }
  • 173. 5. Parameter list @Path("/machines") public class MachineResource { @Path("{id}/softwares") public SoftwareResource softwares(@PathParam("id") Long id) { Machine machine = new MachineRepository().retrieve(id); if (machine == null) { throw new WebApplicationException(404); } // ... } }
  • 174. Yes, we can do it. @Resource public class MachineResource { @Post ("{m.id}/softwares") public SoftwareResource softwares(Machine m) { Machine machine = new MachineRepository().retrieve(m // ... } } parameter converter chain of responsability
  • 175. Yes, we can do it. @Resource public class MachineResource { @Post ("{m.id}/softwares") public SoftwareResource softwares(Machine m) { Machine machine = new MachineRepository().retrieve(m // ... } } parameter converter chain of responsability
  • 177. Response response = client.at ("http://localhost:9998/user/574").get(); 6. Client internal DSLs
  • 178. Response response = client.at ("http://localhost:9998/user/574").get(); User user = response.getResource(); System.out.println("user: " + user.getName()); 6. Client internal DSLs
  • 179. User user = response.getResource(); System.out.println("user: " + user.getName()); Link link = resource(user).getLink("machine"); response = link.follow().post(new Machine());
  • 180. Link link = resource(user).getLink("machine"); response = link.follow().post(new Machine()); double amount = resource(user).refresh(). getAmountDue();
  • 181. double amount = resource(user).refresh(). getAmountDue(); link = resource(user).getLink("payment"); Payment payment = new Payment(amount); response = link.follow().post(payment);
  • 182. link = resource(user).getLink("payment"); Payment payment = new Payment(amount); response = link.follow().post(payment); System.out.println("payment completed");
  • 183. link = resource(user).getLink("payment"); Payment payment = new Payment(amount); response = link.follow().post(payment); System.out.println("payment completed"); i was looking for a DSL and i did not know it!
  • 184. bottom up design by committe mime type? microformato controlled vocabulary
  • 187. code samples Lucas Cavalcanti (java server) @lucascs Anderson Leite (ruby) @anderson_leite
  • 190. Further reading Roy Fielding dissertation Rest in Practice, Jim Webber and others
  • 191. Further reading Roy Fielding dissertation Rest in Practice, Jim Webber and others Restful Webservices Cookbook, Subbu Allamaraju
  • 192. Further reading Roy Fielding dissertation Rest in Practice, Jim Webber and others Restful Webservices Cookbook, Subbu Allamaraju Restful Web Services, Richardson and Ruby
  • 193. Further reading Roy Fielding dissertation Rest in Practice, Jim Webber and others Restful Webservices Cookbook, Subbu Allamaraju Restful Web Services, Richardson and Ruby JAX-RS specification
  • 194. Further reading Roy Fielding dissertation Rest in Practice, Jim Webber and others Restful Webservices Cookbook, Subbu Allamaraju Restful Web Services, Richardson and Ruby JAX-RS specification Infoq articles on REST
  • 195. Further reading Roy Fielding dissertation Rest in Practice, Jim Webber and others Restful Webservices Cookbook, Subbu Allamaraju Restful Web Services, Richardson and Ruby JAX-RS specification Infoq articles on REST Restfulie guide
  • 197. Interviews and Presentations Stefan Tilkov interview on InfoQ
  • 198. Interviews and Presentations Stefan Tilkov interview on InfoQ http://bit.ly/9RUXKL
  • 199. Interviews and Presentations Stefan Tilkov interview on InfoQ http://bit.ly/9RUXKL Leonard Richardson’s presentation at QCon
  • 200. Interviews and Presentations Stefan Tilkov interview on InfoQ http://bit.ly/9RUXKL Leonard Richardson’s presentation at QCon http://bit.ly/dj2W66
  • 201. Interviews and Presentations Stefan Tilkov interview on InfoQ http://bit.ly/9RUXKL Leonard Richardson’s presentation at QCon http://bit.ly/dj2W66 Martin Fowler on REST
  • 202. Interviews and Presentations Stefan Tilkov interview on InfoQ http://bit.ly/9RUXKL Leonard Richardson’s presentation at QCon http://bit.ly/dj2W66 Martin Fowler on REST http://bit.ly/bx61ci
  • 204. Interviews and Presentations Ian Robinson and Jim Webber interview
  • 205. Interviews and Presentations Ian Robinson and Jim Webber interview http://bit.ly/aEuzj3
  • 206. Interviews and Presentations Ian Robinson and Jim Webber interview http://bit.ly/aEuzj3 Jan Algermissen classification
  • 207. Interviews and Presentations Ian Robinson and Jim Webber interview http://bit.ly/aEuzj3 Jan Algermissen classification http://bit.ly/cycFBF
  • 208. Interviews and Presentations Ian Robinson and Jim Webber interview http://bit.ly/aEuzj3 Jan Algermissen classification http://bit.ly/cycFBF Guilherme Silveira on REST clients
  • 209. Interviews and Presentations Ian Robinson and Jim Webber interview http://bit.ly/aEuzj3 Jan Algermissen classification http://bit.ly/cycFBF Guilherme Silveira on REST clients http://bit.ly/aHCglv
  • 213. code samples JAX-RS http://jcp.org/en/jsr/detail?id=311 Rails
  • 214. code samples JAX-RS http://jcp.org/en/jsr/detail?id=311 Rails http://rubyonrails.org
  • 215. code samples JAX-RS http://jcp.org/en/jsr/detail?id=311 Rails http://rubyonrails.org Restfulie
  • 216. code samples JAX-RS http://jcp.org/en/jsr/detail?id=311 Rails http://rubyonrails.org Restfulie http://restfulie.caelumobjects.com
  • 217. code samples JAX-RS http://jcp.org/en/jsr/detail?id=311 Rails http://rubyonrails.org Restfulie http://restfulie.caelumobjects.com VRaptor
  • 218. code samples JAX-RS http://jcp.org/en/jsr/detail?id=311 Rails http://rubyonrails.org Restfulie http://restfulie.caelumobjects.com VRaptor http://vraptor.org/en

Notas do Editor

  1. 1 uri. 1 http verb
  2. implementing a specific response