当前位置: 首页>>代码示例>>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;未经允许,请勿转载。