Package org.rssowl.core.internal.connection

Examples of org.rssowl.core.internal.connection.DefaultProtocolHandler


    IFeed feed = new Feed(feedUrl);
    AuthenticationRequiredException e = null;

    try {
      new DefaultProtocolHandler().openStream(feed.getLink(), null);
    } catch (AuthenticationRequiredException e1) {
      e = e1;
    }

    assertNotNull(e);

    ICredentials credentials = new ICredentials() {
      public String getDomain() {
        return null;
      }

      public String getPassword() {
        return "admin";
      }

      public String getUsername() {
        return "bpasero";
      }
    };

    credProvider.setAuthCredentials(credentials, feedUrl);

    InputStream inS = new DefaultProtocolHandler().openStream(feed.getLink(), null);
    assertNotNull(inS);

    Owl.getInterpreter().interpret(inS, feed);
    assertEquals("RSS 2.0", feed.getFormat());
  }
View Full Code Here


  @SuppressWarnings("nls")
  public void testHTTPFeed() throws Exception {
    URI feedUrl = new URI("http://www.rssowl.org/rssowl2dg/tests/connection/rss_2_0.xml");
    IFeed feed = new Feed(feedUrl);

    InputStream inS = new DefaultProtocolHandler().openStream(feed.getLink(), null);
    assertNotNull(inS);

    Owl.getInterpreter().interpret(inS, feed);
    assertEquals("RSS 2.0", feed.getFormat());
  }
View Full Code Here

  @SuppressWarnings("nls")
  public void testHTTPSFeed() throws Exception {
    URI feedUrl = new URI("https://sourceforge.net/export/rss2_projnews.php?group_id=141424&rss_fulltext=1");
    IFeed feed = new Feed(feedUrl);

    InputStream inS = new DefaultProtocolHandler().openStream(feed.getLink(), null);
    assertNotNull(inS);

    Owl.getInterpreter().interpret(inS, feed);
    assertEquals("RSS 2.0", feed.getFormat());
  }
View Full Code Here

  public void testConditionalGet() throws Exception {
    URI feedUrl = new URI("http://rss.slashdot.org/Slashdot/slashdot/to");
    IFeed feed = new Feed(feedUrl);
    NotModifiedException e = null;

    InputStream inS = new DefaultProtocolHandler().openStream(feed.getLink(), null);
    assertNotNull(inS);

    String ifModifiedSince = null;
    String ifNoneMatch = null;
    if (inS instanceof IConditionalGetCompatible) {
      ifModifiedSince = ((IConditionalGetCompatible) inS).getIfModifiedSince();
      ifNoneMatch = ((IConditionalGetCompatible) inS).getIfNoneMatch();
    }
    IConditionalGet conditionalGet = Owl.getModelFactory().createConditionalGet(ifModifiedSince, feedUrl, ifNoneMatch);

    Map<Object, Object> conProperties = new HashMap<Object, Object>();
    ifModifiedSince = conditionalGet.getIfModifiedSince();
    if (ifModifiedSince != null)
      conProperties.put(IConnectionPropertyConstants.IF_MODIFIED_SINCE, ifModifiedSince);

    ifNoneMatch = conditionalGet.getIfNoneMatch();
    if (ifNoneMatch != null)
      conProperties.put(IConnectionPropertyConstants.IF_NONE_MATCH, ifNoneMatch);

    try {
      new DefaultProtocolHandler().openStream(feed.getLink(), conProperties);
    } catch (NotModifiedException e1) {
      e = e1;
    }

    assertNotNull(e);
View Full Code Here

    IFeed feed = new Feed(feedUrl);
    AuthenticationRequiredException e = null;

    try {
      conManager.getCredentialsProvider(feedUrl).deleteProxyCredentials(feedUrl); //Disable Proxy
      new DefaultProtocolHandler().openStream(feed.getLink(), null);
    } catch (AuthenticationRequiredException e1) {
      e = e1;
    }

    assertNull(e);
View Full Code Here

TOP

Related Classes of org.rssowl.core.internal.connection.DefaultProtocolHandler

Copyright © 2018 www.massapicom. 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.