The way my project is currently configuring rest services, all providers
listed get used for all services.
How can I get more fine grained configuration?
I only want the headerValidationFilter used on the ecpCDRestServiceV1 rest
service. Right now all the rest services are getting it. Note that we use
a specific port of 8877 for our rest services.
Can someone give me some suggestions?
From applicationContext.mxl
<jaxrs:server serviceName="ecpWebServices"
address="http://0.0.0.0:8877">
<jaxrs:inInterceptors>
<ref bean="validationInInterceptor"/>
</jaxrs:inInterceptors>
<jaxrs:outInterceptors>
<ref bean="validationOutInterceptor"/>
</jaxrs:outInterceptors>
<jaxrs:serviceBeans>
<ref bean="ecpAdminRestServiceV1"/>
<ref bean="ecpApplicationRestServiceV1"/>
<ref bean="ecpEntitlementRestServiceV1"/>
<ref bean="ecpEntitlementRestServiceV2"/>
<ref bean="ecpMetricsRestServiceV1"/>
<ref bean="ecpAlertsRestServiceV1"/>
<ref bean="ecpCDRestServiceV1"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean
class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/>
<ref bean="genericRestExceptionMapper"/>
<ref bean="customValidationExceptionMapper"/>
<ref bean="headerValidationFilter"/>
</jaxrs:providers>
</jaxrs:server>
Examples of rest service declarations:
@Service
@Path("/ecp/contentdirect/v1")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class EcpCDRestServiceV1
. . .
@POST
@Path("/entitlement")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@NotNull
@Valid
public Response postEntitlement(@Context final HttpServletRequest
request,@NotNull @Valid final CsgEntitlement csgEntitlement) throws
GenericRestException
. . .
@Service
@Path("/ecp/entitlements/v1")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class EcpEntitlementRestServiceV1
. . .
@GET
@Path("/entitlements")
public Response getEntitlements(@Context final HttpServletRequest
request,
@QueryParam("divisionId") final String
eisExDivDivisionId,
@QueryParam("accountNumber") final String
accountNumber,
@QueryParam("recalculate") final Boolean
recalculate) throws GenericRestException
. . .
listed get used for all services.
How can I get more fine grained configuration?
I only want the headerValidationFilter used on the ecpCDRestServiceV1 rest
service. Right now all the rest services are getting it. Note that we use
a specific port of 8877 for our rest services.
Can someone give me some suggestions?
From applicationContext.mxl
<jaxrs:server serviceName="ecpWebServices"
address="http://0.0.0.0:8877">
<jaxrs:inInterceptors>
<ref bean="validationInInterceptor"/>
</jaxrs:inInterceptors>
<jaxrs:outInterceptors>
<ref bean="validationOutInterceptor"/>
</jaxrs:outInterceptors>
<jaxrs:serviceBeans>
<ref bean="ecpAdminRestServiceV1"/>
<ref bean="ecpApplicationRestServiceV1"/>
<ref bean="ecpEntitlementRestServiceV1"/>
<ref bean="ecpEntitlementRestServiceV2"/>
<ref bean="ecpMetricsRestServiceV1"/>
<ref bean="ecpAlertsRestServiceV1"/>
<ref bean="ecpCDRestServiceV1"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean
class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/>
<ref bean="genericRestExceptionMapper"/>
<ref bean="customValidationExceptionMapper"/>
<ref bean="headerValidationFilter"/>
</jaxrs:providers>
</jaxrs:server>
Examples of rest service declarations:
@Service
@Path("/ecp/contentdirect/v1")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class EcpCDRestServiceV1
. . .
@POST
@Path("/entitlement")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@NotNull
@Valid
public Response postEntitlement(@Context final HttpServletRequest
request,@NotNull @Valid final CsgEntitlement csgEntitlement) throws
GenericRestException
. . .
@Service
@Path("/ecp/entitlements/v1")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class EcpEntitlementRestServiceV1
. . .
@GET
@Path("/entitlements")
public Response getEntitlements(@Context final HttpServletRequest
request,
@QueryParam("divisionId") final String
eisExDivDivisionId,
@QueryParam("accountNumber") final String
accountNumber,
@QueryParam("recalculate") final Boolean
recalculate) throws GenericRestException
. . .