Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.jboss.resteasy.cdi.extension.scope;
  
  
  import  javax.enterprise.context.RequestScoped;
  import javax.ws.rs.POST;
  import javax.ws.rs.Path;
 

Author(s):
Ron Sigal
Version:
$Revision: 1.1 $ Copyright May 7, 2012
 
 @Path("/extension")
 @RequestScoped
 public class ExtensionResource
 {  
    private static int lastSecret2;
    private static int lastSecret3;
    
    @Inject private Logger log;
    @Inject private Utilities utilities;
    @Inject private ObsolescentAfterTwoUses oo2;
    
    @POST
    @Path("setup")
    public Response setup()
    {
       .info("ObsolescentObject scope: " + .testScope(ObsolescentAfterTwoUses.classPlannedObsolescenceScope.class));
       {
           = .getSecret();
           = .getSecret();
          .info("current secret2: " + );
          .info("current secret3: " + );
          return Response.ok().build();
       }
       else
       {
          return Response.serverError().build();
       }
    }
    
    @POST
    @Path("test1")
    public Response test1()
    {
       int currentSecret2 = .getSecret();
       int currentSecret3 = .getSecret();
       .info("last secret2:    " + );
       .info("last secret3:    " + );
       .info("current secret2: " + currentSecret2);
       .info("current secret3: " + currentSecret3);
       if (currentSecret2 ==  && currentSecret3 == )
       {
           = currentSecret2;
           = currentSecret3;
          return Response.ok().build();
       }
       else
       {
          return Response.serverError().build();
       }
    }
    
    @POST
    @Path("test2")
    public Response test2()
    {
       int currentSecret2 = .getSecret();
       int currentSecret3 = .getSecret();
       .info("last secret2:    " + );
       .info("last secret3:    " + );
       .info("current secret2: " + currentSecret2);
       .info("current secret3: " + currentSecret3);
       if (currentSecret2 !=  && currentSecret3 == )
       {
           = currentSecret3;
          return Response.ok().build();
       }
       else
       {
          return Response.serverError().build();
       }
    }
    
    @POST
    @Path("test3")
    public Response test3()
    {
       int currentSecret3 = .getSecret();
       .info("last secret3:    " + );
      .info("current secret3: " + currentSecret3);
      if (currentSecret3 != )
      {
         return Response.ok().build();
      }
      else
      {
         return Response.serverError().build();
      }
   }
New to GrepCode? Check out our FAQ X