Define servlet via annotation @WebServlet in bitbucket plugin

Hi Community!
Is it possible to define my servlet in bitbucket plugin via annotation javax.servlet.annotation.WebServlet (since servlet-api 3.0) ? I couldn’t find any documentation.
Bitbucket 5.4.0 and newer support javax.servlet-api 3+ version .

Current solution in atlassian-plugin.xml:

<servlet key="settings-servlet" class="com.example.SettingsServlet">
        <url-pattern>/settings/*</url-pattern>
    </servlet>

Desired solution:

@WebServlet("/settings/*")
public class SettingsServlet extends HttpServlet {
  // my logic
}

Kind regards

1 Like