當前位置: 首頁>>代碼示例>>Java>>正文


Java GSIConstants類代碼示例

本文整理匯總了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;
}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:39,代碼來源:TransferClientHelper.java

示例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);
}
 
開發者ID:NCIP,項目名稱:gsid,代碼行數:18,代碼來源:NamingAuthorityService.java

示例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());
}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:9,代碼來源:Tomcat6ServiceContainer.java

示例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.");
    }
}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:53,代碼來源:TransferClientHelper.java

示例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);
    }

}
 
開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:11,代碼來源:ResourcePropertyHelper.java


注:本文中的org.globus.axis.gsi.GSIConstants類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。