[jbosstools-issues] [JBoss JIRA] (JBIDE-16734) JAX-RS Validation: should report an error when resource is annotated with @javax.inject.Singleton and has JAX-RS fields

Xavier Coulon (JIRA) issues at jboss.org
Tue Mar 11 05:31:10 EDT 2014


     [ https://issues.jboss.org/browse/JBIDE-16734?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Xavier Coulon updated JBIDE-16734:
----------------------------------

    Description: 
JAX-RS Validation: should report an error when resource is annotated with @javax.inject.Singleton and has JAX-RS fields.

Eg:
{code}
@Path("resource")
@Singleton
public static class MySingletonResource {
 
    @QueryParam("query")
    String param; // WRONG: initialization of application will fail as you cannot
                  // inject request specific parameters into a singleton resource.
 
    @GET
    public String get() {
        return "query param: " + param;
    }
}
{code}

The exception exists for specific request objects which can injected even into constructor or class fields. For these objects the runtime will inject proxies which are able to simultaneously server more request. These request objects are HttpHeaders, Request, UriInfo, SecurityContext. These proxies can be injected using the @Context annotation

  was:
JAX-RS Validation: should report an error when resource is annotated with @javax.inject.Singleton and has JAX-RS fields.

Eg:
{code}
@Path("resource")
@Singleton
public static class MySingletonResource {
 
    @QueryParam("query")
    String param; // WRONG: initialization of application will fail as you cannot
                  // inject request specific parameters into a singleton resource.
 
    @GET
    public String get() {
        return "query param: " + param;
    }
}
{code}


    
> JAX-RS Validation: should report an error when resource is annotated with @javax.inject.Singleton and has JAX-RS fields
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBIDE-16734
>                 URL: https://issues.jboss.org/browse/JBIDE-16734
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: webservices
>    Affects Versions: 4.1.1.Final
>            Reporter: Xavier Coulon
>            Assignee: Xavier Coulon
>             Fix For: 4.2.x
>
>
> JAX-RS Validation: should report an error when resource is annotated with @javax.inject.Singleton and has JAX-RS fields.
> Eg:
> {code}
> @Path("resource")
> @Singleton
> public static class MySingletonResource {
>  
>     @QueryParam("query")
>     String param; // WRONG: initialization of application will fail as you cannot
>                   // inject request specific parameters into a singleton resource.
>  
>     @GET
>     public String get() {
>         return "query param: " + param;
>     }
> }
> {code}
> The exception exists for specific request objects which can injected even into constructor or class fields. For these objects the runtime will inject proxies which are able to simultaneously server more request. These request objects are HttpHeaders, Request, UriInfo, SecurityContext. These proxies can be injected using the @Context annotation

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list