小编ten*_*ica的帖子

如何在JetBrains IntelliJ IDEA中编辑评论模板并添加类型或功能注释?

在JetBrains IntelliJ IDEA中,我想编辑评论

/**
 * Created by IntelliJ IDEA.<br/>
 * User: ${USER}<br/>
 * Date: ${DATE}<br/>
 * Time: ${TIME}<br/>
 * To change this template use File | Settings | File Templates.
 */
Run Code Online (Sandbox Code Playgroud)

并为类型生成注释

public class MyUsernamePasswordAuthenticationFilter extends UsernamePasswordAuthenticationFilter
Run Code Online (Sandbox Code Playgroud)

或类似的功能

protected  void checkUsbKeyID(UserObj user,String usbKeyID)
Run Code Online (Sandbox Code Playgroud)

java templates comments intellij-idea

32
推荐指数
2
解决办法
2万
查看次数

HttpURLConnection在Android 2.x中运行良好但在4.1中没有运行:没有发现身份验证挑战

我有一些典型的代码使用HttpURLConnection来获取带有URL的文件.他们在android 1.x和2.x中运行良好.但在Android 4.1中失败了!

我在网上搜索但发现的信息很少.有人请帮忙调查这个问题吗?

private String mURLStr; 
private HttpURLConnection mHttpConnection;

...

url = new URL(mURLStr);

...

mHttpConnection = (HttpURLConnection) url.openConnection();
mHttpConnection.setDoOutput(true);
mHttpConnection.setRequestMethod("GET");

...

InputStream is = mHttpConnection.getInputStream();
Run Code Online (Sandbox Code Playgroud)

getInputStream方法抛出异常:

08-01 15:56:48.856: W/System.err(13613): java.io.IOException: No authentication challenges found
08-01 15:56:48.856: W/System.err(13613):      at libcore.net.http.HttpURLConnectionImpl.getAuthorizationCredentials(HttpURLConnectionImpl.java:427)
08-01 15:56:48.866: W/System.err(13613):      at libcore.net.http.HttpURLConnectionImpl.processAuthHeader(HttpURLConnectionImpl.java:407)
08-01 15:56:48.866: W/System.err(13613):      at libcore.net.http.HttpURLConnectionImpl.processResponseHeaders(HttpURLConnectionImpl.java:356)
08-01 15:56:48.866: W/System.err(13613):      at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:292)
08-01 15:56:48.866: W/System.err(13613):      at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)
...
Run Code Online (Sandbox Code Playgroud)

authentication android httpurlconnection

30
推荐指数
3
解决办法
2万
查看次数

如何在NetBeans中删除actionPerformed方法

当a JButton添加到内容窗格时,我们可以通过双击按钮或右键单击 - >事件 - >操作 - > actionPerformed来设置操作.让我们设置一些事情发生.然后我们需要删除该函数.通过删除我们在buttton的actionPerformed中编写的代码,可以轻松完成.但问题是,该按钮的actionPerformed方法仍然存在,即使它不再使用而且不需要.

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
   //no function here.. but this  code is still remaining. need to remove this code part as well
}
Run Code Online (Sandbox Code Playgroud)

它怎么能被删除?我得到了JButton的一个例子.其他组件的动作方法是这样的.

swing netbeans desktop-application

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

OpenSSL:无法获得本地颁发者证书

我有一个证书C.pfx给了我使用OpenSSL.证书C.pfx具有以下证书路径:C-> B-> A.

我使用以下命令将C.pfx转换为PEM:openssl pkcs12 -in C.pfx -out C.pem -nodes - WORKS OK

我在文件编辑器中打开了证书C.pem,看到它有RSA PRIVATE KEY和CERTIFICATE部分.

我还看到在Windows XP中的Trusted Roor Certification Athorities商店下安装了A和B证书.

目标是使用OpenSSL for Windows 1.0.1c(目前是最新版本)对测试文件进行签名,加密,解密和验证

我使用以下命令:

- 签署 -

openssl smime -sign -signer C.pem -in test.txt -out test.tmp    -- WORKS OK
Run Code Online (Sandbox Code Playgroud)

--TO ENCRYPT--

