注意与Tridion UGC 评论完全相同的问题将作者显示为空
当发布来自演示网站的评论时,用户的 ID 为 null。这会导致下一条评论显示为来自第一个发表评论并且 ID 为 null 的用户。
cd 核心日志文件显示AnonymousPostClaimProcessor
正在使用tracking id
.
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:user, value=tridion_2151731a-97d2-4a90-800f-bee20074b970
TRACE ODataInputParser - Parsing following queryString: /Comments
TRACE BasePostClaimProcessor - User ID: tridion_2151731a-97d2-4a90-800f-bee20074b970, Request URI: /odata.svc/Comments
DEBUG PostAllowedByEveryoneClaimProcessor - Allowing user 'tridion_2151731a-97d2-4a90-800f-bee20074b970' to post on: /odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:post:allowed, value=true
DEBUG ClaimStore - put: uri=taf:response:cookie:generation, value=true
DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@74002515, thread: Thread-1
DEBUG ClaimStore - put: uri=taf:request:uri, value=/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:full_url, value=http://staging:8080/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:headers, value={content-type=[Ljava.lang.String;@3582c132, connection=[Ljava.lang.String;@1b59d510, host=[Ljava.lang.String;@26b31b77, accept=[Ljava.lang.String;@38d0357a, content-length=[Ljava.lang.String;@6d66f9b9}
DEBUG ClaimStore - put: uri=taf:request:cookies, value={}
DEBUG ClaimStore - put: uri=taf:request:parameters, value={CONTENT_TYPE=[Ljava.lang.String;@39518cc, $orderby=[Ljava.lang.String;@318efaea, QUERY_STRING=[Ljava.lang.String;@21fb3211, $filter=[Ljava.lang.String;@72940b84, $expand=[Ljava.lang.String;@558041e0, $top=[Ljava.lang.String;@576504fa, $skip=[Ljava.lang.String;@2929e5e9}
DEBUG ClaimStore - put: uri=taf:server:variables, value={REMOTE_USER=, PATH_TRANSLATED=C:\inetpub\staging_cd_webservices\odata.svc, SERVER_PORT=8080, SCRIPT_NAME=/odata.svc, REMOTE_ADDR=127.0.0.1, AUTH_TYPE=, SERVER_PROTOCOL=HTTP/1.1, REQUEST_METHOD=GET, DOCUMENT_ROOT=C:\inetpub\staging_cd_webservices, REMOTE_HOST=127.0.0.1, SERVER_NAME=staging, SECURE=false}
DEBUG ClaimStore - put: uri=taf:session:id, value=tridion_546acbc8-a478-45cd-80fa-5d93bc10481d
DEBUG ClaimStore - put: uri=taf:tracking:id, value=tridion_08092308-7e3b-47c7-9524-79497daee2e2
DEBUG ClaimStore - put: uri=taf:session:attributes, value={Tridion.ContentDelivery.AmbientData.ClaimStore=Tridion.ContentDelivery.AmbientData.ClaimStore}
DEBUG AllowAnonymousPostClaimProcessor - No external user specified, using tracking id.
我的ugc环境墨盒配置如下:
<ClaimProcessorDefinitions>
<!-- Allows anonymous posts. Disable when using a login system. -->
<ClaimProcessorDefinition Uri="taf:claimprocessor:webservice:ugc:anonymous"
ImplementationClass="com.tridion.ugc.odata.claimprocessor.AllowAnonymousPostClaimProcessor"
Description="Claim processor that allows an anonymous post.">
<RequestStart>
<OutputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user"/>
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
<!-- Post allowed by everyone. -->
<ClaimProcessorDefinition Uri="taf:claimprocessor:webservice:ugc:post"
ImplementationClass="com.tridion.ugc.odata.claimprocessor.PostAllowedByEveryoneClaimProcessor"
Description="Claim processor that allows a post.">
<RequestStart>
<InputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user"/>
</InputClaims>
<OutputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:post:allowed"/>
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
</ClaimProcessorDefinitions>
cm ugc Web 服务的 ugc 墨盒配置是相同的,但会显示正确的 ID。
如果任何人都可以指导我到正确的配置文件进行验证,那就太好了。
编辑 27/7
演示文稿 cd ws 上的 ugc 环境墨盒配置如下,并定义了 AllowAnonymousPostClaimProcessor。
<?xml version="1.0" encoding="UTF-8"?>
<CartridgeDefinition Version="6.1" Uri="tcd:cartridge:ugc" Description="UGC cartridge."
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemas/cd_ambient_cartridge_conf.xsd">
<ClaimDefinitions>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:post:allowed" Scope="REQUEST"
Description="A flag where a POST is allowed to the UGC OData entities."/>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user" Scope="REQUEST"
Description="The user posting to the OData service."/>
<ClaimDefinition Uri="taf:claim:tracking:internalcontactid" Scope="REQUEST"
Description="The Audience Manager internal contact id."/>
<ClaimDefinition Uri="taf:claim:tracking:updatedcontact:xml" Scope="REQUEST"
Description="The Audience Manager updated contact xml."/>
</ClaimDefinitions>
<ClaimProcessorDefinitions>
<!-- Allows anonymous posts. Disable when using a login system. -->
<ClaimProcessorDefinition Uri="taf:claimprocessor:webservice:ugc:anonymous"
ImplementationClass="com.tridion.ugc.odata.claimprocessor.AllowAnonymousPostClaimProcessor"
Description="Claim processor that allows an anonymous post.">
<RequestStart>
<OutputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user"/>
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
<!-- Post allowed by owners. -->
<!--
<ClaimProcessorDefinition Uri="taf:claimprocessor:webservice:ugc:post"
ImplementationClass="com.tridion.ugc.odata.claimprocessor.PostAllowedByOwnerClaimProcessor"
Description="Claim processor that determines if a post is allowed by checking if the user is the owner.">
<RequestStart>
<InputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user"/>
</InputClaims>
<OutputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:post:allowed"/>
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
-->
<!-- Post allowed by everyone. -->
<ClaimProcessorDefinition Uri="taf:claimprocessor:webservice:ugc:post"
ImplementationClass="com.tridion.ugc.odata.claimprocessor.PostAllowedByEveryoneClaimProcessor"
Description="Claim processor that allows a post.">
<RequestStart>
<InputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user"/>
</InputClaims>
<OutputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:post:allowed"/>
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
</ClaimProcessorDefinitions>
</CartridgeDefinition>
以及请求的 POST 日志文件:
DEBUG ClaimStore - put: uri=taf:response:cookie:generation, value=true
DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@29578426, thread: Thread-6
DEBUG ClaimStore - put: uri=taf:request:uri, value=/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:full_url, value=http://staging:8080/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:headers, value={expect=[Ljava.lang.String;@30a4effe, content-type=[Ljava.lang.String;@1c8825a5, host=[Ljava.lang.String;@2e5f8245, accept=[Ljava.lang.String;@6197cc, content-length=[Ljava.lang.String;@734d246}
DEBUG ClaimStore - put: uri=taf:request:cookies, value={}
DEBUG ClaimStore - put: uri=taf:request:parameters, value={CONTENT_TYPE=[Ljava.lang.String;@1cd8f55c, QUERY_STRING=[Ljava.lang.String;@67d479cf}
DEBUG ClaimStore - put: uri=taf:server:variables, value={REMOTE_USER=, PATH_TRANSLATED=C:\inetpub\staging_cd_webservices\odata.svc\Comments, SERVER_PORT=8080, SCRIPT_NAME=/odata.svc/Comments, REMOTE_ADDR=127.0.0.1, AUTH_TYPE=, SERVER_PROTOCOL=HTTP/1.1, REQUEST_METHOD=POST, DOCUMENT_ROOT=C:\inetpub\staging_cd_webservices, REMOTE_HOST=127.0.0.1, SERVER_NAME=staging, SECURE=false}
DEBUG ClaimStore - put: uri=taf:session:id, value=tridion_51f52143-1095-4585-9eb8-b01f95dff721
DEBUG ClaimStore - put: uri=taf:tracking:id, value=tridion_f409708f-4063-4eca-8c81-f140ba4a6568
DEBUG AllowAnonymousPostClaimProcessor - No external user specified, using tracking id.
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:user, value=tridion_f409708f-4063-4eca-8c81-f140ba4a6568
TRACE ODataInputParser - Parsing following queryString: /Comments
TRACE BasePostClaimProcessor - User ID: tridion_f409708f-4063-4eca-8c81-f140ba4a6568, Request URI: /odata.svc/Comments
DEBUG PostAllowedByEveryoneClaimProcessor - Allowing user 'tridion_f409708f-4063-4eca-8c81-f140ba4a6568' to post on: /odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:post:allowed, value=true
DEBUG ClaimStore - put: uri=taf:response:cookie:generation, value=true
DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@2e893a4a, thread: Thread-6
DEBUG ClaimStore - put: uri=taf:request:uri, value=/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:full_url, value=http://staging:8080/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:headers, value={expect=[Ljava.lang.String;@3351e824, content-type=[Ljava.lang.String;@465fadce, host=[Ljava.lang.String;@338bd37a, accept=[Ljava.lang.String;@20e90906, content-length=[Ljava.lang.String;@234f79cb}
DEBUG ClaimStore - put: uri=taf:request:cookies, value={ASP.NET_SessionId=wx00dumyccjnopshos2ucw4l}
DEBUG ClaimStore - put: uri=taf:request:parameters, value={CONTENT_TYPE=[Ljava.lang.String;@36c51089, QUERY_STRING=[Ljava.lang.String;@43c0ae76}
DEBUG ClaimStore - put: uri=taf:server:variables, value={REMOTE_USER=, PATH_TRANSLATED=C:\inetpub\staging_cd_webservices\odata.svc, SERVER_PORT=8080, SCRIPT_NAME=/odata.svc, REMOTE_ADDR=127.0.0.1, AUTH_TYPE=, SERVER_PROTOCOL=HTTP/1.1, REQUEST_METHOD=POST, DOCUMENT_ROOT=C:\inetpub\staging_cd_webservices, REMOTE_HOST=127.0.0.1, SERVER_NAME=staging, SECURE=false}
DEBUG ClaimStore - put: uri=taf:session:id, value=tridion_90269b03-0f48-4986-a607-ec04010a9161
DEBUG ClaimStore - put: uri=taf:tracking:id, value=tridion_9a97ffcb-7c38-41b6-95dd-8bd6d564a163
DEBUG ClaimStore - put: uri=taf:session:attributes, value={Tridion.ContentDelivery.AmbientData.ClaimStore=Tridion.ContentDelivery.AmbientData.ClaimStore}
DEBUG AllowAnonymousPostClaimProcessor - No external user specified, using tracking id.
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:user, value=tridion_9a97ffcb-7c38-41b6-95dd-8bd6d564a163
TRACE ODataInputParser - Parsing following queryString: /Comments
TRACE BasePostClaimProcessor - User ID: tridion_9a97ffcb-7c38-41b6-95dd-8bd6d564a163, Request URI: /odata.svc/Comments
DEBUG PostAllowedByEveryoneClaimProcessor - Allowing user 'tridion_9a97ffcb-7c38-41b6-95dd-8bd6d564a163' to post on: /odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:post:allowed, value=true
DEBUG ODataService - ODATA.NET: Inserting entity on path: Comments
DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@2e893a4a, thread: Thread-2
TRACE ODataInputParser - Parsing following queryString: Comments
DEBUG WritableCommentEntryService - Parsing comment: {d:{"Id":0,"ItemPublicationId":11,"ItemId":361,"ItemType":64,"CreationDate":"\/Date(1343385654263+60)\/","LastModifiedDate":"\/Date(1343385654263+60)\/","User":{"Id":null,"Name":"John Doe","EmailAddress":"bla@bla.com","ExternalId":null},"Content":"sdfsdfsdf","Moderator":null,"ModeratedDate":null,"Score":0,"Status":0}}.
DEBUG UGCConfigurationLoader - Attempt loading default storage configuration file
DEBUG WritableCommentEntryService - Storing comment: Comment [commentId=0, content=sdfsdfsdf, itemPublicationId=11, itemId=361, itemType=64, author=com.tridion.storage.ugc.UGCUser@2537e19e, creationDate=Fri Jul 27 11:40:54 BST 2012, lastModifiedDate=Fri Jul 27 11:40:54 BST 2012, moderatedDate=null, moderator=null, score=0, status=0].
DEBUG JPACommentDAO - Add comment to storage: Comment [commentId=0, content=sdfsdfsdf, itemPublicationId=11, itemId=361, itemType=64, author=com.tridion.storage.ugc.UGCUser@2537e19e, creationDate=Fri Jul 27 11:40:54 BST 2012, lastModifiedDate=Fri Jul 27 11:40:54 BST 2012, moderatedDate=null, moderator=null, score=0, status=0].
DEBUG JPAUserDAO - Searching for user with id null in storage.
TRACE JPABaseDAO - [ActionTimer] Query List Result time: 10275376 nanoseconds (10.275376 milliseconds)
DEBUG JPAUserDAO - User already in storage. No need to create new one.
您可以在某些时候看到用户 ID 为空,在发布评论数据时已经如此。