DominoKit / domino-rest

domino-rest
Apache License 2.0
28 stars 5 forks source link

Domino rest should not generate code for @GwtIncompatible #49

Open natros opened 4 years ago

natros commented 4 years ago

Domino rest should not generate code for @GwtIncompatible, so I can exclude jaxrs-super and use jakarta.ws.rs:jakarta.ws.rs-api that contains javax.ws.rs.core.Response

implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6'
compileOnly('org.dominokit:domino-rest-gwt:1.0-rc.4-SNAPSHOT') {
    exclude group: 'org.dominokit', module: 'jaxrs-super'
}
@RequestFactory
@Path("/users")
@Produces("application/json")
@Consumes("application/json")
public interface UserResource {
  //...
  @GET
  @Produces("application/pdf")
  @GwtIncompatible
  Response downloadPdf();
}
vegegoku commented 4 years ago

I would assume that Response int the sample above is from jakarta package and you want to avoid GWT compilation issue here. is this because you want Response support and you want to download a PDF using domino-rest?

natros commented 4 years ago

afaik oracle forbids names that contains java or javax and jakarta is the replacement. instead of javax.ws.rs:jsr311-api, javax.ws.rs:javax.ws.rs-api I use jakarta.ws.rs:jakarta.ws.rs-api.

I want to avoid gwt compiling javax.ws.rs.core.Response and I don't want to use domino-rest to download the pdf. The pdf is download with a link.

That's what I do with restygwt to share the rest api between the client and the server. For UserResource in the shared module I have a UserResourceImpl that implements UserResource

thanks.

vegegoku commented 4 years ago

Domino-rest generate the client for the JVM too, so if we dont generate from methods marked with @GwtIncompatible we will break the generated client for all other targets that are not GWT, so if instead we mark the generated code as @GwtIncompatible will that be sufficient?

natros commented 4 years ago

I tried inserting the @GwtIncompatible in UserResourceFactory but the GWT compiler always complains about the missing javax.ws.rs.core.Response. It seems to work well for interfaces but not implementation. I found a better solution that worked without any @GwtIncompatible annotation. I just created an empty Response class inside the package javax.ws.rs.core with a .gwt.xml file.

Feel free to close this issue. Thanks.

vegegoku commented 4 years ago

https://github.com/DominoKit/domino-rest/issues/45