Https Connection Android

I am doing a https post and I'm getting an exception of ssl exception Not trusted server certificate. If i do normal http it is working perfectly fine. Do I have to accept the server certificate somehow? I'm making a guess, but if you want an actual handshake to occur, you have to let android know of your certificate. If you want to just accept no matter what, then use this pseudo-co

Https连接Android

我正在做一个https帖子,我得到了一个例外的ssl异常不受信任的服务器证书。 如果我做正常的http,它工作得很好。 我必须以某种方式接受服务器证书吗? 我在猜测,但如果你想要一个真正的握手发生,你必须让android知道你的证书。 如果您只想接受,无论如何,请使用此伪代码来获得您需要的Apache HTTP客户端: SchemeRegistry schemeRegistry = new SchemeRegistry (); schemeRegistry.register (new Scheme ("http", P

Java client certificates over HTTPS/SSL

I am using Java 6 and am trying to create an HttpsURLConnection against a remote server, using a client certificate. The server is using an selfsigned root certificate, and requires that a password-protected client certificate is presented. I've added the server root certificate and the client certificate to a default java keystore which I found in /System/Library/Frameworks/JavaVM.framewo

通过HTTPS / SSL的Java客户端证书

我正在使用Java 6,并试图使用客户端证书针对远程服务器创建HttpsURLConnection 。 服务器正在使用自签名根证书,并要求提供受密码保护的客户端证书。 我已将服务器根证书和客户机证书添加到我在/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/security/cacerts 10.5)中找到的默认Java密钥库。 密钥库文件的名称似乎表明客户端证书不应该进入那里? 无论如何,将根证书添加到此商店解决了臭名昭着

Mqtt client ssl example in java

I am tired to connect facebook MQTT server ( edge-mqtt.facebook.com:443 ) with ssl , I'm using Eclipse Paho for MQTT connection . private final String DEFAULT_HOST = "edge-mqtt.facebook.com"; private final int DEFAULT_PORT = 443; public void connect(String protogle) throws Exception { this.broker = protogle + "://"+ DEFAULT_HOST + ":" + DEFAULT_PORT; this.mqttClient = new MqttClient(broke

在Java中的Mqtt客户端SSL例子

我很厌烦连接facebook MQTT服务器(edge-mqtt.facebook.com:443)与ssl,我正在使用Eclipse Paho进行MQTT连接。 private final String DEFAULT_HOST = "edge-mqtt.facebook.com"; private final int DEFAULT_PORT = 443; public void connect(String protogle) throws Exception { this.broker = protogle + "://"+ DEFAULT_HOST + ":" + DEFAULT_PORT; this.mqttClient = new MqttClient(broker,getMqttClientId() ,new Memo

Android MediaRecorder produces corrupt video with green lines

I'm trying to add video recording capability to my app using MediaRecorder in Android, but the resulting video looks corrupt with green lines (audio is fine). The following code is what I use to initialize the MediaRecorder object: mMediaRecorder = new MediaRecorder(); mCamera.unlock(); mMediaRecorder.setCamera(mCamera); mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mMediaRe

Android MediaRecorder会用绿线产生损坏的视频

我试图在Android中使用MediaRecorder将视频录制功能添加到我的应用程序,但生成的视频看起来像绿线(音频很好)损坏。 以下代码是我用来初始化MediaRecorder对象的代码: mMediaRecorder = new MediaRecorder(); mCamera.unlock(); mMediaRecorder.setCamera(mCamera); mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); mMediaRecorder.setOu

error camera is not aviable

Anyone know how to using it for mediarecorder ? im using recorder.setPreviewDisplay(holder.getSurface) where holder - it's camera ( i see chest rectangle on my screen of phone) When i runn my app - in logcat i see error (camera is not aviable) im try to using function setCamera - but it's not help me. Anyone know how to right use it ? or maybe i can record video(only video, without

错误相机不是aviable

任何人都知道如何使用它的媒体记录器? 我在用着 recorder.setPreviewDisplay(holder.getSurface)持有者 - 它的相机(我看到我的手机屏幕上的胸部矩形)当我运行我的应用程序 - 在logcat我看到错误(相机不aviable)即时尝试使用函数setCamera - 但它不帮我。 任何人都知道如何正确使用它? 或者我可以用其他方式记录视频(只有视频,没有音频)? 好的已解决 例如这个代码 mediaRecorder = new MediaRecorder();

MediaRecorder problems on starting video capturing on android

I'm trying to develop an App that amongst other things can record videos from its User. So I need to capture the video with the front facing camera if there is one. I build a camera preview and this works fine. I used the Android How-To Sites to build a MediaRecorder and set it up. If I use a CamcorderProfile my Media Server dies when I call start(). If I set up the encoder by myself the

MediaRecorder在Android上启动视频捕获时遇到的问题

我试图开发一个应用程序,除其他外可以记录来自其用户的视频。 所以我需要用前置摄像头拍摄视频(如果有的话)。 我建立了一个相机预览,这工作正常。 我使用Android How-To Sites来构建MediaRecorder并进行设置。 如果我使用CamcorderProfile,则在调用start()时我的媒体服务器会死亡。 如果我自己设置编码器,媒体服务器会在start()中引发一个运行时异常,并显示消息“start failed:-19”,但在这里我发现了一些关于此

Maven set dependency mediation strategy to newest rather than nearest

Can I configure Maven to choose the "newest" dependency on a conflict, rather than the "nearest"? The "newest" is the default in Ivy and other sensible dependency managers, see http://ant.apache.org/ivy/history/2.2.0/settings/conflict-managers.html I find the "nearest" strategy is rarely what I want. I'm using Maven 3.3.3, but I can switch version

Maven将依赖关系调解策略设置为最新而非最近的策略

我可以配置Maven来选择对冲突的“最新”依赖,而不是“最近”吗? “最新”是常春藤和其他合理依赖管理器的默认值,请参阅http://ant.apache.org/ivy/history/2.2.0/settings/conflict-managers.html 我发现“最近”的战略很少是我想要的。 我使用的是Maven 3.3.3,但如果需要,我可以切换版本。 我知道如何覆盖Maven在个别冲突中的选择,但我更愿意更改默认值,以便我不必每次都检测并修复每个冲突。 (请参阅关于“依赖调解”

Heroku: Spring Boot Gradle app with https tomcat server and certificate pinning

I have a Spring Boot java app that uses a self-signed certificate to communicate with the android front-end. I use a tomcat server as my container for the app: compile 'org.springframework.boot:spring-boot-starter-tomcat' Now, I have enabled https / ssl: TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container; tomcat.addConnect

Heroku:使用https tomcat服务器和证书锁定的Spring Boot Gradle应用程序

我有一个Spring Boot java应用程序,它使用自签名证书与android前端进行通信。 我使用一个tomcat服务器作为应用程序的容器: compile 'org.springframework.boot:spring-boot-starter-tomcat' 现在,我启用了https / ssl: TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container; tomcat.addConnectorCustomizers(connector -> {

How to timeout a thread

I want to run a thread for some fixed amount of time. If it is not completed within that time, I want to either kill it, throw some exception, or handle it in some way. How can it be done? One way of doing it as I figured out from this thread is to use a TimerTask inside the run() method of the Thread. Are there any better solutions for this? EDIT: Adding a bounty as I needed a clearer an

如何超时一个线程

我想在一段固定的时间内运行一个线程。 如果在这段时间内没有完成,我想要杀死它,抛出一些异常,或以某种方式处理它。 如何做呢? 我从这个线程中发现的一种方法是在Thread的run()方法中使用TimerTask。 有没有更好的解决方案呢? 编辑:添加一个赏金,因为我需要一个更清晰的答案。 下面给出的ExecutorService代码不能解决我的问题。 为什么我应该在执行之后sleep()(某些代码 - 我没有处理这段代码)? 如果代

Exporting a war in Release mode using Spring Tool Suite STS?

I´m using Spring Tool Suite for a Spring MVC project. I can´t find the option of exporting my war in release mode. Does Eclipse do this by default when exporting the war? Maybe Eclipse use a Debug mode by default, but it changes the mode automatically when you export the war. I know that release version is optimized, that´s why I would like to find out how to export my war in that version.

使用Spring Tool Suite STS以发布模式导出战争?

我正在为Spring MVC项目使用Spring Tool Suite。 我无法找到在释放模式下导出战争的选项。 Eclipse在导出战争时会默认执行此操作吗? 也许Eclipse在默认情况下使用调试模式,但它会在您导出战争时自动更改模式。 我知道发布版本已经优化,这就是为什么我想了解如何在该版本中导出我的战争。 导出罐子/战争时,eclipse中没有调试/发布模式。 有Java编译器设置,但不管你如何导出你的罐子,它们都保持不变。 如果您想根