本文整理汇总了Java中org.globus.axis.gsi.GSIConstants类的典型用法代码示例。如果您正苦于以下问题:Java GSIConstants类的具体用法?Java GSIConstants怎么用?Java GSIConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GSIConstants类属于org.globus.axis.gsi包,在下文中一共展示了GSIConstants类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getData
import org.globus.axis.gsi.GSIConstants; //导入依赖的package包/类
/**
* Returns a handle to the input stream of the socket which is returning the
* data referred to by the descriptor. This method can make an https
* connection if desired using the credentials passed in. If you wish to use
* this method to connect to http it will not use the Crediential whether
* you pass them in or they are null,
*
* @param desc
* data transfer descriptor received from
* TransferServiceContextClient
* @param creds
* creator of the transfer resource credentials
* @return
* @throws Exception
*/
public static InputStream getData(DataTransferDescriptor desc, GlobusCredential creds) throws Exception {
InputStream dataStream = null;
URL url = new URL(desc.getUrl());
if (url.getProtocol().equals("http")) {
URLConnection conn = url.openConnection();
conn.connect();
dataStream = conn.getInputStream();
} else if (url.getProtocol().equals("https")) {
if (creds != null) {
GlobusGSSCredentialImpl cred = new GlobusGSSCredentialImpl(creds, GSSCredential.INITIATE_AND_ACCEPT);
GSIHttpURLConnection connection = new GSIHttpURLConnection(url);
connection.setGSSMode(GSIConstants.MODE_SSL);
connection.setCredentials(cred);
dataStream = connection.getInputStream();
} else {
throw new Exception(
"To use the https protocol to retrieve data from the Transfer Service you must have credentials");
}
} else {
throw new Exception("Protocol " + url.getProtocol() + " not supported.");
}
return dataStream;
}
示例2: doGet
import org.globus.axis.gsi.GSIConstants; //导入依赖的package包/类
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
LOG.debug("getPathInfo[" + request.getPathInfo() + "]");
LOG.debug("getQueryString[" + request.getQueryString() + "]");
LOG.debug("getRequestURI[" + request.getRequestURI() + "]");
LOG.debug("getRequestURL[" + request.getRequestURL() + "]");
LOG.debug("getServerName[" + request.getServerName() + "]");
LOG.debug("getServerPort[" + request.getServerPort() + "]");
LOG.debug("getServletPath[" + request.getServletPath() + "]");
LOG.debug("User Identity[" + request.getAttribute(GSIConstants.GSI_USER_DN));
processor.process(request, response);
}
示例3: setAnonymous
import org.globus.axis.gsi.GSIConstants; //导入依赖的package包/类
private static void setAnonymous(Stub stub) {
stub._setProperty(org.globus.wsrf.security.Constants.GSI_ANONYMOUS,
Boolean.TRUE);
stub._setProperty(org.globus.wsrf.security.Constants.AUTHORIZATION,
NoAuthorization.getInstance());
stub._setProperty(GSIConstants.GSI_AUTHORIZATION,
org.globus.gsi.gssapi.auth.NoAuthorization.getInstance());
}
示例4: putData
import org.globus.axis.gsi.GSIConstants; //导入依赖的package包/类
/**
* Reads from the input stream to put the data to the server. Be sure to
* close the stream when done writing the data. This method can use http and
* https if the credentials are provided. This is a blocking call. Will
* return with the entire data has been transmitted.
*
* @param is
* input stream providing the data
* @param contentLength
* number of bytes in the input stream to be read
* @param desc
* data transfer descriptor received from
* TransferServiceContextClient
* @param creds
* creator of the transfer resource credentials
* @return
* @throws Exception
*/
public static void putData(InputStream is, long contentLength, DataTransferDescriptor desc, GlobusCredential creds)
throws Exception {
URL url = new URL(desc.getUrl());
if (url.getProtocol().equals("http")) {
PostMethod post = new PostMethod(desc.getUrl());
InputStreamRequestEntity re = new InputStreamRequestEntity(is, contentLength);
post.setRequestEntity(re);
HttpClient client = new HttpClient();
int status = client.executeMethod(post);
} else if (url.getProtocol().equals("https")) {
if (creds != null) {
GlobusGSSCredentialImpl cred = new GlobusGSSCredentialImpl(creds, GSSCredential.INITIATE_AND_ACCEPT);
GSIHttpURLConnection connection = new GSIHttpURLConnection(url);
connection.setGSSMode(GSIConstants.MODE_SSL);
connection.setCredentials(cred);
try {
int l = -1;
byte[] buffer = new byte[1024];
while ((l = is.read(buffer)) != -1) {
connection.getOutputStream().write(buffer, 0, l);
}
} finally {
is.close();
}
connection.getOutputStream().close();
connection.getInputStream().close();
} else {
throw new Exception(
"To use the https protocol to stage data to the Transfer Service you must have credentials");
}
} else {
throw new Exception("Protocol " + url.getProtocol() + " not supported.");
}
}
示例5: setAnonymous
import org.globus.axis.gsi.GSIConstants; //导入依赖的package包/类
private static void setAnonymous(Stub stub, Authorization authz) {
stub._setProperty(org.globus.wsrf.security.Constants.GSI_ANONYMOUS, Boolean.TRUE);
if (authz == null) {
stub._setProperty(org.globus.wsrf.security.Constants.AUTHORIZATION, NoAuthorization.getInstance());
stub._setProperty(GSIConstants.GSI_AUTHORIZATION, org.globus.gsi.gssapi.auth.NoAuthorization.getInstance());
} else {
stub._setProperty(org.globus.wsrf.security.Constants.AUTHORIZATION, authz);
}
}