Skip to content

Commit

Permalink
Merging Jim's SSE impl from his server-sent-event' branch (no tests yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
asoldano committed Apr 21, 2017
1 parent 0fb09fc commit f55c767
Show file tree
Hide file tree
Showing 24 changed files with 1,734 additions and 1 deletion.
4 changes: 4 additions & 0 deletions jboss-modules/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@
<maven-resource group="org.jboss.resteasy" artifact="resteasy-json-p-provider"/>
</module-def>

<module-def name="org.jboss.resteasy.resteasy-sse-provider">
<maven-resource group="org.jboss.resteasy" artifact="resteasy-sse-provider"/>
</module-def>

<module-def name="org.jboss.resteasy.resteasy-legacy">
<maven-resource group="org.jboss.resteasy" artifact="resteasy-legacy"/>
</module-def>
Expand Down
6 changes: 6 additions & 0 deletions jboss-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-sse-provider</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jose-jwt</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<module name="org.slf4j" />
<module name="javax.servlet.api"/>
<module name="org.jboss.resteasy.resteasy-validator-provider-11" optional="true" services="export" export="true"/>
<module name="org.jboss.resteasy.resteasy-sse-provider" services="export" export="true"/>
<module name="org.jboss.logging"/>
</dependencies>
</module>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2010, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<module xmlns="urn:jboss:module:1.1" name="org.jboss.resteasy.resteasy-sse-provider">
<resources>
<!-- Insert resources here -->
</resources>

<dependencies>
<module name="com.sun.xml.bind"/>
<module name="javax.xml.bind.api"/>
<module name="javax.api"/>
<module name="javax.enterprise.api"/>
<module name="javax.servlet.api"/>
<module name="javax.ws.rs.api"/>
<module name="org.yaml.snakeyaml"/>
<module name="org.jboss.resteasy.resteasy-jaxrs"/>
<module name="org.jboss.logging"/>
</dependencies>
</module>

1 change: 1 addition & 0 deletions providers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<module>json-p-ee7</module>
<module>resteasy-atom</module>
<module>multipart</module>
<module>sse</module>
<module>yaml</module>
<module>resteasy-html</module>
<module>resteasy-validator-provider-11</module>
Expand Down
126 changes: 126 additions & 0 deletions providers/sse/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs-all</artifactId>
<version>3.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>resteasy-sse-provider</artifactId>
<packaging>jar</packaging>
<name>RESTEasy SSE Provider</name>
<description/>

<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.2_spec</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.1_spec</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
</dependency>
</dependencies>


<profiles>
<profile>
<id>i18n</id>
<activation>
<property>
<name>i18n</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>initialize</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/resources/org/jboss/resteasy/plugins/providers/jaxb/i18n</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/test/resources/i18n</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<compilerArgument>
-AgeneratedTranslationFilesPath=${project.basedir}/target/generated-translation-files
</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.jboss.resteasy.plugins.providers.sse;

import java.io.ByteArrayOutputStream;
import java.util.Arrays;

public class EventByteArrayOutputStream extends ByteArrayOutputStream
{

private void removeBlankLine()
{
if (this.count > 4)
{
count = count - 4;
}
}

public synchronized byte getEventPayLoad()[]
{
removeBlankLine();
return Arrays.copyOf(buf, count);
}
}

0 comments on commit f55c767

Please sign in to comment.