make external links open in a new tab

This commit is contained in:
Athou
2013-03-23 09:13:04 +01:00
parent b67ee13c64
commit cb066ae1b2
4 changed files with 54 additions and 34 deletions

View File

@@ -1,5 +1,23 @@
CommaFeed
=========
Google Reader inspired self-hosted RSS reader.
Google Reader inspired self-hosted RSS reader, based on Wicket and AngularJS.
Deploy on any JavaEE6 container or better yet on OpenShift.
Deployment on OpenShift
----------
* Create an account on `http://www.openshift.com/`.
* Add an application, select `JBoss Enterprise Application Platform 6.0``.
* For the`Public URL` set the name you want (e.g. `commafeed`).
* For the`Source Code` option, click ``Change` and set this repository (`https://github.com/Athou/commafeed.git`)`.
* Click `Create Application`.
* Click `Add cartridge` and select `MySQL`.
* Wait a couple of minutes and access your application.
* The defaut user is `admin` and the password is `admin`.
Local development
-----------------
`mvn clean package tomee:run` and access `http://localhost:8082`. Any changes to the source code will be applied immediatly.

54
pom.xml
View File

@@ -56,7 +56,7 @@
<tomeeVersion>1.6.0-SNAPSHOT</tomeeVersion>
<tomeeClassifier>plus</tomeeClassifier>
<tomeeHttpPort>8082</tomeeHttpPort>
<args>-Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled</args>
<args>-Xmx1024m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled</args>
<reloadOnUpdate>true</reloadOnUpdate>
<synchronization>
<updateInterval>1</updateInterval>
@@ -71,20 +71,6 @@
</synchronization>
</configuration>
</plugin>
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -101,11 +87,6 @@
<artifactId>EasyCriteria</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@@ -137,6 +118,16 @@
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.googlecode.lambdaj</groupId>
<artifactId>lambdaj</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>net.java.dev.rome</groupId>
@@ -149,14 +140,20 @@
<version>4.2.3</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.2</version>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.lambdaj</groupId>
<artifactId>lambdaj</artifactId>
<version>2.3.3</version>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.4</version>
</dependency>
<dependency>
@@ -175,11 +172,6 @@
<version>6.6.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
</dependency>
</dependencies>
<profiles>

View File

@@ -8,6 +8,8 @@ import javax.ejb.Stateless;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.SystemUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import com.commafeed.model.Feed;
import com.commafeed.model.FeedEntry;
@@ -65,6 +67,13 @@ public class FeedParser {
}
}), SystemUtils.LINE_SEPARATOR);
}
content = handleContent(content);
return content;
}
private String handleContent(String content) {
Document doc = Jsoup.parse(content);
doc.select("a").attr("target", "_blank");
return doc.outerHtml();
}
}

View File

@@ -7,6 +7,7 @@ import java.util.List;
import javax.inject.Inject;
import org.apache.commons.lang.ObjectUtils;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import com.commafeed.backend.dao.FeedCategoryService;
@@ -78,7 +79,7 @@ public class FeedEntriesREST extends JSONPage {
@Override
public int compare(Entry e1, Entry e2) {
return e2.getDate().compareTo(e1.getDate());
return ObjectUtils.compare(e2.getDate(), e1.getDate());
}
});
return entries;