Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Created August 14, 2020 05:47
Show Gist options
  • Save AdamBien/6fb9ae56e83d78d643343013fa1a304d to your computer and use it in GitHub Desktop.
Save AdamBien/6fb9ae56e83d78d643343013fa1a304d to your computer and use it in GitHub Desktop.
78thAirhacksQ&A.md

Ask questions and see you at September, 7th, 8.PM. CET: https://vimeo.com/event/154379

Also checkout recent episode:

77 airhacks.tv

Please keep the questions Jakarta EE-stic. Means: as short and as concise as only possible. Feel free to ask several, shorter questions. Upcoming airhacks.tv events are also going to be announced at meetup.com/airhacks

@enji7
Copy link

enji7 commented Sep 5, 2020

Hi,
not a question, but an info: Our company has published a small support library (open source) for speeding up REST development based on Java EE / MicroProfile REST Client - might be interesting for you as well:
https://github.com/svc-ehealth/jareto
Cheers,
Nenad

Hi Nenad,
I just had a quick look at the readme and I must say that I don't really see the gain on using it over say a plain MP. Maybe you could made a post somewhere or code something and put it on github to show the benefits.

Kind regards,
Daniel

Hi Daniel,

we found ourselves implementing the same standard code over and over again for every new REST service / client. Examples for using the library can be found in the accompanying "jareto-demo" project.

For instance, we can now simply throw Jareto's generic "AppException" or "AppRuntimeException" on the server-side, and catch it on the client-side (just as if it was a plain, local Java invocation). The exception mappers for server and client are part of Jareto, so we don't have to re-implement them for every new REST service.

Regards,
Nenad

@thehpi
Copy link

thehpi commented Sep 7, 2020

Sometimes you develop in http mode as no real certificate is available but in production typically you use https.
So sometimes I need a secure cookie and sometimes not.I know I can use

<session-config> <cookie-config> <secure>true</secure> </cookie-config> </session-config>

in web.xml but is there a way to make this configurable?
Is there a programmatic way?
Or is it possible to set a JNDI parameter that can be used?

@thehpi
Copy link

thehpi commented Sep 7, 2020

Payara (Grizzly) does not allow a backslash in a url. So a rest call with an {id} which contains a backslash never reaches the rest endpoint.
What is sent in the request is something that was returned earlier from another endpoint. I can add interceptors that will replace the (outgoing) backslash with something else and when it comes back in replace it back to the original value.

Is there a better way?

@FlorinAlexandru
Copy link

Hello Adam,

I have a class MyDao with an injected DataSource member: @Inject @Postgres private DataSource dataSource;. I have the @Postgres qualifier defined. To inject I'm using a producer method:

public class PostgresDataSourceProducer {
    @Resource(mappedName = "java:jboss/PostgresDS")
    private DataSource ds;

    @Produces
    @Postgres
    DataSource postgresDataSouce() {
        return ds;
    }
}

I want to do some integration tests for MyDao class. For this I need to change the datasource to point to my test database. How to do that?

Thank you,
Florin

@thehpi
Copy link

thehpi commented Sep 7, 2020

How would you handle concurrency if you create an MBean which has concurrently updated maps which of course are also read through JMX? @stateless would do it I guess but that feels like overkill. ConcurrentHashMaps? But what if the MBean also does small calculations?

@deratzmann
Copy link

deratzmann commented Sep 7, 2020

Hi Adam.

In one of the last episodes you mentioned, that replacing EJBs in quarkus Projects with CDI could be quite simple.

I created 2 Annotation Types.

For replacing @Stateless I would do sth. like this:

@Asynchronous
@Bulkhead
@RequestScoped
@Transactional
@Stereotype
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface StatelessBoundary {
    
}

For @Singleton I created this:

@Bulkhead(value = 1, waitingTaskQueue = 10)
@Singleton
@Transactional
@Stereotype
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface SingletonBoundary {
    
}

Is this a good way to replace my good old Stateless and Singleton Beans especially when using Bean Pooling (Stateless) and Single-Running-Process-at-one-time (Singleton)? Would you add sth other?

Best regards from Hamburg.

Bastian

@tmsanchez
Copy link

HI Adam,
what's your opinion about recent changes announced for MDN? https://hacks.mozilla.org/2020/08/an-update-on-mdn-web-docs/

@t-shaguy
Copy link

t-shaguy commented Sep 7, 2020

How is ORM ( foreign keys) handled in hibernate panache

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