Skip to content

How can I configure an Engine to connect my custom MediaType with DTO class? #966

Open
@Krasnyanskiy

Description

@Krasnyanskiy

Hi guys!

I'm stuck with Restlet Engine configuration. Let me show my simple code

Engine.getInstance().getRegisteredClients().clear();
Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null));
Engine.getInstance().getRegisteredConverters().add(new JacksonConverter());

ClientResource resource = new ClientResource(path);
ChallengeScheme scheme = ChallengeScheme.HTTP_BASIC;
ChallengeResponse auth = new ChallengeResponse(scheme, "user", "secret");

resource.setChallengeResponse(auth);
resource.getClientInfo().getAcceptedMediaTypes().add(new Preference<MediaType>(MediaType.register("application/repo.input+xml", "Type of DTO")));
ClientControl entity = resource.get(ClientControl.class);
System.out.println(entity);

But I'm get null entity and this

WARNING: Unable to find a converter for this representation : [application/repo.input+xml]

How can I retrieve an entity regarding to the proper MediaType?

Thanks,
Alex

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions