bug fixed: ticket incident 611

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@76553 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-05-30 13:11:58 +00:00
parent 3e787dd188
commit 2e1ba7385a
2 changed files with 34 additions and 6 deletions

View File

@ -100,13 +100,13 @@ public class SessionUtil {
if (user == null) {
//for test only
user = "test.user";
// user = "francesco.mangiacrapa";
// user = "test.user";
user = "francesco.mangiacrapa";
// user = "pasquale.pagano";
// user = "lucio.lelii";
String scope = "/gcube/devsec"; //Development
// scope = "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityResearchEnvironment"; //Production
// String scope = "/gcube/devsec"; //Development
String scope = "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityResearchEnvironment"; //Production
httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
ASLSession session = SessionManager.getInstance().getASLSession(sessionID, user);

View File

@ -1,13 +1,16 @@
package org.gcube.portlets.user.speciesdiscovery.server.util;
//import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import org.gcube.common.core.utils.logging.GCUBELog;
import org.gcube.contentmanager.storageclient.model.protocol.smp.Handler;
import org.gcube.contentmanager.storageclient.model.protocol.smp.SMPURLConnection;
public class StorageUtil {
protected static GCUBELog logger = new GCUBELog(StorageUtil.class);
@ -72,13 +75,22 @@ public class StorageUtil {
// }
public static InputStream getInputStreamByStorageClient(String url) throws Exception {
Handler.activateProtocol();
URL smsHome = null;
try {
smsHome = new URL(url);
smsHome = new URL(null, url, new URLStreamHandler() {
@Override
protected URLConnection openConnection(URL u) throws IOException {
return new SMPURLConnection(u);
}
});
// smsHome = new URL(url);
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
@ -87,6 +99,22 @@ public class StorageUtil {
InputStream is=uc.getInputStream();
return is;
}
// public static InputStream getInputStreamByStorageClient(String url) throws Exception {
//
// Handler.activateProtocol();
// URL smsHome = null;
// try {
// smsHome = new URL(url);
// } catch (MalformedURLException e1) {
// e1.printStackTrace();
// }
// URLConnection uc = null;
// uc = ( URLConnection ) smsHome.openConnection();
// InputStream is=uc.getInputStream();
// return is;
// }
// public static String extractLocation(String url) {
// String [] loc=url.split("//");