Package org.rssowl.core.connection

Examples of org.rssowl.core.connection.IProtocolHandler.openStream()


      }

      properties.put(IConnectionPropertyConstants.ACCEPT_LANGUAGE, languageHeader.toString());
    }

    return handler.openStream(link, monitor, properties);
  }

  /* Updates Caches and Shows Elements */
  private void setImportedElements(List<? extends IEntity> types) {
    List<IFolderChild> folderChilds = new ArrayList<IFolderChild>();
View Full Code Here


          URI uri = new URI(transformedUrl);
          IProtocolHandler handler = Owl.getConnectionService().getHandler(uri);
          if (handler != null) {
            BufferedReader reader = null;
            try {
              InputStream inS = handler.openStream(uri, monitor, null);
              reader = new BufferedReader(new InputStreamReader(inS, "UTF-8")); //$NON-NLS-1$
              String line;
              while (!monitor.isCanceled() && (line = reader.readLine()) != null) {
                result.append(line);
              }
View Full Code Here

      Map<Object, Object> properties = new HashMap<Object, Object>();
      Map<String, String> headers = new HashMap<String, String>();
      headers.put("Authorization", SyncUtils.getGoogleAuthorizationHeader(authToken)); //$NON-NLS-1$
      properties.put(IConnectionPropertyConstants.HEADERS, headers);

      inS = handler.openStream(opmlImportUri, monitor, properties);

      /* Return on Cancellation */
      if (monitor.isCanceled()) {
        isCanceled = true;
        return null;
View Full Code Here

    /* Perform POST */
    URI uri = URI.create(SyncUtils.GOOGLE_EDIT_TAG_URL);
    IProtocolHandler handler = Owl.getConnectionService().getHandler(uri);
    InputStream inS = null;
    try {
      inS = handler.openStream(uri, new NullProgressMonitor(), properties); //Do not allow to cancel this outgoing request for transactional reasons
      fSyncItemsManager.removeUncommitted(equivalentItems);
      itemCount += equivalentItems.size();
    } finally {
      if (inS != null) {
        try {
View Full Code Here

        boolean canceled = false;
        Exception error = null;
        try {

          /* Open Stream */
          in = handler.openStream(request.getLink(), monitor, properties);

          /* Obtain real Content Length from Stream if available */
          if (in instanceof HttpConnectionInputStream) {
            int len = ((HttpConnectionInputStream) in).getContentLength();
            if (len > 0)
View Full Code Here

      properties.put(IConnectionPropertyConstants.POST, Boolean.TRUE);
      properties.put(IConnectionPropertyConstants.CON_TIMEOUT, getConnectionTimeout());

      BufferedReader reader = null;
      try {
        InputStream inS = handler.openStream(uri, monitor, properties);
        reader = new BufferedReader(new InputStreamReader(inS));
        String line;
        while (!monitor.isCanceled() && (line = reader.readLine()) != null) {
          if (line.startsWith(AUTH_IDENTIFIER))
            return line.substring(AUTH_IDENTIFIER.length());
View Full Code Here

      properties.put(IConnectionPropertyConstants.HEADERS, headers);
      properties.put(IConnectionPropertyConstants.CON_TIMEOUT, getConnectionTimeout());

      BufferedReader reader = null;
      try {
        InputStream inS = handler.openStream(uri, monitor, properties);
        reader = new BufferedReader(new InputStreamReader(inS));
        String line;
        while (!monitor.isCanceled() && (line = reader.readLine()) != null) {
          return line;
        }
View Full Code Here

    headers.put("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1");

    Map<Object, Object> properties = new HashMap<Object, Object>();
    properties.put(IConnectionPropertyConstants.HEADERS, headers);

    InputStream stream = handler.openStream(url, null, properties);

    assertEquals("gzip", ((HttpConnectionInputStream) stream).getContentEncoding());
  }

  /**
 
View Full Code Here

  @Test
  public void testHttpConnectionInputStream() throws Exception {
    IConnectionService conManager = Owl.getConnectionService();
    URI url = new URI("http://www.rssowl.org/favicon.ico");
    IProtocolHandler handler = conManager.getHandler(url);
    InputStream stream = handler.openStream(url, null, null);
    if (stream instanceof HttpConnectionInputStream) {
      HttpConnectionInputStream inS = (HttpConnectionInputStream) stream;
      assertTrue(inS.getContentLength() > 0);
      assertNotNull(inS.getIfModifiedSince());
      assertNotNull(inS.getIfNoneMatch());
View Full Code Here

    Map<String, String> headers = new HashMap<String, String>();
    headers.put("Authorization", SyncUtils.getGoogleAuthorizationHeader(authToken)); //$NON-NLS-1$
    properties.put(IConnectionPropertyConstants.HEADERS, headers);

    InputStream inS = handler.openStream(uri, new NullProgressMonitor(), properties);

    List<? extends IEntity> elements = Owl.getInterpreter().importFrom(inS);
    assertTrue(!elements.isEmpty());
  }
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.