小编ved*_*ved的帖子

javax.net.ssl.SSLPeerUnverifiedException:我正在使用google place api在android中没有对等证书

我正面临着一个javax.net.ssl.SSLPeerUnverifiedException:在Android模拟器中使用google place api时没有对等证书异常.我是我的网址:

https://maps.googleapis.com/maps/api/place/search/json?&location=28.632808,77.218276&radius=1000&sensor=false&key=AIzaSyC3y3fOMTqTkCjNNETQTCKustG7BRk_eVc
Run Code Online (Sandbox Code Playgroud)

当我简单地将上面的URL粘贴到浏览器地址栏中时,它简单地给出了Json字符串.所以,我认为不需要任何证书身份验证.

经过这么多谷歌搜索和投入2-3天后,我使用了org.apache.http.conn.ssl.SSLSocketFactory包的SSLSocketFacory类来避免对等证书错误.

下面是我的代码:

public static HttpClient wrapClient(HttpClient base) {
        try {
            SSLContext ctx = SSLContext.getInstance("TLS");
            X509TrustManager tm = new X509TrustManager() {

                public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException {
                }

                public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException {
                }

                public X509Certificate[] getAcceptedIssuers() {
                    return null;
                }
            };
            X509HostnameVerifier verifier = new X509HostnameVerifier() {

                public void verify(String string, SSLSocket ssls) throws IOException {
                }

                public void verify(String string, X509Certificate xc) throws SSLException {
                }

                public …
Run Code Online (Sandbox Code Playgroud)

ssl android google-places-api apache-httpclient-4.x

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

spring spring 3中无法允许静态资源

我无法在spring security 3中允许静态资源(如js,css,images).Below是我的配置文件.

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:security="http://www.springframework.org/schema/security"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
              http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
              http://www.springframework.org/schema/security 
              http://www.springframework.org/schema/security/spring-security-3.1.xsd">



    <bean id="authenticationEntryPoint"
        class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
        <property name="loginFormUrl" value="/login.htm" />
    </bean>

    <security:http security="none" pattern="/js/ajaxScript.js"/>   
    <security:http security="none" pattern="/js/commonScript.js"/>  

    <bean class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler" />

    <security:http auto-config="false" entry-point-ref="authenticationEntryPoint" disable-url-rewriting="true" use-expressions="true">

        <security:custom-filter position="FORM_LOGIN_FILTER"
            ref="customAuthenticationProcessingFilter" />

<!--        <security:intercept-url pattern="/js/jquery.min.js" access="isAuthenticated()" /> -->
<!--        <security:intercept-url pattern="/js/**/**" access="permitAll" />  -->
        <security:intercept-url pattern="/displayAdminPage.htm" access="hasRole('ROLE_ADMIN')" />
        <security:access-denied-handler ref="accessDeniedHandler" />

    </security:http>

    <security:authentication-manager alias="authenticationManager">
       <security:authentication-provider user-service-ref="customUserDetailService">
       </security:authentication-provider>
    </security:authentication-manager> 

    <bean id="customUserDetailService" class="com.qait.cdl.services.impl.UserSecurityServiceImpl">
        <property name="userDao" ref="userDao"/>
       </bean>

    <bean id="customAuthenticationProcessingFilter"
        class="com.qait.cdl.services.impl.CustomAuthenticationProcessingFilter">
        <property name="authenticationManager" ref="authenticationManager" />
    </bean>

    <bean id="accessDeniedHandler" …
Run Code Online (Sandbox Code Playgroud)

javascript css image spring-mvc spring-security

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

如何在速度模板文件中访问地图

当我通过一个Map<String,String>in velocity模板文件时,当试图打印map的值时,它会被排序(基于ASCII值).

我这样做:

这是我的速度模板文件::

#set($tocList=${mapReference.mapValue})
#set($tocEntry="")

<div >
 #foreach($tocEntry in $tocList.keySet())
  <a href="#$tocEntry">$tocList.get($tocEntry)</a><br/>
 #end
</div>
Run Code Online (Sandbox Code Playgroud)

我的Java代码是:

 Map<String, String> map=new HashMap<String, String>();
 Map<String,HashMap> m1=new HashMap<String, HashMap>();

   \\values that we want to print in template file

   map.put("sdfhfg", "Df lm"); 
   map.put("chdgfhd", "gBc Jk");
   map.put("dghjdhdf", "gI Ml");

   m1.put("mapValue", (HashMap) map);

  VelocityEngine velocityEngine = VelocityEngineFactory.getVelocityEngine();
  VelocityContext context = new VelocityContext();
  context.put("img",model);
  context.put("mapReference",m1);
  context.put("iterator", new IteratorTool());


  Template t = velocityEngine.getTemplate("tocTemplate.vm");
  StringWriter writer = new StringWriter();
    t.merge(context , writer);
    System.out.println(writer);
Run Code Online (Sandbox Code Playgroud)

输出是:

 <div>
   <a href="#dghjdhdf">gI Ml</a><br/> …
Run Code Online (Sandbox Code Playgroud)

java velocity

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

无法从pdf复制特殊字符

我只需要复制一些文本,包括pdf文件中的特殊字符,但像破折号( - )这样的特殊字符会被转换为2.

PFA来自以下链接

http://www.fileconvoy.com/dfl.php?id=g6a3426746a10af3b9992384375c5923396bce3660
Run Code Online (Sandbox Code Playgroud)

附件有pdf源文件,我必须复制数据,其他是截图图片.需要紧急帮助.我也尝试使用Google Docs和Adobe Pro从pdf复制数据,但每次都得到类似的结果.

pdf ubuntu text copy

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