how to use the Google Drive API in the flash player? - actionscript-3

i want to use google drive api in my flash component.
i get a access key but i cant use google drive api.
i want to insert file to google drive.
var urlLoader:MultipartURLLoader = new MultipartURLLoader();
urlLoader.addEventListener(Event.COMPLETE, uploadCompleteHandler);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, uploadIOErrorHandler);
urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, uploadSecurityErrorHandler);
urlLoader.requestHeaders.push(new URLRequestHeader("Authorization", authorization));
urlLoader.load('https://www.googleapis.com/upload/drive/v2/files');
i get the following error
[SecurityErrorEvent type="securityError" bubbles=false cancelable=false
eventPhase=2 text="Error #2170: Security sandbox violation:
http://myserver.com/myflash.swf cannot send
HTTP headers to https://www.googleapis.com/upload/drive/v2/files."]
https://www.googleapis.com/crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/crossdomain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*.google.com" secure="false"/>
<allow-access-from domain="*.doubleclick.com" secure="false"/>
<allow-access-from domain="*.doubleclick.net" secure="false"/>
<allow-access-from domain="*.gstatic.com" secure="false"/>
<allow-access-from domain="*.teracent.net" secure="false"/>
<allow-access-from domain="*.2mdn.net" secure="false"/>
<allow-access-from domain="*.youtube.com" secure="false"/>
<allow-access-from domain="*.ytimg.com" secure="false"/>
<allow-http-request-headers-from domain="*" headers="Accept,Accept-Language,Authorization,Cache-Control,Content-Disposition,Content-Encoding,Content-Language,Content-Length,Content-MD5,Content-Range,Content-Type,Date,GData-Version,Host,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,Origin,OriginToken,Pragma,Range,Slug,Transfer-Encoding,X-ClientDetails,X-GData-Client,X-GData-Key,X-Goog-AuthUser,X-Goog-Encode-Response-If-Executable,X-Goog-Upload-Command,X-Goog-Upload-Content-Disposition,X-Goog-Upload-Content-Length,X-Goog-Upload-Content-Type,X-Goog-Upload-Offset,X-Goog-Upload-Protocol,X-HTTP-Method-Override,X-JavaScript-User-Agent,X-Origin,X-Referer,X-Upload-Content-Length,X-Upload-Content-Type,X-Use-HTTP-Status-Code-Override,X-YouTube-VVT"/>
</cross-domain-policy>
my server crossdomain.xml
<cross-domain-policy>
<allow-access-from domain="*"/>
<site-control permitted-cross-domain-policies="all"/>
<allow-http-request-headers-from domain="*"/>
</cross-domain-policy>
plz can someone tell me a solution

Related

Using JsonLayout with SOLR logs

I'm trying to log all events from SOLR in JSON format by using JSONLayout. I'm using the official docker image from SOLR but I can't get it to work. Here's my setup:
Dockerfile
FROM solr:7
COPY log4j2-json.xml /opt/solr/server/resources/log4j2.xml
USER root
RUN chmod 644 /opt/solr/server/resources/log4j2.xml
RUN chown solr:solr /opt/solr/server/resources/log4j2.xml
USER solr
EXPOSE 8983
CMD ["solr-precreate", "gettingstarted"]
log4j2.xml original file (without JsonLayout) which does create the solr.log file (using PatternLayout):
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout>
<Pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
</Pattern>
</PatternLayout>
</Console>
<RollingFile
name="RollingFile"
fileName="${sys:solr.log.dir}/solr.log"
filePattern="${sys:solr.log.dir}/solr.log.%i" >
<PatternLayout>
<Pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
</Pattern>
</PatternLayout>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="32 MB"/>
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<RollingFile
name="SlowFile"
fileName="${sys:solr.log.dir}/solr_slow_requests.log"
filePattern="${sys:solr.log.dir}/solr_slow_requests.log.%i" >
<PatternLayout>
<Pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
</Pattern>
</PatternLayout>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="32 MB"/>
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="org.apache.hadoop" level="warn"/>
<Logger name="org.apache.solr.update.LoggingInfoStream" level="off"/>
<Logger name="org.apache.zookeeper" level="warn"/>
<Logger name="org.apache.solr.core.SolrCore.SlowRequest" level="info" additivity="false">
<AppenderRef ref="SlowFile"/>
</Logger>
<Root level="info">
<AppenderRef ref="RollingFile"/>
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>
log4j2.xml with JsonLayout in RollingFile appender which breaks it. No solr.log file is created:
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout>
<Pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
</Pattern>
</PatternLayout>
</Console>
<RollingFile
name="RollingFile"
fileName="${sys:solr.log.dir}/solr.log"
filePattern="${sys:solr.log.dir}/solr.log.%i" >
<JsonLayout complete="false" compact="true" eventEol="true" />
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="32 MB"/>
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<RollingFile
name="SlowFile"
fileName="${sys:solr.log.dir}/solr_slow_requests.log"
filePattern="${sys:solr.log.dir}/solr_slow_requests.log.%i" >
<PatternLayout>
<Pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
</Pattern>
</PatternLayout>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="32 MB"/>
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="org.apache.hadoop" level="warn"/>
<Logger name="org.apache.solr.update.LoggingInfoStream" level="off"/>
<Logger name="org.apache.zookeeper" level="warn"/>
<Logger name="org.apache.solr.core.SolrCore.SlowRequest" level="info" additivity="false">
<AppenderRef ref="SlowFile"/>
</Logger>
<Root level="debug">
<AppenderRef ref="RollingFile"/>
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>
I would expect to see the solr.log file to be created in the logdir and see the events in json format. But the solr.log file isn't even created. SOLR does however start.
What am I missing?
Thanks for your help.
PS. I found this thread which describes the same problem but no solution: see here
On solr official docker image 8.11.2 the same problem is caused by a missing jackson library in the classpath:
ERROR Could not create plugin of type class org.apache.logging.log4j.core.layout.JsonLayout for element JsonLayout: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ser/FilterProvider java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ser/FilterProvider
at org.apache.logging.log4j.core.layout.JsonLayout.<init>(JsonLayout.java:159)
This is definitely a bug (https://issues.apache.org/jira/browse/SOLR-16342), but since the jackson library exists elsewhere in the original image, there is a possible workaround to apply while building the docker. Basically you can link the needed jackson jars that exists in /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/ to /opt/solr/server/lib/ext/:
RUN ln -s /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.13.3.jar /opt/solr/server/lib/ext/jackson-core-2.13.3.jar && \
ln -s /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-databind-2.13.3.jar /opt/solr/server/lib/ext/jackson-databind-2.13.3.jar && \
ln -s /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-annotations-2.13.3.jar /opt/solr/server/lib/ext/jackson-annotations-2.13.3.jar
Moreover:
JsonTemplate is considered deprecated. JsonTemplateLayout provides
more capabilitites and should be used instead.
(see https://logging.apache.org/log4j/2.x/manual/layouts.html#JSONLayout)
If you move to <JsonTemplateLayout /> it works out of the box in solr.

Unable to load map_view on fullscreen on Flutter

I have an issue when I try to load a google map in fullscreen.
I have followed all the docs in pub.dartland.org for map_view :
in my AndroidManifest.xml I had :
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
Also added :
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your_api_key"/>
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
Of course with the apiKey changed, and also :
<activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="#style/Theme.AppCompat.Light.DarkActionBar"/>
I also add the kotlin dependencies in build.graddle.
So now I can see the staticUri map on the device, great, but when I tap on this map to get it in fullscreen, the app crash with this error :
D/AndroidRuntime( 4373): Shutting down VM
E/AndroidRuntime( 4373): FATAL EXCEPTION: main
E/AndroidRuntime( 4373): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.apptreesoftware.mapview.MapActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class fragment
E/AndroidRuntime( 4373): Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class fragment
E/AndroidRuntime( 4373): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
E/AndroidRuntime( 4373): Caused by: java.lang.RuntimeException: API key not found. Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
I tried by adding :
<meta-data android:name="com.google.android.geo.API_KEY" android:value="xxxxxxxxxxxxxxx"/>
But same issue, maybe someone have an idea ?
EDIT :
Here is my AndroidManifest.xml :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:name="io.flutter.app.FlutterApplication"
android:label="my-app"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="XXXXXXXXXXXXXX"/>
<!-- <meta-data android:name="com.google.android.geo.API_KEY" android:value="XXXXXXXXXXXXXXXX"/> -->
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="#style/Theme.AppCompat.Light.DarkActionBar"/>
</application>
</manifest>
Ok, you need to move the google maps meta-data outside your activity tag , like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:name="io.flutter.app.FlutterApplication"
android:label="my-app"
android:icon="#mipmap/ic_launcher">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="XXXXXXXXXXXXXX"/>
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="#style/Theme.AppCompat.Light.DarkActionBar"/>
</application>
</manifest>
You can find more information here:
https://developer.android.com/guide/topics/manifest/meta-data-element
In summary, the metadata is related to the parent component, so in this case you need that metadata for all of the app, not just for one activity :).

Error #2044 Adobe flex

I have to display an image from an external URL but the Adobe flash debugger displays
Error #2044: Unhandled securityError:. text=Error #2048: Security
sandbox violation**:**
http://localhost:8080/folder1/folder2/media/swf_demo.swf cannot load
data from http://example.com/image.
A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
I have included a crossdomain.xml in my tomcat root server. Its contents are as follows:
<?xml version="1.0"?>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
<allow-http-request-headers-from domain="*"/>
</cross-domain-policy>
My mxml code of displaying the image is as follows:
<mx:Canvas>
<controls:MultiSourceImage id="Icon" width="19" height="19" x="3" y="3" trustContent="true"/>
<mx:Image id="Badge" width="11" height="11"/>
</mx:Canvas>
The image is not getting displayed.
Am I missing something? Or am I going wrong somewhere?

Why do i get Security sandbox voilation error even after adding crossdomain.xml?

I was getting this error earlier as
Security sandbox voilation: cannot load data from http://sample:8080/SignOut
What i got to know it to add a crossdomain.xml inside the tomcat/webapps/ROOT/ folder.
But interesting thing is that, even after adding this am getting the same error. Why?
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

Flex - Security Sandbox violation - ERROR#2048

So if i put -http://xxx.xx.xx.x/website/website.html and try to use an HTTPService with in the swf to contact -https://yyy.yy.yy.y/resources/script, I get the sandbox error.
If I put -https://yyy.yy.yy.y/crossdomain.xml in the browser and access it everything in the crossdomain file looks fine.
wWen i go back and try to use the HTTPService from -http://xxx.xx.xx.x/website/website.html everything now works until i close the browser which i assume clears the cache.
********crossdomain.xml*********
<?xml version="1.0" ?>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
********Action Script*************
Security.loadPolicyFile("https://xxx.xx.xx.x/crossdomain.xml");
Change the following line:
<allow-access-from domain="*"/>
to:
<allow-access-from domain="*" secure="false" />
You can read more about it at adobe.com...
http://kb2.adobe.com/cps/142/tn_14213.html
We found that Chrome will refuse self-signed SSL certificates but Firefox and Safari will plow on ahead. Try a different browser and see if that works for you.