3

I'm in the process of upgrading a Tridion 2013 SP1 HR1 based site to SDL Web 8.5. The current delivery environment is based on .jsp files. I'm attempting to use the CIL libraries but I'm having trouble with the Component Link tag. The CIL is thowing 400 Bad Request Errors:

2017-04-10 16:02:39,771 DEBUG BasicEndpointCaller - Preparing the call endpoint for given url: http://10.215.21.21:8081/client/v4/content.svc/GetComponentLinkFunctionImport(PublicationId='7',SourcePageId='237',TargetComponentId='9385',ExcludeTemplateId='100528',LinkTagAttributes='',LinkText='%3Cimg+src%3D%22%2Fshowcase%2Fassets%2Fhome_rotator_bike-rentals_tcm7-307.jpg%22++class%3D%22img-responsive+home-image%22+alt%3D%22Feature+image+for+Home+headline+1%22+%2F%3E',ShowTextOnFail='true',ShowAnchor='true')

2017-04-10 16:02:39,787 DEBUG BasicEndpointCaller - Request ended with 400 status code.

The microservices are otherwise working as expected, some DCP tags are rendered properly earlier in the .jsp page. It is pretty obvious to me why I get this error, the url constructed for the content microservice call contains a lot of markup that came from the child img tag within the Component Link (linktext attribute) which make it an invalid url.

Here is the tag that is causing the error as it is rendered on the .jsp page:

<tridion:ComponentLink pageURI="tcm:7-237-64" componentURI="tcm:7-9385" templateURI="tcm:7-100528-32" addAnchor="true" linkText="&lt;img src=&#34;/showcase/assets/home_rotator_bike-rentals_tcm7-307.jpg&#34;  class=&#34;img-responsive home-image&#34; alt=&#34;Feature image for Home headline 1&#34; /&gt;" linkAttributes="" textOnFail="true"/>

I tried messing with the encoding to see if I could get it to go through but then I end up with encoded HTML which does not display properly in the browser.

Anyone have any thoughts? Is this not an appropriate use of the CIL? Do I need to go back to the deprecated in-process API role?

Thanks!

  • Also, if I remove the html and replace with just text the same ComponentLink tag works fine. – Nate Niemi Apr 11 '17 at 15:01
  • Sounds like a defect if you ask me - did you contact support? – Nuno Linhares Apr 11 '17 at 18:08
  • I have not. I will give that a shot. – Nate Niemi Apr 11 '17 at 18:35
6

The issue here appears to be having URL in the Link text. Current implementation of CIL does encode link text but since we have URL, it needs double encoding so that CIS can handle the request.

As a workaround, this link text can be encoded before passing it to the API. As a result, the response will contain encoded link text which needs to be decoded again.

Ref: https://docs.oracle.com/javase/8/docs/api/java/net/URLEncoder.html

As another workaround, can you try adding below JVM args when starting content service ? This can be done by adding this to $jvmoptions section in start.ps1 which can be used to start the service.

-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true
  • 1
    Thanks. This is the path I was considering but I'm trying to do an upgrade and wanted to use the standard SDL Web Tag Libraries, not have to re-implement them to deal with encoding. Support is still evaluating the issue so hopefully there is another solution. – Nate Niemi Apr 14 '17 at 14:24
  • Updated above answer with another potential workaround. – vinayknl Apr 19 '17 at 13:19
  • 1
    The JVM args did the trick. Could explain the need for "-Dspring.profiles.active=performance?" The other two are pretty self explanatory. – Nate Niemi Apr 19 '17 at 19:33
  • That bit is not required :) Just came in from the config I was trying. Will edit the answer. – vinayknl Apr 19 '17 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.