openssl smime -encrypt -in test.tmp -out test.enc C.pem     -- WORKS OK
Run Code Online (Sandbox Code Playgroud)

- 去DEC - -

openssl smime -decrypt -in test.enc -recip C.pem -inkey C.pem -out test1.tmp    -- WORKS OK
Run Code Online (Sandbox Code Playgroud)

- 核实 -

openssl smime -verify -in test1.tmp …
Run Code Online (Sandbox Code Playgroud)

openssl certificate

16
推荐指数
1
解决办法
5万
查看次数

类似于java中的C#.NET Generic List

如何在java中使用ac#.net通用列表?

这样的事情:

public class ClientList : List<Client> { }
Run Code Online (Sandbox Code Playgroud)

Nikil的答案很完美,我只想添加到想要从List中创建一个类的人:

public class ClientList extends ArrayList<Client>
Run Code Online (Sandbox Code Playgroud)

.net c# java

11
推荐指数
1
解决办法
1万
查看次数

记录泽西的JSON请求和响应

我有一个JAVA Web应用程序,它暴露了RESTful apis.我的要求是记录服务器处理的所有JSON请求和响应.是否有像-Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=trueJAX-WS 这样的参数?

我也在探索AOP方法.我应该在AOP模式中添加什么方法签名?

我正在使用Tomcat服务器和jersey进行JAX-RS实现.

java aop aspectj jax-rs jersey

11
推荐指数
1
解决办法
6620
查看次数

以下过程:-cmd.exe -java.exe正在锁定以下目录:

我正在安装2.3.3 android API,我收到此错误:

Warning:
The following processes:
-cmd.exe
-java.exe
are locking the following directory:
C:\Program Files (x86)\Android\android-sdk\tools
Run Code Online (Sandbox Code Playgroud)

任何帮助?

installation android android-sdk-2.3

10
推荐指数
2
解决办法
2万
查看次数

Google Cloud Messaging HTTP错误400:错误请求

我正在尝试通过GCM(Google云消息传递)发送消息.我已通过Google API注册,我可以从多个Android测试手机向我的网站(这是一个Google App Engine后端)发送一个regID.但是,我无法从Google App Engine向GCM发送任何内容.这是我想要使用的.

    regId = "APA91b..."

    json_data = {"collapse_key" : "Food-Promo", "data" : {
                    "Category" : "FOOD",
                    "Type": "VEG",
               }, "registration_ids": [regId],
    }


    url = 'https://android.googleapis.com/gcm/send'




    apiKey = "AI..."
    myKey = "key=" + apiKey

    headers = {'Content-Type': 'application/json', 'Authorization': myKey}
    data = urllib.urlencode(json_data)
    data2 = {"title": title}
    data3 = urllib.urlencode(data2)

    req = urllib2.Request(url, data, headers)


    f = urllib2.urlopen(req)
    response = f.read()
    f.close()

    logging.debug("***!!!!!!!WriteEntry TEST -----  Response: " + response)
Run Code Online (Sandbox Code Playgroud)

这是我收到的错误.

Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", …
Run Code Online (Sandbox Code Playgroud)

python google-cloud-messaging

10
推荐指数
1
解决办法
9159
查看次数

Java中心文本的矩形

我使用drawString()方法使用Graphics绘制字符串,但我想将文本居中放在矩形中.我该怎么办?

java swing drawstring jframe

10
推荐指数
2
解决办法
2万
查看次数

将JPanel添加到JFrame

我有一个程序,其中JPanel添加到JFrame:

public class Test{

    Test2 test = new Test2();
    JFrame frame = new JFrame();

    Test(){

    ...
    frame.setLayout(new BorderLayout());
    frame.add(test, BorderLayout.CENTER);
    ...

    }

    //main

    ...

    }

    public class Test2{

    JPanel test2 = new JPanel();

    Test2(){

    ...

    }

}
Run Code Online (Sandbox Code Playgroud)

我收到一个错误,要求我将'panel'的类型更改为'component'.我修复此错误?它要我做:Component panel = new Component();

java swing jpanel jframe

9
推荐指数
1
解决办法
10万
查看次数