<?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 Re: Setting up HttpRequestConfiguration to ArcGIS Android SDK for security in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/setting-up-httprequestconfiguration-to-arcgis/m-p/28884#M220</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume you are trying to use the ArcGIS Proxy Service using a self hosted proxy service?&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/authentication/working-with-proxies/#selfhosted-proxy-service" title="https://developers.arcgis.com/authentication/working-with-proxies/#selfhosted-proxy-service"&gt;Working with Proxy Services | ArcGIS for Developers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, this is currently not supported in the 10.2.x Android SDK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However you may be able to do one of the following:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. Change the self hosted proxy service on the server to accept a valid HTTP query parameter for the URL to the actual resource you want to access. Currently the default just appends the URL of the service on to the end of the URL of the proxy without a parameter name (e.g. its &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fproxyurl.com%3Fhttp%3A%2F%2Fserviceurl.com" rel="nofollow" target="_blank"&gt;http://proxyurl.com?http://serviceurl.com&lt;/A&gt;&lt;SPAN&gt; rather than something like &lt;/SPAN&gt;&lt;A href="http://proxyurl.com/?http://serviceurl.com" title="http://proxyurl.com/?http://serviceurl.com"&gt;http://proxyurl.com/?url=http://serviceurl.com&lt;/A&gt; - note the addition of the "url=" in the second url).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Add the proxy service URL in the same format as the proxy page requires to each request to the resource in the &lt;A href="https://developers.arcgis.com/android/api-reference/reference/com/esri/core/io/HttpRequestListener.html#onRequestInterception(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext)"&gt;onRequestInterception()&lt;/A&gt; method of the HttpRequestListener. This gets fired for every http request, you can check what the outgoing URL is to see if its the resource you are interested in, and then modify the request as required.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Mar 2016 21:57:53 GMT</pubDate>
    <dc:creator>WillCrick</dc:creator>
    <dc:date>2016-03-28T21:57:53Z</dc:date>
    <item>
      <title>Setting up HttpRequestConfiguration to ArcGIS Android SDK for security</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/setting-up-httprequestconfiguration-to-arcgis/m-p/28883#M219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am developing an app that uses some features of esri android sdk, I know there is some ways to provide security to my esri services (eg. user credentials , token etc.) So my question is another way to provide security.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Esri Android SDK has &lt;STRONG&gt;HttpRequestHandler to &lt;SPAN style="color: #333333; font-family: arial, sans-serif; font-size: 13px;"&gt;access to some features of HTTP requests. &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 13px; font-family: arial, sans-serif;"&gt;&lt;STRONG&gt;&lt;A href="https://developers.arcgis.com/android/api-reference/reference/com/esri/core/io/HttpRequestHandler.html#setAdditionalUserAgentInfo(java.lang.String)" title="https://developers.arcgis.com/android/api-reference/reference/com/esri/core/io/HttpRequestHandler.html#setAdditionalUserAgentInfo(java.lang.String)" rel="nofollow noopener noreferrer" target="_blank"&gt;HttpRequestHandler |&amp;nbsp; ArcGIS Android 10.2.7 API&lt;/A&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 13px; font-family: arial, sans-serif;"&gt;&lt;STRONG&gt;In order to provide security I defined ArcGIS Server Link like below (Some places of link has been changed by me);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 13px; font-family: arial, sans-serif;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;ArcGISTiledMapServiceLayer BaseMap &lt;/SPAN&gt;= &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;ArcGISTiledMapServiceLayer(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"&lt;A href="http://gisproxy.company.gov.tr/proxy.ashx?http://gis.company.gov.tr/arcgis/rest/services/CityGuide/MapServer" title="http://gisproxy.company.gov.tr/proxy.ashx?http://gis.company.gov.tr/arcgis/rest/services/CityGuide/MapServer" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gisproxy.company.gov.tr/proxy.ashx?http://gis.company.gov.tr/arcgis/rest/services/CityGuide/MapServer&lt;/A&gt; &lt;/SPAN&gt;);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 13px; font-family: arial, sans-serif;"&gt;&lt;STRONG&gt;Actually I have to send Header to HttpRequest for access my features and services. I could afford the write this functionality for code side but it didn't worked.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
