Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-10686

[Validation] Show error when trying to inject unsupported type with @Context

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 3.3.0.M5
    • Fix Version/s: 3.3.0.Beta1
    • Component/s: webservices
    • Labels:
      None

      Description

      The @Context annotation allows to inject instances of javax.ws.rs.core.HttpHeaders, javax.ws.rs.core.UriInfo, javax.ws.rs.core.Request, javax.servlet.HttpServletRequest, javax.servlet.HttpServletResponse, javax.servlet.ServletConfig, javax.servlet.ServletContext, and javax.ws.rs.core.SecurityContext objects.

      If the code is something like that:

      	@POST
      	public Response save(Content content, @Context UriInfo uri, @Context UriBuilder uriBuilder) {
               ...
              }
      

      then the JAX-RS implementation will set 'uriBuilder' not null, which will probably lead to a NullPointerException somewhere in the method code..

      The JAX-RS plugin should report a warning/error to check that the injected type is limited to the list given above.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jjankovi Jaroslav Jankovič
                Reporter:
                xcoulon Xavier Coulon
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: