As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
byte[] contentFile = null; WebServiceFactory.setEndpointAddress(ALFRESCO_URL); AuthenticationService authenticationService = WebServiceFactory.getAuthenticationService(); AuthenticationUtils.startSession(USERNAME, PASSWORD); String ticket = WebServiceFactory.getCurrentTicket(); Reference ref = node.getReference(); Content[] readResult = contentService.read(new Predicate(new Reference[] { ref }, STORE, null), Constants.PROP_CONTENT); Content content = readResult[0]; InputStream is = getContentAsInputStream(content.getUrl(), helper); strUrl += "?ticket=" + ticket; URL url = new URL(strUrl); URLConnection conn = url.openConnection(); InputStream is = conn.getInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int bufferSize = is.available(); byte[] dati = new byte[bufferSize]; int readbyte = 0; while ((readbyte = is.read(dati, 0, bufferSize)) > -1) { baos.write(dati, 0, readbyte); } baos.close(); is.close(); contentFile = baos.toByteArray(); AuthenticationUtils.endSession();
Can I close the session after some time (1 or 2 minute) programaticaly?
i do it when a user is properly logged out of the whole application usually…and i open a ticket at login time.