= ContentNegotiationServiceOrgApacheCausewayV2
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

== API

[source,java]
.ContentNegotiationServiceOrgApacheCausewayV2.java
----
class ContentNegotiationServiceOrgApacheCausewayV2 {
  public static final String ACCEPT_PROFILE;     // <.>
  Response.ResponseBuilder buildResponse(IResourceContext resourceContext, ManagedObject objectAdapter)     // <.>
  Response.ResponseBuilder buildResponse(IResourceContext resourceContext, ManagedProperty objectAndProperty)     // <.>
  Response.ResponseBuilder buildResponse(IResourceContext resourceContext, ManagedCollection managedCollection)     // <.>
  Response.ResponseBuilder buildResponse(IResourceContext resourceContext, ManagedAction objectAndAction)     // <.>
  Response.ResponseBuilder buildResponse(IResourceContext resourceContext, ObjectAndActionInvocation objectAndActionInvocation)     // <.>
  boolean canAccept(IResourceContext resourceContext)
}
----

<.> xref:#ACCEPT_PROFILE[ACCEPT_PROFILE]
+
--
Unlike RO v1.0, use a single content-type of `application/json;profile="urn:org.apache.causeway/v2"` .
--
<.> xref:#buildResponse_IResourceContext_ManagedObject[buildResponse(IResourceContext, ManagedObject)]
+
--
Domain object is returned as a map with the RO 1.0 representation as a special '$$ro' property within that map.
--
<.> xref:#buildResponse_IResourceContext_ManagedProperty[buildResponse(IResourceContext, ManagedProperty)]
+
--
Individual property of an object is not supported.
--
<.> xref:#buildResponse_IResourceContext_ManagedCollection[buildResponse(IResourceContext, ManagedCollection)]
+
--
Individual (parented) collection of an object is returned as a list with the RO representation as an object in the list with a single property named '$$ro'
--
<.> xref:#buildResponse_IResourceContext_ManagedAction[buildResponse(IResourceContext, ManagedAction)]
+
--
Action prompt is not supported.
--
<.> xref:#buildResponse_IResourceContext_ObjectAndActionInvocation[buildResponse(IResourceContext, ObjectAndActionInvocation)]
+
--
Action invocation is supported provided it returns a single domain object or a list of domain objects (ie invocations returning void or scalar value are not supported). Action invocations returning a domain object will be rendered as a map with the RO v1.0 representation as a '$$ro' property within (same as _#buildResponse(IResourceContext, ManagedObject)_ ), while action invocations returning a list will be rendered as a list with the RO v1.0 representation as a map object with a single '$$ro' property (similar to _#buildResponse(IResourceContext, ManagedCollection)_ )
--

== Members

[#ACCEPT_PROFILE]
=== ACCEPT_PROFILE

Unlike RO v1.0, use a single content-type of `application/json;profile="urn:org.apache.causeway/v2"` .

The response content types xref:refguide:applib:index/client/RepresentationTypeSimplifiedV2.adoc[RepresentationTypeSimplifiedV2] append the 'repr-type' parameter.

[#buildResponse_IResourceContext_ManagedObject]
=== buildResponse(IResourceContext, ManagedObject)

Domain object is returned as a map with the RO 1.0 representation as a special '$$ro' property within that map.

[#buildResponse_IResourceContext_ManagedProperty]
=== buildResponse(IResourceContext, ManagedProperty)

Individual property of an object is not supported.

[#buildResponse_IResourceContext_ManagedCollection]
=== buildResponse(IResourceContext, ManagedCollection)

Individual (parented) collection of an object is returned as a list with the RO representation as an object in the list with a single property named '$$ro'

[#buildResponse_IResourceContext_ManagedAction]
=== buildResponse(IResourceContext, ManagedAction)

Action prompt is not supported.

[#buildResponse_IResourceContext_ObjectAndActionInvocation]
=== buildResponse(IResourceContext, ObjectAndActionInvocation)

Action invocation is supported provided it returns a single domain object or a list of domain objects (ie invocations returning void or scalar value are not supported). Action invocations returning a domain object will be rendered as a map with the RO v1.0 representation as a '$$ro' property within (same as _#buildResponse(IResourceContext, ManagedObject)_ ), while action invocations returning a list will be rendered as a list with the RO v1.0 representation as a map object with a single '$$ro' property (similar to _#buildResponse(IResourceContext, ManagedCollection)_ )

include::hooks/ContentNegotiationServiceOrgApacheCausewayV2_usage-notes.adoc[]
