Reputation: 101
I'm having a problem with a custom RestResource. I want to replace the OOTB UserRestResource with my own implementation. When nucleus starts up I get the following exception:
Scan failed to process nucleus rest resource class:class com.test.restresources.UserRestResource
path:/atg/userprofiling/restresources/UserRestResource
atg.service.jaxrs.RestException: Endpoint annotated method without a http method annotation
The class has the following implementation:
@RestResource(id = "com.pki.ebusiness.ocs.restresources.userRestResource")
@Path("/users")
@Api(value="/users")
public class UserRestResource extends GenericService {
private UserRepository mUserRepository;
private DomainObjectMapper mObjectMapper = DomainObjectMapper.INSTANCE;
@GET
@Path("/{userId}")
@Endpoint(id = "/users/{userId}#GET", isSingular = true, filterId = "users.id-Default")
@ApiOperation("Retrieve a user for given ID.")
public RepresentationModel getUser(@PathParam("userId") String pUserId){
User user = null;
try {
user = mUserRepository.getUser(pUserId);
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (BaseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
UserDto userDto = mObjectMapper.convert(user);
Builder builder = (new Builder()).state(userDto);
return builder.build();
}
}
While debugging the RestResourceRegistry I found that it is not able to find the Path annotation even though it is there.
Upvotes: 1
Views: 561
Reputation: 960
To this atg/dynamo/service/jaxrs/RestResourceRegistry.properties
add nucleusProviders+=security/CsrfProtectionFilter
.
This is an issue in OC 11.3.
In addition to the above add the following entry to JerseyClassLoaderService.properties
:
classpathFiles+=\
{appModuleResource?moduleID=YourBase.ModuleName&resourceURI=lib/make-jersey-classloader.jar}
Upvotes: 0