Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37430 > unrolled thread

websocket & rest-api application

Started byPhilipp Kraus <philipp.kraus.flashpixx@gmail.com>
First post2017-09-19 08:11 -0700
Last post2017-09-20 20:36 -0400
Articles 5 — 2 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  websocket & rest-api application Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2017-09-19 08:11 -0700
    Re: websocket & rest-api application Arne Vajhøj <arne@vajhoej.dk> - 2017-09-19 16:06 -0400
      Re: websocket & rest-api application Arne Vajhøj <arne@vajhoej.dk> - 2017-09-19 20:40 -0400
      Re: websocket & rest-api application Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2017-09-20 01:38 -0700
        Re: websocket & rest-api application Arne Vajhøj <arne@vajhoej.dk> - 2017-09-20 20:36 -0400

#37430 — websocket & rest-api application

FromPhilipp Kraus <philipp.kraus.flashpixx@gmail.com>
Date2017-09-19 08:11 -0700
Subjectwebsocket & rest-api application
Message-ID<ab824389-a669-4db9-9be1-a07d4e9427df@googlegroups.com>
Hello,

I'm searching for a very small and efficient framework to create a web-based application.
I need REST-Calls and WebSockets, so at the moment I'm using Jersey, but I need a more / better abstraction level. 
In the backend I'm using an own asynchronized runtime for the calculation of the processes, so the REST-API and websockets are for communication outside.
The UI will be done in Angular and React
The final application will deployed at the end on a Tomcat or other webserver, 

So my question ist, did you have got any suggestions for a small and efficient framework to build REST-API calls and Websockets communication and the boilerplate of the application around. I taken a look into Spring Boot, but imho it seems to be to large.

Thanks
Phil

[toc] | [next] | [standalone]


#37431

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-09-19 16:06 -0400
Message-ID<oprtbg$1477$1@gioia.aioe.org>
In reply to#37430
On 9/19/2017 11:11 AM, Philipp Kraus wrote:
> I'm searching for a very small and efficient framework to create a
> web-based application. I need REST-Calls and WebSockets, so at the
> moment I'm using Jersey, but I need a more / better abstraction
> level. In the backend I'm using an own asynchronized runtime for the
> calculation of the processes, so the REST-API and websockets are for
> communication outside. The UI will be done in Angular and React The
> final application will deployed at the end on a Tomcat or other
> webserver,
>
> So my question ist, did you have got any suggestions for a small and
> efficient framework to build REST-API calls and Websockets
> communication and the boilerplate of the application around. I taken
> a look into Spring Boot, but imho it seems to be to large.

Websockets are outside my area of experience/expertise.

But regarding JAX-RS then I don't understand what you are looking
for.

Fundamentally you create a Java class with some methods and put
on some annotations to described how it is to be exposed.

I see very little that are not needed. What do you think is not needed?

Arne


[toc] | [prev] | [next] | [standalone]


#37432

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-09-19 20:40 -0400
Message-ID<opsded$4md$1@gioia.aioe.org>
In reply to#37431
On 9/19/2017 4:06 PM, Arne Vajhøj wrote:
> On 9/19/2017 11:11 AM, Philipp Kraus wrote:
>> I'm searching for a very small and efficient framework to create a
>> web-based application. I need REST-Calls and WebSockets, so at the
>> moment I'm using Jersey, but I need a more / better abstraction
>> level. In the backend I'm using an own asynchronized runtime for the
>> calculation of the processes, so the REST-API and websockets are for
>> communication outside. The UI will be done in Angular and React The
>> final application will deployed at the end on a Tomcat or other
>> webserver,
>>
>> So my question ist, did you have got any suggestions for a small and
>> efficient framework to build REST-API calls and Websockets
>> communication and the boilerplate of the application around. I taken
>> a look into Spring Boot, but imho it seems to be to large.
>
> Websockets are outside my area of experience/expertise.
>
> But regarding JAX-RS then I don't understand what you are looking
> for.
>
> Fundamentally you create a Java class with some methods and put
> on some annotations to described how it is to be exposed.
>
> I see very little that are not needed. What do you think is not needed?

Maybe I am not explaining it well.

Let me illustrate with an example:

import javax.annotation.ManagedBean;
import javax.ejb.EJB;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import test3.ejb.T1;
import test3.ejb.TestManager;

@ManagedBean
@Path("/testapi")
public class TestManagerREST {
     @EJB
     private TestManager mgr;
     @GET
     @Produces({MediaType.APPLICATION_JSON})
     @Path("/{id}")
     public T1 getOne(@PathParam("id") int id) {
         return mgr.getOne(id);
     }
     @GET
     @Produces({MediaType.APPLICATION_JSON})
     public T1[] getAll() {
         return mgr.getAll().toArray(new T1[0]);
     }
     @POST
     @Consumes({MediaType.APPLICATION_JSON})
     public void save(T1 o) {
         mgr.save(o);
     }
}

