Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Created July 7, 2015 05:40
Show Gist options
  • Save AdamBien/a0fedea018c96f43f33a to your computer and use it in GitHub Desktop.
Save AdamBien/a0fedea018c96f43f33a to your computer and use it in GitHub Desktop.
17thAirhacksQ&A
@rszulgo
Copy link

rszulgo commented Jul 28, 2015

It's always better to have the smallest war possible. My is about 50megs right now. Mainly because of lot of 3rd party jars from common libs. We use tomcat + jpa and websockets and some other jee stuff. Is it worth migrating to some real jee app server like glass fish?

@jieryn
Copy link

jieryn commented Jul 28, 2015

All my team's Java EE projects are Apache Maven projects, and they all tend to follow traditional multi-module style. With "domain" for JPA entities, "dao" for JPA->DB bridge, "service" for business logic, "api" for JAX-RS API, and "web" for user front end (angular/bootstrap).

We find we now want to use @EntityListener to easily feed a @websocket endpoint in the "api" module. However, the @EntityListener seems to be unfortunately designed in that it has to couple the listener implementation on the @entity itself, and thus cause a cyclic dependency because it makes more sense to us to have the @EntityListener implementation inside the "api" where it will be used to broadcast the message to all registered web socket clients.

We have seen a lot of benefit from maintaining separation of concerns within Apache Maven modules in the manner I described above. However our users will benefit quite a bit from having the ability to have a @websocket /api/websocket/entity/events which can be used to subscribe for real-time updates. Would you please offer some recommendations to fit in our current design? Is there a better approach than using @EntityListener to provide the real time stream of events? Any other gotchas you have experienced for this type of thing? Thank you!

@oedemis
Copy link

oedemis commented Jul 28, 2015

Hi Adam

How you structure your front-end with JSF or JS Frameworks?
Follow you also a pattern like ECB for back-end?

@rangalo
Copy link

rangalo commented Jul 31, 2015

Hello Adam,

How to conform to YSlow rules using JSF ? Can we use some cdi, interceptor magic here ?
You don't need to go though all the rules. I just want to know the basics.
For example expires headers and tagging the images, js and css files with timestamps, how to go about it ?

@meshuga
Copy link

meshuga commented Jul 31, 2015

There are questions about Kafka and Akka, so I want to ask you about your opinion about Vert.x.

@ahochleitner
Copy link

hello adam,
i have some questions concerning the actual situation about open source and production ready JavaEE-AppServers.
.) In previous days I could use glassfish in production without costs but i could decide to pay for a production license too. That was fine. Today with Wildfly I have a similar situation. I can develop and run wildfly in production, but when i want to pay for a production license, I have to switch to Jboss EAP (which is not available yet for JavaEE 7). As a consequence I have "diffferent" products (Wildfly and Jboss EAP). Is this correct? Or do i miss something? (is here a similar situation with TomEE?)
.) Websphere Liberty Profile has a similar situation compared to glassfish, but i have a restriction when using in production without a payed license (2 Gig?).
.) With Docker in mind I see the Liberty Profile especially designed for docker use (lightweight, fast, modular, ...). What about Wildfly and TomEE in Docker use? There exist no "special" docker versions.
Does that mean, that they are dockerable enough out of the box? Do there exist Benchmarks or other technical infos when comparing multi ear's/war's Applications on one AppServer on Docker with one ear/war/AppServer/Docker-Architecture? (i mean an application, consisting for instance of 10 ear's/war's. On the one hand, I can use one AppServer inside a Docker Container for all 10 ear's/war's. Or I take for each ear/war one AppServer inside a Docker container. So i have 10 parallel AppServers inside 10 docker containers).
thanxs in advance, andy

Copy link

ghost commented Aug 11, 2015

Hello, Im new to JAX-RS approach and i've a particular questions. can anybody answer?

I've a method like following in a service class

@GET
@Produces(MediaType.APPLICATION_JSON)
    public Response listUsers( //PaginatedListWrapper
            @QueryParam("page") @DefaultValue("1") Integer page,
            @QueryParam("sortFields") @DefaultValue("id") String sortFields,
            @QueryParam("sortDirections") @DefaultValue("asc") String sortDirections) {

        PaginatedListWrapper listWrapper = new PaginatedListWrapper<>();
        listWrapper.setCurrentPage(page);
        listWrapper.setSortFields(sortFields);
        listWrapper.setSortDirections(sortDirections);
        listWrapper.setTotalResults(this.countAll());

        int start = (listWrapper.getCurrentPage() - 1) * listWrapper.getPageSize();
        listWrapper.setList(userFacade.findRange(new int[]{start, listWrapper.getPageSize()}));

        return Response.status(Response.Status.OK).entity(listWrapper).build();
    }

my PaginatedListWrapper class like follows

public class PaginatedListWrapper {
    private Integer currentPage;
    private Integer pageSize;
    private Integer totalResults;
 
    private String sortFields;
    private String sortDirections;
    private List list;

and im getting output like the following

Object {
currentPage: 1, 
list: Array[2],
0: "net.brac.ict.mis.tup.uplift.business.entities.User[ id=1 ]"
1: "net.brac.ict.mis.tup.uplift.business.entities.User[ id=2 ]" 
pageSize: 10, 
sortDirections: "asc", 
sortFields: "id"…
}

why im not getting the list of users as json object? like array of objects [{}, {}, {} ...]
what im missing here?
other than using jersey or jackson, i want to learn the underneath core stuffs of doing this.
in my maven it just javaee-web-api and eclipselink

Copy link

ghost commented Aug 12, 2015

Anyone please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment