0

How are you? I have a problem that I'm looking for a definitive answer for long days without success and because this I came here to ask for your help!

Some informations: Java Web Project, with JAVA 8, Tomcat 8.5.23 and IntelliJ as my UI.

The Project: It has 3 modules, one library that have all common code and it's used for other 2 ones (the schema can be viewed bellow)

Project Schema

The problem: I implemented a Websocket that will work as a notifier in some pages, but I needed to replicate the same code for each package (WebModule 1 and WebModule 2) in them SRC folder, I didn't find a way to put this code in my Library module (Library/src/sockets/websocket) because I have no idea how configure the web.xml for Tomcat is able to identify my socket (@ServerEndpoint) in a specific path (my library package), like jersey configuration or something like that.

Is it a way to do that? Could you help me?

Thanks a lot...

Best regards,

Alex Florindo

1 Answers1

0

The way I have done that is to put the un-annotated class/function into the library code, and then extend the class where you want it with the annotations. The derived class does not need to contain any code.

Derived class:

@ServerEndpoint(...)
class MyServerEndpoint extends LibraryServerEndpoint
{
}
Jamie
  • 1,888
  • 1
  • 18
  • 21