org.glassfish.jersey.server.model.ResourceModel Java Examples

The following examples show how to use org.glassfish.jersey.server.model.ResourceModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KrazoModelProcessor.java    From krazo with Apache License 2.0 5 votes vote down vote up
@Override
public ResourceModel processResourceModel(ResourceModel resourceModel, Configuration configuration) {
    ResourceModel.Builder rmb = new ResourceModel.Builder(false);
    resourceModel.getResources().forEach(r -> {
        rmb.addResource(processResource(r));
    });
    return rmb.build();
}
 
Example #2
Source File: KrazoModelProcessorTest.java    From krazo with Apache License 2.0 5 votes vote down vote up
@Test
public void processResourceModel() {
	ResourceModel.Builder rmb = new ResourceModel.Builder(false);
	Resource resource = Resource.builder(SomeController.class).build();
	rmb.addResource(resource);
	ResourceModel processedModel = new KrazoModelProcessor().processResourceModel(rmb.build(), null);
	Resource processedResource = processedModel.getResources().get(0);
	processedResource.getResourceMethods().forEach(m -> assertTrue(m.getProducedTypes().contains(MediaType.TEXT_HTML_TYPE)));
}
 
Example #3
Source File: OzarkModelProcessor.java    From ozark with Apache License 2.0 5 votes vote down vote up
@Override
public ResourceModel processResourceModel(ResourceModel resourceModel, Configuration configuration) {
    ResourceModel.Builder rmb = new ResourceModel.Builder(false);
    resourceModel.getResources().forEach(r -> {
        rmb.addResource(processResource(r));
    });
    return rmb.build();
}
 
Example #4
Source File: OzarkModelProcessorTest.java    From ozark with Apache License 2.0 5 votes vote down vote up
@Test
public void processResourceModel() {
	ResourceModel.Builder rmb = new ResourceModel.Builder(false);
	Resource resource = Resource.builder(SomeController.class).build();
	rmb.addResource(resource);
	ResourceModel processedModel = new OzarkModelProcessor().processResourceModel(rmb.build(), null);
	Resource processedResource = processedModel.getResources().get(0);
	processedResource.getResourceMethods().forEach(m -> assertTrue(m.getProducedTypes().contains(MediaType.TEXT_HTML_TYPE)));
}
 
Example #5
Source File: JerseyRouteExecutionStrategyUtils.java    From servicetalk with Apache License 2.0 4 votes vote down vote up
@Override
public void visitResourceModel(final ResourceModel resourceModel) {
    processComponents(resourceModel);
}
 
Example #6
Source File: KrazoModelProcessor.java    From krazo with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceModel processSubResource(ResourceModel subResourceModel, Configuration configuration) {
    return subResourceModel;
}
 
Example #7
Source File: OzarkModelProcessor.java    From ozark with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceModel processSubResource(ResourceModel subResourceModel, Configuration configuration) {
    return subResourceModel;
}
 
Example #8
Source File: OptionsMethodProcessor.java    From ameba with MIT License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ResourceModel processResourceModel(ResourceModel resourceModel, Configuration configuration) {
    return ModelProcessorUtil.enhanceResourceModel(resourceModel, false, methodList, true).build();
}
 
Example #9
Source File: OptionsMethodProcessor.java    From ameba with MIT License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ResourceModel processSubResource(ResourceModel subResourceModel, Configuration configuration) {
    return ModelProcessorUtil.enhanceResourceModel(subResourceModel, true, methodList, true).build();
}
 
Example #10
Source File: ApplicationEvent.java    From ameba with MIT License 2 votes vote down vote up
/**
 * <p>getResourceModel.</p>
 *
 * @return a {@link org.glassfish.jersey.server.model.ResourceModel} object.
 */
public ResourceModel getResourceModel() {
    return event.getResourceModel();
}