• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BasicService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.jnlp.BasicService的典型用法代码示例。如果您正苦于以下问题:Java BasicService类的具体用法?Java BasicService怎么用?Java BasicService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BasicService类属于javax.jnlp包,在下文中一共展示了BasicService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: browse

import javax.jnlp.BasicService; //导入依赖的package包/类
public static boolean browse(URI uri) throws IOException , UnavailableServiceException {
        // Try using the Desktop api first
        try {
            Desktop desktop = Desktop.getDesktop();
            desktop.browse(uri);

            return true;
        } catch (SecurityException e) {
//             Running in sandbox, try using WebStart service
            BasicService basicService =
                    (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");

            if (basicService.isWebBrowserSupported()) {
                return basicService.showDocument(uri.toURL());
            }
        }

        return false;
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:20,代码来源:DemoUtilities.java


示例2: getCodeBaseJavaws

import javax.jnlp.BasicService; //导入依赖的package包/类
public URL getCodeBaseJavaws() {
    try {
        BasicService bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
        URL codebase = bs.getCodeBase();
        if (codebase != null) {
            System.out.println("javaws codebase: " + codebase.toString());
            return codebase;
        } else {
            System.out.println("javaws codebase: null");
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        System.out.println("javaws codebase: null");
    }
    return null;
}
 
开发者ID:GITNE,项目名称:icedtea-web,代码行数:17,代码来源:GifarMain.java


示例3: checkSetup

import javax.jnlp.BasicService; //导入依赖的package包/类
public void checkSetup(String method) {
    try {
        BasicService basicService =
            (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
        // getCodeBase() will return null if ServiceManager does not 
        // have access to ApplicationInstance.
        String codebase = basicService.getCodeBase().toString();
        System.out.println("Codebase for applet was found in " + method
            + ": " + codebase);
    } catch (NullPointerException npe) {
        System.err.println("Exception occurred with null codebase in " + method);
        npe.printStackTrace();
    } catch (Exception ex) {
        System.err.println("Exception occurred (probably with ServiceManager).");
      ex.printStackTrace();
    }
}
 
开发者ID:GITNE,项目名称:icedtea-web,代码行数:18,代码来源:CheckServices.java


示例4: shouldReadTargetJavaURLRelativePath

import javax.jnlp.BasicService; //导入依赖的package包/类
@Test
public void shouldReadTargetJavaURLRelativePath() throws UnavailableServiceException, MalformedURLException {
    // given
    System.setProperty("jnlp.IceBoar.targetJavaURL", "myURL.zip");
    System.setProperty("jnlp.IceBoar.jar.0", "xyz.jar");
    BasicService service = mock(BasicService.class);
    when(service.getCodeBase()).thenReturn(new URL("http://example.com/codebase/"));
    ServiceManagerStub stub = mock(ServiceManagerStub.class);
    when(stub.lookup("javax.jnlp.BasicService")).thenReturn(service);
    ServiceManager.setServiceManagerStub(stub); //lookup("javax.jnlp.BasicService")).getCodeBase()

    // when
    GlobalSettings settings = GlobalSettingsFactory.getGlobalSettings(null);

    // then
    assertThat(settings.getTargetJavaURL())
            .isEqualTo("http://example.com/codebase/myURL.zip");
}
 
开发者ID:Roche,项目名称:IceBoar,代码行数:19,代码来源:GlobalSettingsFactoryTest.java


示例5: WebstartPersistence

import javax.jnlp.BasicService; //导入依赖的package包/类
/**
 * Creates a instance of class
 */
public WebstartPersistence() {
	try {
		ps = (PersistenceService) ServiceManager.lookup("javax.jnlp.PersistenceService");
		bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");

		if (ps != null && bs != null) {
			codebase = bs.getCodeBase();
		}

	} catch (UnavailableServiceException e) {
		e.printStackTrace(System.err);
		ps = null;
		bs = null;
	}
}
 
开发者ID:arianne,项目名称:marauroa,代码行数:19,代码来源:WebstartPersistence.java


示例6: getWebAppContextUrl

import javax.jnlp.BasicService; //导入依赖的package包/类
/**
 * Uses the jnlp API to determine the webapp context.
 * If used outside of webstart, <code>fallBackWebAppContextUrl</code> is returned.
 * For example this could return <code>http://localhost:8080/mywebapp/</code>.
 *
 * @return the url to the webapp ending with a slash
 */
public String getWebAppContextUrl() {
    String webAppContextUrl;
    try {
        BasicService basicService = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
        String codeBase = basicService.getCodeBase().toExternalForm();
        if (!codeBase.endsWith("/")) {
            codeBase += "/";
        }
        int webAppContextUrlLength = codeBase.lastIndexOf(jnlpRelativeDirectoryPathFromWebAppContext);
        webAppContextUrl = codeBase.substring(0, webAppContextUrlLength + 1);
    } catch (UnavailableServiceException e) {
        // TODO logging
        webAppContextUrl = fallBackWebAppContextUrl;
    }
    return webAppContextUrl;
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:24,代码来源:JnlpPropertyPlaceholderConfigurer.java


示例7: loadProperties

import javax.jnlp.BasicService; //导入依赖的package包/类
private static void loadProperties() {
    BasicService bService = getBasicService();
    PersistenceService pService = getPersistenceService();
    properties = new Properties();
    try {
        FileContents fc = pService.get(bService.getCodeBase());
        properties.load(fc.getInputStream());
    } catch (Exception ex) {
        // no props will be loaded
        LOGGER.info(Utils.exc2String(ex));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:Utils.java


示例8: showDocument

import javax.jnlp.BasicService; //导入依赖的package包/类
/**
 * Tries to open passed URL in system browser 
 * using JNLP BasicService
 */
public static boolean showDocument(String url) {
    URL url2Show = null;
    try {
        url2Show = new java.net.URL(url);
    } catch (MalformedURLException ex) {
        // nothing much to do here
    }
    BasicService service = getBasicService();
    if (service != null) {
        return service.showDocument(url2Show);
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:Utils.java


示例9: lookup

import javax.jnlp.BasicService; //导入依赖的package包/类
@Override
public Object lookup(String service) throws UnavailableServiceException
{
	if( BasicService.class.getName().equals(service) )
	{
		return basic;
	}
	return null;
}
 
开发者ID:equella,项目名称:Equella,代码行数:10,代码来源:ServiceManagerHarness.java


示例10: getBasicService

import javax.jnlp.BasicService; //导入依赖的package包/类
public static BasicService getBasicService() throws UnavailableServiceException {
    if ( isJavaWebStart() ) {
        return (BasicService) ServiceManager.lookup( BasicService.class.getName() );
    }
    else {
        return new LocalBasicService();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:PhetServiceManager.java


示例11: showURL

import javax.jnlp.BasicService; //导入依赖的package包/类
public static boolean showURL( URL url ) {
    try {
        // Lookup the javax.jnlp.BasicService object
        BasicService bs = (BasicService) ServiceManager.lookup( "javax.jnlp.BasicService" );
        // Invoke the showDocument method
        return bs.showDocument( url );
    }
    catch ( UnavailableServiceException ue ) {
        // Service is not supported
        return false;
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:TestPhetServiceManager.java


示例12: getBasicService

import javax.jnlp.BasicService; //导入依赖的package包/类
public static BasicService getBasicService() throws Exception {
    if ( isJavaWebStart() ) {
        return (BasicService) ServiceManager.lookup( BasicService.class.getName() );
    }
    else {
        return new LocalBasicService();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:JavaVersionChecker.java


示例13: getIconPath

import javax.jnlp.BasicService; //导入依赖的package包/类
public static String getIconPath() throws UnavailableServiceException{
    BasicService basicService = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
    try {
        return IcoEncoder.getIconPath(new java.net.URL(basicService.getCodeBase(), "icon48.png"), null);
    } catch (MalformedURLException ex) {
        Logger.getLogger(InstallUtil.class.getName()).log(Level.SEVERE, null, ex);
    }
    return "";
}
 
开发者ID:steveonjava,项目名称:widgetfx,代码行数:10,代码来源:InstallUtil.java


示例14: getCodeBase

import javax.jnlp.BasicService; //导入依赖的package包/类
private static String getCodeBase() {
    String codeBase = "";
    try {
        codeBase = ((BasicService) ServiceManager.lookup("javax.jnlp.BasicService")).getCodeBase()
                                                                                    .toString();
    } catch (UnavailableServiceException e) {
        System.out.println("BasicService is uninitialized. Do you started it from JNLP?");
    }
    return codeBase;
}
 
开发者ID:Roche,项目名称:IceBoar,代码行数:11,代码来源:GlobalSettingsFactory.java


示例15: BasicServiceFacade

import javax.jnlp.BasicService; //导入依赖的package包/类
public BasicServiceFacade ()
{
    try {
        service = (BasicService) ServiceManager.lookup(
            "javax.jnlp.BasicService");
        logger.debug("Real BasicService available");

        // Use JNLP cache for all downloads
        JnlpResponseCache.init();
    } catch (UnavailableServiceException ex) {
        logger.debug("No BasicService available");
    }
}
 
开发者ID:jlpoolen,项目名称:libreveris,代码行数:14,代码来源:Jnlp.java


示例16: EvercookieJnlpBackend

import javax.jnlp.BasicService; //导入依赖的package包/类
public EvercookieJnlpBackend() {
	super();
	try {
		BasicService basicService = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
		codebaseUrl = basicService.getCodeBase();
		persistenceService = (PersistenceService) ServiceManager.lookup("javax.jnlp.PersistenceService");
	} catch (UnavailableServiceException e) {
		// JNLP services not available. We're dead in the water.
		isAvailable = false;
	}
}
 
开发者ID:gabrielbauman,项目名称:evercookie-applet,代码行数:12,代码来源:EvercookieJnlpBackend.java


示例17: getServiceNames

import javax.jnlp.BasicService; //导入依赖的package包/类
@Override
public String[] getServiceNames()
{
	return new String[]{BasicService.class.getName()};
}
 
开发者ID:equella,项目名称:Equella,代码行数:6,代码来源:ServiceManagerHarness.java


示例18: getBasicService

import javax.jnlp.BasicService; //导入依赖的package包/类
private BasicService getBasicService()
{
	return (BasicService) getLocalService(BasicService.class);
}
 
开发者ID:equella,项目名称:Equella,代码行数:5,代码来源:ClientServiceImpl.java


示例19: getBasicService

import javax.jnlp.BasicService; //导入依赖的package包/类
static public BasicService getBasicService() {
    if (_basicService == null) {
        initServices();
    }
    return _basicService;
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:7,代码来源:Config.java


示例20: getBasicService

import javax.jnlp.BasicService; //导入依赖的package包/类
/**
 * @return the BasicService reference, or null if the service is
 * unavailable.
 */
public static BasicService getBasicService() {
    return (BasicService) getService("javax.jnlp.BasicService");
}
 
开发者ID:GITNE,项目名称:icedtea-web,代码行数:8,代码来源:ServiceUtil.java



注:本文中的javax.jnlp.BasicService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java INACTIVE类代码示例发布时间:2022-05-21
下一篇:
Java Request类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap