Giter Site home page Giter Site logo

Comments (8)

glassfishrobot avatar glassfishrobot commented on September 14, 2024

from rest.

glassfishrobot avatar glassfishrobot commented on September 14, 2024

@glassfishrobot Commented
Reported by [email protected]

from rest.

glassfishrobot avatar glassfishrobot commented on September 14, 2024

@glassfishrobot Commented
sandoz said:
It's a bit of a hack but one can recast rather than wrap state.

public class Main {

   public static class Response<T> {

       private final T entity;

       private Response(T entity) {
           this.entity = entity;
       }

       public T getEntity() {
           return entity;
       }

       public static <T> ResponseBuilder<T> start() {
           return new ResponseBuilder<T>();
       }

       public static class ResponseBuilder<T> {
           private T entity;

           public ResponseBuilder<T> header(String name, String value) {
               return this;
           }

           public <V> ResponseBuilder<V> entity(V ent) {
               ResponseBuilder<V> vThis = (ResponseBuilder<V>)this;
               vThis.entity = ent;
               return vThis;
           }

           public Response<T> build() {
               return new Response<T>(entity);
           }
       }

       /**
        * @param args the command line arguments
        */
       public static void main(String[] args) {

           Response<String> stringResponse = Response.start()
   .entity(1)
   .entity("String")
   .header("Content-Type", "cheese")
   .build();
       }
   }
}

from rest.

glassfishrobot avatar glassfishrobot commented on September 14, 2024

@glassfishrobot Commented
@mpotociar said:
Targeting for 2.0 PFD, but might need to be moved to 2.0 MR.

from rest.

glassfishrobot avatar glassfishrobot commented on September 14, 2024

@glassfishrobot Commented
@mpotociar said:
Deferring to post-2.0 evaluation.

Since we would end up using type-erased Response in a lot of places, perhaps it would be better to consider introducing a generic response sub-class instead (like in Jersey 1.x).

from rest.

glassfishrobot avatar glassfishrobot commented on September 14, 2024

@glassfishrobot Commented
c.beikov said:
What about custom Response beans similar to what resteasy offers with ResponseObjects(https://github.com/resteasy/Resteasy/blob/master/jaxrs/resteasy-jaxrs/src/test/java/org/jboss/resteasy/test/finegrain/client/ResponseObjectTest.java)??) That would also allow rich client APIs.

from rest.

glassfishrobot avatar glassfishrobot commented on September 14, 2024

@glassfishrobot Commented
Issue-Links:
is duplicated by
JAX_RS_SPEC-108

from rest.

glassfishrobot avatar glassfishrobot commented on September 14, 2024

@glassfishrobot Commented
This issue was imported from java.net JIRA JAX_RS_SPEC-15

from rest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.