<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Is there ever need to attach more than one body Encoder implementation to particular Codec annotation in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247873#M149236</link>
    <description>&lt;P&gt;Hi all, one more tech question related to talend component runtime and api implementation. Take for example particular Encoder implementation that encodes body payload into intended format (x-www-form-urlencoded).&lt;/P&gt; 
&lt;P&gt;Q1) Why &lt;STRONG&gt;@Codec&lt;/STRONG&gt; annotation attribute encoder expects array of encoders?&lt;/P&gt; 
&lt;P&gt;If may payload has type CustomType and I attach CustomeTypeToXWWFormURLEncoder what is purpose of array?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I see that RequestParser should resolve proper encoder for given content, but by reading the code I don't see the way for request parser to filter other than first Encoder given in encoder attribute.&lt;/P&gt; 
&lt;P&gt;Q2) What is purpose of&amp;nbsp;&lt;STRONG&gt;@ContentType&lt;/STRONG&gt; annotation?&lt;/P&gt; 
&lt;P&gt;I thought (as it is not documented) that Decoder or Encoder implementations should be annotated with it so the component-runtime knows out of the box which Encoder is applicable for particular body content type and payload or returned response body.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;It would be nice to understand Talend API. If any of Talend sw engineers could give more insight into HttpClient and&amp;nbsp;@Codec I would be really thankful.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
    <pubDate>Fri, 02 Jan 2026 14:45:42 GMT</pubDate>
    <dc:creator>igorbeslic</dc:creator>
    <dc:date>2026-01-02T14:45:42Z</dc:date>
    <item>
      <title>Is there ever need to attach more than one body Encoder implementation to particular Codec annotation</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247873#M149236</link>
      <description>&lt;P&gt;Hi all, one more tech question related to talend component runtime and api implementation. Take for example particular Encoder implementation that encodes body payload into intended format (x-www-form-urlencoded).&lt;/P&gt; 
&lt;P&gt;Q1) Why &lt;STRONG&gt;@Codec&lt;/STRONG&gt; annotation attribute encoder expects array of encoders?&lt;/P&gt; 
&lt;P&gt;If may payload has type CustomType and I attach CustomeTypeToXWWFormURLEncoder what is purpose of array?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I see that RequestParser should resolve proper encoder for given content, but by reading the code I don't see the way for request parser to filter other than first Encoder given in encoder attribute.&lt;/P&gt; 
&lt;P&gt;Q2) What is purpose of&amp;nbsp;&lt;STRONG&gt;@ContentType&lt;/STRONG&gt; annotation?&lt;/P&gt; 
&lt;P&gt;I thought (as it is not documented) that Decoder or Encoder implementations should be annotated with it so the component-runtime knows out of the box which Encoder is applicable for particular body content type and payload or returned response body.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;It would be nice to understand Talend API. If any of Talend sw engineers could give more insight into HttpClient and&amp;nbsp;@Codec I would be really thankful.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jan 2026 14:45:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247873#M149236</guid>
      <dc:creator>igorbeslic</dc:creator>
      <dc:date>2026-01-02T14:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is there ever need to attach more than one body Encoder implementation to particular Codec annotation</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247874#M149237</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LPOuAAO"&gt;@igorbeslic&lt;/A&gt;,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks for your question. Can I ask which application you are referring to? Is it the API Services or are you talking about a data integration component? It seems like you are talking about W3 standards and in regard to Content-Type, this will hopefully explain that question&amp;nbsp;&lt;A href="https://www.w3.org/Protocols/rfc1341/4_Content-Type.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.w3.org/Protocols/rfc1341/4_Content-Type.html&lt;/A&gt;.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;If you can elaborate on what your question regards to (the Talend product), I may be able to offer some more help&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regards&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 15:01:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247874#M149237</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-12T15:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Is there ever need to attach more than one body Encoder implementation to particular Codec annotation</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247875#M149238</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&amp;nbsp;I developed custom input component. I test that component in Talend Open Studio for ESB 7.2.1.&lt;/P&gt; 
&lt;P&gt;Component connects to Liferay portal REST services and reads data from particular end point.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;For the purpose of OAuth2 authorization, my component needs to obtain oauth2 access_token to proceed further data exchange with Bearer token.&lt;/P&gt; 
&lt;P&gt;To achieve mentioned I had to implement my own Encoder implementation:&lt;/P&gt; 
&lt;PRE&gt;import com.liferay.talend.datastore.OAuthDataStore;
import com.liferay.talend.http.client.exception.EncoderException;

import org.talend.sdk.component.api.service.http.Encoder;

/**
 * @author Igor Beslic
 */
