java - ClientCustomSSL with HTTP 4.1.1 -


can tell me whether have create my.keystore file or created. , when created file in same directory(webapp directory) jsp file , using code in jsp file.

keystore truststore  = keystore.getinstance(keystore.getdefaulttype());         fileinputstream instream = new fileinputstream(new file("my.keystore"));  try {     truststore.load(instream, "nopassword".tochararray()); } {     instream.close(); }  sslsocketfactory socketfactory = new sslsocketfactory(truststore); scheme sch = new scheme("https", socketfactory, 443); httpclient.getconnectionmanager().getschemeregistry().register(sch); 

and got error

java.io.filenotfoundexception: my.keystore (the system cannot find file spec ified) 

so should put file. path both of file, jsp file , my.keystore

c:\workspace\search-ui\search-ui\src\main\webapp 

i recommend adding keystore classpath , load via

inputstream instream = thread.currentthread().getcontextclassloader().getresourceasstream("my.keystore"); 

putting keystore under webapp not under web-inf insecure since download it. also, loading file via new file() looks in working directory java process when relative file path used (see javadoc). somewhere under directory hierarchy of servlet container using.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -