Examples of openConnection()


Examples of java.net.URL.openConnection()

    private static final int BUFFER_SIZE_IF_NO_CONTENT_LENGTH_HEADER = 1024;

    public static URLConnection httpGet(WebServer webServer, String path) throws IOException {
        URL url = new URL(webServer.getUri().toURL(), path);
        return url.openConnection();
    }

    public static URLConnection httpPost(WebServer webServer, String path, String body) throws IOException {
        URL url = new URL(webServer.getUri().toURL(), path);
        HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
View Full Code Here

Examples of java.net.URL.openConnection()

        return url.openConnection();
    }

    public static URLConnection httpPost(WebServer webServer, String path, String body) throws IOException {
        URL url = new URL(webServer.getUri().toURL(), path);
        HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
        urlConnection.setRequestMethod("POST");
        urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        urlConnection.setDoOutput(true);
        urlConnection.getOutputStream().write(body.getBytes(Charset.forName("UTF8")));
        return urlConnection;
View Full Code Here

Examples of net.kano.joustsim.oscar.AimSession.openConnection()

    public void login(String userID, String password) throws IMException {
        DefaultAppSession session = new DefaultAppSession();

        AimSession aimSession = session.openAimSession(
                new Screenname(userID));
        aimConnection = aimSession.openConnection(
                new AimConnectionProperties(
                        new Screenname(userID)
                        , password));

        AimConnStateListener aimConnStateListener = new AimConnStateListener();
View Full Code Here

Examples of npanday.dao.ProjectDao.openConnection()

            throws IOException, NPandayRepositoryException
    {
        ProjectDao dao = (ProjectDao) daoRegistry.find( "dao:project" );
        dao.init( artifactFactory, artifactResolver );
        dao.setRdfRepository( repository );
        dao.openConnection();
        Set<Project> projects;

        try
        {
            projects = dao.getAllProjects();
View Full Code Here

Examples of npanday.dao.impl.ProjectDaoImpl.openConnection()

    private ProjectDao createProjectDao( Repository rdfRepository )
    {
        ProjectDaoImpl dao = new ProjectDaoImpl();
        dao.init( new ArtifactFactoryTestStub(), new ArtifactResolverTestStub() );
        dao.setRdfRepository( rdfRepository );
        dao.openConnection();
        return dao;
    }

    private void exportRepositoryToRdf( String fileName, File localRepository, Repository rdfRepository )
    {
View Full Code Here

Examples of org.akubraproject.BlobStore.openConnection()

  private static BlobStoreConnection getTestConnection(boolean prefixMappable)
      throws Exception {
    BlobStore store = new IdMappingBlobStore(URI.create("urn:test-store"),
        new MemBlobStore(), new MockIdMapper("internal:", prefixMappable));
    return store.openConnection(null, null);
  }

  private static void addTestBlob(BlobStoreConnection connection,
                                  URI blobId) throws Exception {
    Blob blob = connection.getBlob(blobId, null);
View Full Code Here

Examples of org.apache.geronimo.system.plugin.PluginRepositoryList.openConnection()

                response.setRenderParameter("repoError", "Invalid repository URL "+repo);
                return false;
            }
            URL test = new URL(repo+"geronimo-plugins.xml");
            log.debug("Checking repository "+test);
            URLConnection urlConnection = test.openConnection();
            if(urlConnection instanceof HttpURLConnection) {
                HttpURLConnection con = (HttpURLConnection) urlConnection;
                try {
                    con.connect();
                } catch (ConnectException e) {
View Full Code Here

Examples of org.apache.hadoop.hdfs.ByteRangeInputStream.URLOpener.openConnection()

    is.seek(100);
    is.read();

    assertEquals("Seek to 100 bytes made incorrectly (Range Check)",
        "bytes=100-", rspy.openConnection().getRequestProperty("Range"));

    assertEquals("getPos should be 101 after reading one byte", 101,
        is.getPos());

    verify(rspy, times(2)).openConnection();
View Full Code Here

Examples of org.apache.hadoop.hdfs.web.WebHdfsFileSystem.OffsetUrlOpener.openConnection()

    // Seek to 101 should not result in another request"

    is.seek(2500);
    is.read();

    ((MockHttpURLConnection) rspy.openConnection()).setResponseCode(206);
    is.seek(0);

    try {
      is.read();
      fail("Exception should be thrown when 206 response is given "
View Full Code Here

Examples of org.apache.hadoop.security.authentication.client.AuthenticatedURL.openConnection()

    params.put(TimelineAuthenticationConsts.RENEWER_PARAM, renewer);
    url = appendParams(url, params);
    AuthenticatedURL aUrl =
        new AuthenticatedURL(new TimelineAuthenticator());
    try {
      HttpURLConnection conn = aUrl.openConnection(url, token);
      conn.setRequestMethod(op.getHttpMethod());
      TimelineDelegationTokenResponse dtRes = validateAndParseResponse(conn);
      if (!dtRes.getType().equals(
          TimelineAuthenticationConsts.DELEGATION_TOKEN_URL)) {
        throw new IOException("The response content is not expected: "
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.