Connection with alfresco cmis

前端 未结 2 1916
温柔的废话
温柔的废话 2021-01-29 10:03

I am trying to connect alfresco using config parameters but i am getting error:

Config: sessionParameters.put(SessionParameter.USER, \"admin\");
    sessionParam         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-01-29 10:25

    try this worked fine for me

     private static Session getSession(String serverUrl, String username, String password) {
        SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
        Map params = new HashMap();
        params.put(SessionParameter.USER, username);
        params.put(SessionParameter.PASSWORD, password);
        params.put(SessionParameter.ATOMPUB_URL, serverUrl);
        params.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
        List repos = sessionFactory.getRepositories(params);
        if (repos.isEmpty()) {
            throw new RuntimeException("Server has no repositories!");
        }
        return repos.get(0).createSession();
    }
    

提交回复
热议问题