小编Aak*_*ani的帖子

排球RequestQueue超时

RequestQueue mRequestQueue = Volley.newRequestQueue(getApplicationContext());
mRequestQueue.add(new JsonObjectRequest(Method.GET, cityListUrl, null, new Listener<JSONObject>() 
{
    public void onResponse(JSONObject jsonResults) 
    {
        //Any Call
    }
}, new ErrorListener()
   {
        public void onErrorResponse(VolleyError arg0) 
        {
            //Any Error log
        }
   }
));
Run Code Online (Sandbox Code Playgroud)

这是我的请求调用,我想更改或设置请求的超时.反正有可能吗?

java android connection-timeout android-volley

38
推荐指数
3
解决办法
5万
查看次数

如何在新选项卡中使用自定义名称打开通过 http 的 blob 响应生成的文件

我需要从后端服务获取 blob 响应,处理该响应并使用 Angular在新选项卡中使用自定义名称打开文件。这是我到目前为止编写的代码:

HTTP请求

return this.http.get(url, { responseType: 'blob' });
Run Code Online (Sandbox Code Playgroud)

处理响应

const blob = new Blob([fileResponseData], { type: 'application/pdf' });
const fileName = this.getFileName();
// IE Browser
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  window.navigator.msSaveOrOpenBlob(blob, fileName);
  return;
}
// Other Browsers
const url = window.URL.createObjectURL(blob);
const link = this.renderer.createElement('a');
this.renderer.setAttribute(link, 'download', fileName);
this.renderer.setAttribute(link, 'href', url);
this.renderer.setAttribute(link, 'target', '_blank');
this.renderer.appendChild(this.elementRef.nativeElement, link);
link.click();
this.renderer.removeChild(this.elementRef.nativeElement, link);
setTimeout(() => {
  window.URL.revokeObjectURL(url);
}, 1000);
Run Code Online (Sandbox Code Playgroud)

虽然此解决方案确实会下载具有自定义名称的文件,但不会在新选项卡中打开 blob URL。该文件会在同一选项卡中下载!

在浏览了 Stack Overflow 上的一些解决方案后,我发现了一些信息,target = _blank …

blob download angular

5
推荐指数
0
解决办法
873
查看次数

Angular firestore 类型“Date”上不存在属性“toDate”

timestamp我正在尝试使用将Firestore 中的对象转换为DateTypeScript 中的对象toDate()

import { AngularFirestore } from '@angular/fire/firestore';
...
constructor(private database?: AngularFirestore) {...}
...
const someVariable = a.date.toDate();
Run Code Online (Sandbox Code Playgroud)

虽然该功能在开发模式下工作正常,但我收到 TypeScript 编译检查错误。ng prod此外,由于此错误,我无法构建产品版本(使用)。

a.date.toDate() ~~~~ src/app/project/some.service.ts:74:36 -
错误 TS2339:类型“Date”上不存在属性“toDate”。

有什么建议我该如何解决这个问题吗?

timestamp typescript angularfire angular

4
推荐指数
1
解决办法
8443
查看次数

如何在 php 中加密解密 .pdf、.docx 文件?

我正在尝试用 PHP 加密/解密文件。到目前为止,我对 .txt 文件是成功的,但当涉及 .pdf 和 .doc 或 .docx 时,我的代码失败了,即它给出了荒谬的结果。谁能建议我的代码中的修改/替代方案?提前致谢!

这是加密函数

function encryptData($value)
{
   $key = "Mary has one cat";
   $text = $value;
   $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
   $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
   $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $text, MCRYPT_MODE_ECB, $iv);
   return $crypttext;
}
Run Code Online (Sandbox Code Playgroud)

这是解密函数

function decryptData($value)
{
   $key = "Mary has one cat";
   $crypttext = $value;
   $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
   $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
   $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $crypttext, MCRYPT_MODE_ECB, $iv);
   return trim($decrypttext);
} 
Run Code Online (Sandbox Code Playgroud)

php pdf encryption doc docx

3
推荐指数
1
解决办法
9433
查看次数

Glassfish 4.0加载应用程序时出现异常,java.lang.IllegalStateException

我是网络服务和玻璃鱼的新手.这是我的代码

package ws.mypkg;

import java.util.ArrayList;
import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@WebService
@SOAPBinding(style=Style.RPC)
public class TestRPC {

    // This seems to cause the problem when a List is returned.
    public List<String> testRPC () {
        List<String> l = new ArrayList<String>();
        l.add("Hello");
        return l;
    }

    // This method work fine
    public String testRPC1 () {
        return "Testing RPC";
    }
}
Run Code Online (Sandbox Code Playgroud)

如果我有

@SOAPBinding(style=Style.RPC)
Run Code Online (Sandbox Code Playgroud)

我尝试部署Web服务时收到以下错误.

无法部署TestGF部署失败=部署期间发生错误:加载应用程序时出现异常:java.lang.IllegalStateException:ContainerBase.addChild:start:org.apache.catalina.LifecycleException:java.lang.RuntimeException:Servlet Web服务端点''失败.有关更多详细信息,请参阅server.log.

服务器日志没有更多.

当我发表评论时,它会部署得很好 @SOAPBinding(style=Style.RPC)

问题似乎与第一种方法有关.如果我排除第一个方法,第二个方法部署正常.当我从方法中返回一个列表时,我似乎遇到了这个问题@SOAPBinding(style=Style.RPC)

我正在使用Glassfish 4.0,jdk 1.7和Eclipse(与Spring 3.4捆绑在一起)

web-services glassfish

2
推荐指数
1
解决办法
9341
查看次数