and let us slice it up.

public class TestManagerREST {
     @EJB
     private TestManager mgr;
     public T1 getOne(int id) {
         return mgr.getOne(id);
     }
     public T1[] getAll() {
         return mgr.getAll().toArray(new T1[0]);
     }
     public void save(T1 o) {
         mgr.save(o);
     }
}

seems to me to be the minimum to express the logic
getting and saving data.

@Path("/testapi")
     @GET
     @Produces({MediaType.APPLICATION_JSON})
     @Path("/{id}")
                @PathParam("id")
     @GET
     @Produces({MediaType.APPLICATION_JSON})
     @POST
     @Consumes({MediaType.APPLICATION_JSON})

seems to me to be the minimum to express how the
web service API should be.

That leaves practically only the import statements.

Arne

[toc] | [prev] | [next] | [standalone]


#37435

FromPhilipp Kraus <philipp.kraus.flashpixx@gmail.com>
Date2017-09-20 01:38 -0700
Message-ID<660f40e7-a37b-451f-b104-be031f9b2832@googlegroups.com>
In reply to#37431
Am Dienstag, 19. September 2017 22:06:29 UTC+2 schrieb Arne Vajhøj:
> On 9/19/2017 11:11 AM, Philipp Kraus wrote:
> > I'm searching for a very small and efficient framework to create a
> > web-based application. I need REST-Calls and WebSockets, so at the
> > moment I'm using Jersey, but I need a more / better abstraction
> > level. In the backend I'm using an own asynchronized runtime for the
> > calculation of the processes, so the REST-API and websockets are for
> > communication outside. The UI will be done in Angular and React The
> > final application will deployed at the end on a Tomcat or other
> > webserver,
> >
> > So my question ist, did you have got any suggestions for a small and
> > efficient framework to build REST-API calls and Websockets
> > communication and the boilerplate of the application around. I taken
> > a look into Spring Boot, but imho it seems to be to large.
> 
> Websockets are outside my area of experience/expertise.
> 
> But regarding JAX-RS then I don't understand what you are looking
> for.
> 
> Fundamentally you create a Java class with some methods and put
> on some annotations to described how it is to be exposed.

At the moment I do this with this way, so I write my classes, add the annotations. Also I put the HTML & JS code with NPM & Gulp into the webapp directory and bundle it together.
 
> I see very little that are not needed. What do you think is not needed?

I would like to optimize my workflow, at the moment I do everything manually with the annoations. I know frameworks like Spring to get a more abstract way of development, but I need a efficent structure, so the question is there a a framework which allows to create a more abstract level of the software, without performance issues
or it is a good way do all manually with annoations?

Thx

Phil

[toc] | [prev] | [next] | [standalone]


#37441

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-09-20 20:36 -0400
Message-ID<opv1hj$df0$1@gioia.aioe.org>
In reply to#37435
On 9/20/2017 4:38 AM, Philipp Kraus wrote:
> Am Dienstag, 19. September 2017 22:06:29 UTC+2 schrieb Arne Vajhøj:
>> On 9/19/2017 11:11 AM, Philipp Kraus wrote:
>>> So my question ist, did you have got any suggestions for a small and
>>> efficient framework to build REST-API calls and Websockets
>>> communication and the boilerplate of the application around. I taken
>>> a look into Spring Boot, but imho it seems to be to large.

>> But regarding JAX-RS then I don't understand what you are looking
>> for.
>>
>> Fundamentally you create a Java class with some methods and put
>> on some annotations to described how it is to be exposed.
>
> At the moment I do this with this way, so I write my classes, add
> theannotations. Also I put the HTML & JS code with NPM & Gulp into the
> webapp directory and bundle it together.
>
>> I see very little that are not needed. What do you think is not needed?
>
> I would like to optimize my workflow, at the moment I do everything
> manually with the annoations. I know frameworks like Spring to get a
> more abstract way of development, but I need a efficent structure, so
> the question is there a a framework which allows to create a more
> abstract level of the software, without performance issues or it is a
> good way do all manually with annoations?

As I already indicated then I don't see what you can avoid writing
if you want full control.

If you do not require full control, but are looking for something
like a scaffolding tool (give the tool the name of a database table
and the tool creates HTML 5 UI and JAX-RS web services to do
CRUD), then I see the point. But I am not aware of such a
tool.

Arne

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web