public class XWWWFormURLEncoder implements Encoder {

	@Override
	public byte[] encode(Object o) throws EncoderException {
		if (o instanceof OAuthDataStore) {
			return _encode((OAuthDataStore)o);
		}

		throw new EncoderException(
			"Unable to encode payload of type " + o.getClass());
	}
        private byte[] _encode(OAuthDataStore oAuthDataStore) {....}
}&lt;/PRE&gt; 
&lt;P&gt;and attach it to httpClient extension:&lt;/P&gt; 
&lt;PRE&gt;import com.liferay.talend.datastore.OAuthDataStore;
import com.liferay.talend.http.client.codec.XWWWFormURLEncoder;

import javax.json.JsonObject;

import org.talend.sdk.component.api.service.http.Codec;
import org.talend.sdk.component.api.service.http.Header;
import org.talend.sdk.component.api.service.http.HttpClient;
import org.talend.sdk.component.api.service.http.Path;
import org.talend.sdk.component.api.service.http.Request;
import org.talend.sdk.component.api.service.http.Response;

/**
 * @author Igor Beslic
 */
public interface LiferayHttpClient extends HttpClient {

	@Codec(encoder = XWWWFormURLEncoder.class)
	@Request(method = "POST", path = "/o/oauth2/token")
	public Response&amp;lt;JsonObject&amp;gt; getAccessToken(
		@Header("Content-Type") String contentType,
		OAuthDataStore oAuthDataStore);

	@Request
	public Response&amp;lt;JsonObject&amp;gt; getData(
		@Header("Authorization") String authorizationHeader,
		@Header("Accept") String acceptHeader, @Path("") String path);

}&lt;/PRE&gt; 
&lt;P&gt;From perspective of my getAccessToken method, only one Encoder will do the magic: XWWWFormUrlEncoder. I'm only curious if there is really use case that would require component developer to provide more than one Encoder implementation.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&amp;nbsp;one additional question: I mentioned HttpClient interface, and I wonder is it possible to provide end point path to&amp;nbsp;@Request annotated method in a flexible way (to avoid hardcoding endpoint in&amp;nbsp;@Request annotation). I ask it, because Liferay portal has only core endpoints known during component development time.&amp;nbsp;Many of endpoint depend on final portal implementation done by customer.&lt;/P&gt; 
&lt;P&gt;Please see my getData method... I added parameter annotated with&amp;nbsp;@Path to show you what is my idea.&lt;/P&gt; 
&lt;P&gt;For now I provided workaround: I do not specify Path at all, but provide full REST endpoint URL to&amp;nbsp;LiferayHttpClient.base() method.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thank you very much for your assistance!&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 09:09:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247875#M149238</guid>
      <dc:creator>igorbeslic</dc:creator>
      <dc:date>2019-04-15T09:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Is there ever need to attach more than one body Encoder implementation to particular Codec annotation</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247876#M149239</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LPOuAAO"&gt;@igorbeslic&lt;/A&gt;,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Sorry about my previous post. I neglected to look at which board it was in. I was working from a basis of looking for posts which had not been answered, rather than looking through the boards. Also, thanks for your posts in the Component Development board. These will help others when they are facing the same issues as you.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;First of all, in answer to multiple codecs I would offer the situation displayed in this documentation&amp;nbsp;&lt;A href="http://repo.apache.maven.org/maven2/org/talend/sdk/component/documentation/1.1.8/documentation-1.1.8-all-in-one.pdf" target="_blank" rel="nofollow noopener noreferrer"&gt;http://repo.apache.maven.org/maven2/org/talend/sdk/component/documentation/1.1.8/documentation-1.1.8-all-in-one.pdf&lt;/A&gt;. If you search for HttpClient, there is an example of a POST service with an Encode and Decoder codec. One for the message entering and one for the response.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;With regard to the endpoint, I will first admit that this is not a speciality of mine. However I have understood that this is used in this context to identify the method being called. Having something dynamic here would defeat the purpose of that&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regards&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 11:21:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247876#M149239</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-15T11:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is there ever need to attach more than one body Encoder implementation to particular Codec annotation</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247877#M149240</link>
      <description>&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&amp;nbsp;example at page 155 answers my second question.. So&amp;nbsp;@Path annotated argument would replace param&amp;nbsp;in path template in&amp;nbsp;@Request annotation... OK. It gives enough flexibility &lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 14:12:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Is-there-ever-need-to-attach-more-than-one-body-Encoder/m-p/2247877#M149240</guid>
      <dc:creator>igorbeslic</dc:creator>
      <dc:date>2019-04-15T14:12:43Z</dc:date>
    </item>
  </channel>
</rss>