HttpRequestHandler mHttpRequest = HttpRequestHandler.&lt;SPAN style="font-style: italic;"&gt;getInstance&lt;/SPAN&gt;();
&lt;SPAN style="color: #808080; font-style: italic;"&gt;
&lt;/SPAN&gt;mHttpRequest.setHttpRequestListener(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;HttpRequestListener() {
&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808000;"&gt;@Override
&lt;/SPAN&gt;&lt;SPAN style="color: #808000;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public void &lt;/SPAN&gt;onRequestInterception(org.apache.http.HttpRequest httpRequest, org.apache.http.protocol.HttpContext httpContext) {

&amp;nbsp; httpRequest.addHeader(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"HTTP_REFERER"&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Android SH"&lt;/SPAN&gt;);
&amp;nbsp; Header[] mheader = httpRequest.getAllHeaders();
&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;(Header item : mheader) {
&amp;nbsp; Log.&lt;SPAN style="font-style: italic;"&gt;d&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"RequestHeader"&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Headers-----" &lt;/SPAN&gt;+ item);
&amp;nbsp; }
&amp;nbsp; Log.&lt;SPAN style="font-style: italic;"&gt;d&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Contex"&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"RequestContext----" &lt;/SPAN&gt;+ httpContext);

&amp;nbsp; }
});&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 13px; font-family: arial, sans-serif;"&gt;&lt;STRONG&gt;S&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 13px; font-family: arial, sans-serif;"&gt;&lt;STRONG&gt;o How could I solve this issue ? How canI send header parameter to http request&amp;nbsp; ?&amp;nbsp;&amp;nbsp; Or stuff that I trying is not supported for this usage. &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 13px; font-family: arial, sans-serif;"&gt;&lt;STRONG&gt;​ &lt;A href="https://community.esri.com/migrated-users/3919" target="_blank"&gt;Dan O'Neill &lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/2602" target="_blank"&gt;Will Crick&lt;/A&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:09:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/setting-up-httprequestconfiguration-to-arcgis/m-p/28883#M219</guid>
      <dc:creator>SalihYalcin</dc:creator>
      <dc:date>2021-12-10T21:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up HttpRequestConfiguration to ArcGIS Android SDK for security</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/setting-up-httprequestconfiguration-to-arcgis/m-p/28884#M220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume you are trying to use the ArcGIS Proxy Service using a self hosted proxy service?&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/authentication/working-with-proxies/#selfhosted-proxy-service" title="https://developers.arcgis.com/authentication/working-with-proxies/#selfhosted-proxy-service"&gt;Working with Proxy Services | ArcGIS for Developers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, this is currently not supported in the 10.2.x Android SDK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However you may be able to do one of the following:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. Change the self hosted proxy service on the server to accept a valid HTTP query parameter for the URL to the actual resource you want to access. Currently the default just appends the URL of the service on to the end of the URL of the proxy without a parameter name (e.g. its &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fproxyurl.com%3Fhttp%3A%2F%2Fserviceurl.com" rel="nofollow" target="_blank"&gt;http://proxyurl.com?http://serviceurl.com&lt;/A&gt;&lt;SPAN&gt; rather than something like &lt;/SPAN&gt;&lt;A href="http://proxyurl.com/?http://serviceurl.com" title="http://proxyurl.com/?http://serviceurl.com"&gt;http://proxyurl.com/?url=http://serviceurl.com&lt;/A&gt; - note the addition of the "url=" in the second url).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Add the proxy service URL in the same format as the proxy page requires to each request to the resource in the &lt;A href="https://developers.arcgis.com/android/api-reference/reference/com/esri/core/io/HttpRequestListener.html#onRequestInterception(org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext)"&gt;onRequestInterception()&lt;/A&gt; method of the HttpRequestListener. This gets fired for every http request, you can check what the outgoing URL is to see if its the resource you are interested in, and then modify the request as required.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2016 21:57:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/setting-up-httprequestconfiguration-to-arcgis/m-p/28884#M220</guid>
      <dc:creator>WillCrick</dc:creator>
      <dc:date>2016-03-28T21:57:53Z</dc:date>
    </item>
  </channel>
</rss>

