Example usage for java.net URL toString

List of usage examples for java.net URL toString

Introduction

In this page you can find the example usage for java.net URL toString.

Prototype

public String toString() 

Source Link

Document

Constructs a string representation of this URL .

Usage

From source file:org.kemri.wellcome.dhisreport.api.model.HttpDhis2Server.java

public void setsUrl(URL url) {
    this.sUrl = url.toString();
}

From source file:MiniBrowser.java

private void updateButtons() {
    if (pageList.size() < 2) {
        backButton.setEnabled(false);/*from   w  w  w.  ja  v a2  s.  co m*/
        forwardButton.setEnabled(false);
    } else {
        URL currentUrl = displayEditorPane.getPage();
        int pageIndex = pageList.indexOf(currentUrl.toString());
        backButton.setEnabled(pageIndex > 0);
        forwardButton.setEnabled(pageIndex < (pageList.size() - 1));
    }
}

From source file:de.peterspan.csv2db.converter.AbstractConverter.java

void injectContext() {
    URL resource = AppWindow.class.getResource("app-config.xml");
    new ApplicationContextLoader().load(this, resource.toString());
}

From source file:com.mycompany.crawlertest.GrabManager.java

private void addNewURLs(GrabPage grabPage) {
    for (URL url : grabPage.getUrlList()) {
        if (url.toString().contains("#")) {
            try {
                url = new URL(StringUtils.substringBefore(url.toString(), "#"));
            } catch (MalformedURLException e) {
            }/*www. ja v  a2 s  .  c o  m*/
        }

        submitNewURL(url, grabPage.getDepth() + 1);
    }
}

From source file:eu.eubrazilcc.lvl.service.WorkflowTest.java

@Before
public void setUp() throws Exception {
    // load test configuration
    final ImmutableList.Builder<URL> builder = new ImmutableList.Builder<URL>();
    final ImmutableList<URL> defaultUrls = getDefaultConfiguration();
    for (final URL url : defaultUrls) {
        if (!url.toString().endsWith(REST_SERVICE_CONFIG)) {
            builder.add(url);//  w ww .java  2  s .c  o  m
        } else {
            builder.add(this.getClass().getResource("/config/lvl-service.xml"));
        }
    }
    CONFIG_MANAGER.setup(builder.build());
    CONFIG_MANAGER.preload();
    // setup test file-system environment
    deleteQuietly(TEST_OUTPUT_DIR);
    TEST_OUTPUT_DIR.mkdirs();
    // prepare client
    final Client client = ClientBuilder.newBuilder().register(MapperProvider.class)
            .register(JacksonFeature.class).register(SseFeature.class).build();
    // configure Web target
    target = client.target(BASE_URI);
    target.property(ClientProperties.FOLLOW_REDIRECTS, true);
    // insert valid tokens in the database
    TOKEN_DAO.insert(
            AccessToken.builder().token(TOKEN_ROOT).issuedAt(currentTimeMillis() / 1000l).expiresIn(604800l)
                    .ownerId(toResourceOwnerId("root")).scope(asPermissionList(allPermissions())).build());
}

From source file:com.thoughtworks.go.util.Log4jDirectConfigurer.java

private boolean isLog4jExist() throws IOException {
    File file = ResourceUtils.getFile(log4jLocation);
    if (log4jExistInPath(file)) {
        doExistAction(file.getAbsolutePath());
        return true;
    }/*from   w  ww  . j  av  a2s. co  m*/
    URL resource = Loader.getResource(log4jLocation);
    if (log4JExistInClassPath(resource)) {
        doExistAction(resource.toString());
        return true;
    }
    return false;
}

From source file:org.apache.cxf.dosgi.singlebundle.SPIActivator.java

protected void register(final Bundle bundle) {
    Map<String, Callable<Class>> map = factories.get(bundle.getBundleId());

    Vector<URL> v = new Vector<URL>();
    try {//from   ww w . j a v a2s  .co m
        Resource[] resources = new OsgiBundleResourcePatternResolver(bundle)
                .getResources("classpath*:META-INF/services/*");
        for (Resource r : resources) {
            v.add(r.getURL());
        }
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    Enumeration<URL> e = v.elements();
    if (e != null) {
        while (e.hasMoreElements()) {
            final URL u = (URL) e.nextElement();
            final String url = u.toString();
            if (url.endsWith("/")) {
                continue;
            }
            final String factoryId = url.substring(url.lastIndexOf("/") + 1);
            if (map == null) {
                map = new HashMap<String, Callable<Class>>();
                factories.put(bundle.getBundleId(), map);
            }
            map.put(factoryId, new Callable<Class>() {
                public Class call() throws Exception {
                    BufferedReader br = new BufferedReader(new InputStreamReader(u.openStream(), "UTF-8"));
                    String factoryClassName = br.readLine();
                    br.close();
                    return bundle.loadClass(factoryClassName);
                }
            });
        }
    }
    if (map != null) {
        for (Map.Entry<String, Callable<Class>> entry : map.entrySet()) {
            OsgiLocator.register(entry.getKey(), entry.getValue());
        }
    }
}

From source file:com.ctg.itrdc.janus.rpc.protocol.hessian.HttpClientConnection.java

public HttpClientConnection(HttpClient httpClient, URL url) {
    this.httpClient = httpClient;
    this.output = new ByteArrayOutputStream();
    this.request = new HttpPost(url.toString());
}

From source file:org.jboss.additional.testsuite.jdkall.present.web.servlet.headers.CookieHeaderServletTestCase.java

@Test
@OperateOnDeployment(DEPLOYMENT)//from  w w  w  .j  av  a2s. c o m
public void cookieHeaderTest(@ArquillianResource URL url) throws Exception {
    URL testURL = new URL(url.toString() + "cookieHeaderServlet");

    final HttpGet request = new HttpGet(testURL.toString());
    CloseableHttpClient httpClient = HttpClientBuilder.create().build();
    CloseableHttpResponse response = null;

    response = httpClient.execute(request);
    Assert.assertTrue("Wrong Set-Cookie header format.",
            response.getFirstHeader("Set-Cookie").getValue().contains("\"example cookie\""));
    IOUtils.closeQuietly(response);
    httpClient.close();

}

From source file:com.cladonia.xngreditor.URLUtilities.java

public static String toDisplay(URL url) {
    return toDisplay(url.toString());
}