Skip to content
Commits on Source (4)
target
# Intellij
###################
.idea
*.iml
*.ipr
*.iws
.idea
# Eclipse
###################
......@@ -10,14 +14,6 @@
**/.classpath
**/.checkstyle
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
......@@ -42,3 +38,5 @@
jaxrs/security/resteasy-crypto/*signed*.txt
myDB.script
myDB.properties
.DS_Store
\ No newline at end of file
install:
- mvn clean
script:
- mvn -B -fae -Dserver.version=$SERVER_VERSION install
language: java
jdk:
- oraclejdk8
- oraclejdk7
env:
- SERVER_VERSION=10.1.0.Final
- SERVER_VERSION=10.0.0.Final
- SERVER_VERSION=11.0.0.Alpha1
cache:
directories:
- $HOME/.m2
addons:
apt:
packages:
- oracle-java8-installer
before_install:
- "sudo unzip -j -o travis-libs/jce_policy-8.zip *.jar -d $JAVA_HOME/jre/lib/security"
......@@ -20,7 +20,9 @@ e.g. link to issue/bugzilla
~~~
## Communication
- [Mailing Lists](https://lists.sourceforge.net/lists/listinfo/resteasy-developers)
- General discussion: (https://lists.jboss.org/mailman/listinfo/resteasy)
- Development issues discussion: (https://lists.jboss.org/mailman/listinfo/resteasy-dev)
### More information
Read more about best practices in [this github guide](https://guides.github.com/activities/contributing-to-open-source/)
# Resteasy
# RESTEasy
[![Build Status](https://travis-ci.org/resteasy/Resteasy.svg?branch=master)](https://travis-ci.org/resteasy/Resteasy)
Resteasy is a JBoss.org project aimed at providing productivity frameworks for developing client and server RESTful applications and services in Java. It is mainly a JAX-RS implementation but you'll find some other experimental code in the repository.
RESTEasy is a JBoss.org project aimed at providing productivity frameworks for developing client and server RESTful applications and services in Java. It is mainly a JAX-RS implementation but you'll find some other experimental code in the repository.
The project page can be found at http://resteasy.jboss.org
## JAX-RS
RESTEasy is a JBoss project that provides various frameworks to help you build RESTful Web Services and RESTful Java applications. It is a portable implementation of the JAX-RS specification. JAX-RS is a new JCP specification that provides a Java API for RESTful Web Services over the HTTP protocol.
RESTEasy is a JBoss project that provides various frameworks to help you build RESTful Web Services and RESTful Java applications. It is a portable implementation of the JAX-RS specification. JAX-RS is a JCP specification that provides a Java API for RESTful Web Services over the HTTP protocol.
Read the entire specification [here](https://jax-rs-spec.java.net/)
The JAX-RS code is in the jaxrs directory.
The RESTEasy code is in the github repository, (https://github.com/resteasy/Resteasy.git).
## Getting started with RESTEasy
- Read a [book](http://resteasy.jboss.org/books.html)
- Check out the [examples](https://github.com/resteasy/Resteasy/tree/master/jaxrs/examples) in the repository.
- Read the [documentation](http://resteasy.jboss.org/docs.html).
- Check out the [examples](https://github.com/resteasy/resteasy-examples) in the repository.
- Read the [documentation](http://resteasy.jboss.org/docs).
## Documentation
To read the documentation you can [read it online](http://resteasy.jboss.org/docs.html). This is generated automatically from the [maven build](https://github.com/resteasy/Resteasy/tree/master/jaxrs/docbook)
To read the documentation you can [read it online](http://resteasy.jboss.org/docs). This is generated automatically from the [maven build](https://github.com/resteasy/Resteasy/tree/master/jaxrs/docbook)
A wiki exists. You can find it [here](http://wiki.jboss.org/wiki/RESTeasyJAXRS)
A wiki exists with historical documents. You can find it [here](https://developer.jboss.org/wiki/ResteasyWIKI)
## Issues
Issues are kept in [JIRA](http://jira.jboss.org/jira/browse/RESTEASY)
## Build
After pulling down a clone of the Resteasy repository run
After pulling down a clone of the RESTEasy repository run
mvn install
Currently it can be built only with JDK 1.7. JDK 1.8 breaks ant scriptlets because script engine changed from `rhino` to `nashorn`.
Currently it can be built only JDK 1.8.
### Requirements
- Java Cryptography Extension [JCE](http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html)
- Java Cryptography Extension [JCE](http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html)
## Contribute
You are most welcome to contribute to RESTEasy!
......
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs-all</artifactId>
<version>3.0.26.Final</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>RESTEASY-1056-jetty-bv11</artifactId>
<packaging>jar</packaging>
<name>RESTEASY-1056-jetty-bv11</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-jetty-embedded-9</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-validator-provider-11</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.el</groupId>
<artifactId>jboss-el-api_3.0_spec</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
package org.jboss.resteasy.test.resteasy1056;
import static org.junit.Assert.assertEquals;
import java.net.URI;
import javax.ws.rs.core.Response;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.resteasy.api.validation.ResteasyConstraintViolation;
import org.jboss.resteasy.api.validation.ResteasyViolationException;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.resteasy1056.TestApplication;
import org.jboss.resteasy.resteasy1056.TestResource;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* RESTEASY-1056
*
* @author <a href="ron.sigal@jboss.com">Ron Sigal</a>
* @version $Revision: 1.1 $
* <p>
* Copyright June 7, 2014
*/
@RunWith(Arquillian.class)
@RunAsClient
public class MissingCDITest {
@Deployment
public static Archive<?> createTestArchive() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "RESTEASY-1056.war")
.addClasses(TestApplication.class, TestResource.class)
.addAsWebInfResource("web.xml");
return war;
}
@ArquillianResource
URI baseUri;
@Test
public void testMissingCDIValid() throws Exception {
Response response = ResteasyClientBuilder.newClient().target(baseUri.toString() + "test/17").request().get();
System.out.println("Status: " + response.getStatus());
String entity = response.readEntity(String.class);
System.out.println("Result: " + entity);
assertEquals(200, response.getStatus());
Assert.assertEquals("17", entity);
}
@Test
public void testMissingCDIInvalid() throws Exception {
Response response = ResteasyClientBuilder.newClient().target(baseUri.toString() + "test/0").request().get();
System.out.println("Status: " + response.getStatus());
String entity = response.readEntity(String.class);
System.out.println("Result: " + entity);
assertEquals(400, response.getStatus());
ResteasyViolationException e = new ResteasyViolationException(entity);
countViolations(e, 1, 0, 0, 0, 1, 0);
ResteasyConstraintViolation cv = e.getParameterViolations().iterator().next();
Assert.assertTrue(cv.getMessage().equals("must be greater than or equal to 7"));
}
protected void countViolations(ResteasyViolationException e, int totalCount, int fieldCount, int propertyCount, int classCount, int parameterCount, int returnValueCount) {
Assert.assertEquals(totalCount, e.getViolations().size());
Assert.assertEquals(fieldCount, e.getFieldViolations().size());
Assert.assertEquals(propertyCount, e.getPropertyViolations().size());
Assert.assertEquals(classCount, e.getClassViolations().size());
Assert.assertEquals(parameterCount, e.getParameterViolations().size());
Assert.assertEquals(returnValueCount, e.getReturnValueViolations().size());
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- JBoss, Home of Professional Open Source Copyright 2012, Red Hat, Inc.
and/or its affiliates, and individual contributors by the @authors tag. See
the copyright.txt in the distribution for a full listing of individual contributors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature -->
<defaultProtocol type="Servlet 3.0" />
<engine>
<property name="deploymentExportPath">target/deployments</property>
</engine>
<container qualifier="jetty" default="true">
<configuration>
<property name="bindHttpPort">0</property>
<!--property name="javaVmArguments">-Xdebug -Xrunjdwp:transport=dt_socket,address=8585,server=y, suspend=y</property-->
</configuration>
</container>
</arquillian>
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs-all</artifactId>
<version>3.0.26.Final</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>RESTEASY-736-jetty</artifactId>
<packaging>jar</packaging>
<name>RESTEASY-736-jetty</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-jetty-embedded-9</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<!--scope>test</scope-->
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.1_spec</artifactId>
</dependency>
</dependencies>
</project>
package org.jboss.resteasy.test.resteasy736;
import static org.junit.Assert.assertTrue;
import java.net.URI;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.core.Response;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.resteasy736.TestApplication;
import org.jboss.resteasy.resteasy736.TestResource;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* @author <a href="ron.sigal@jboss.com">Ron Sigal</a>
* @version $Revision: 1.1 $
* <p>
* Copyright Aug 3, 2012
*/
@RunWith(Arquillian.class)
@RunAsClient
public class AsyncTimeoutTest {
@Deployment
public static Archive<?> createTestArchive() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "RESTEASY-736.war")
.addClasses(TestApplication.class, TestResource.class)
.addClasses(AsyncTimeoutTest.class)
.addAsWebInfResource("web.xml");
return war;
}
@ArquillianResource
URI url;
@Test
public void testAsynchTimeout() throws Exception {
System.out.println("url = " + url);
Builder request = ResteasyClientBuilder.newClient().target(url.toString() + "test/").request();
long start = System.currentTimeMillis();
System.out.println("start: " + start);
Response response = null;
try {
response = request.get();
} catch (Exception e) {
System.out.println(e);
} finally {
System.out.println("finish: " + System.currentTimeMillis());
long elapsed = System.currentTimeMillis() - start;
System.out.println("elapsed: " + elapsed + " ms");
;
System.out.println("status: " + response.getStatus());
assertTrue(response != null);
System.out.println("response: " + response.readEntity(String.class));
Assert.assertEquals("Status is wrong", 503, response.getStatus());
assertTrue(elapsed < 10000);
}
}
@Ignore
@Test
public void testDefaultAsynchTimeout() throws Exception {
Builder request = ResteasyClientBuilder.newClient().target(url.toString() + "default/").request();
long start = System.currentTimeMillis();
System.out.println("start: " + start);
Response response = null;
try {
response = request.get();
} catch (Exception e) {
System.out.println(e);
} finally {
System.out.println("finish: " + System.currentTimeMillis());
long elapsed = System.currentTimeMillis() - start;
System.out.println("elapsed: " + elapsed + " ms");
System.out.println("status: " + response.getStatus());
assertTrue(response != null);
System.out.println("response: " + response.readEntity(String.class));
Assert.assertEquals("Wrong response", 503, response.getStatus());
Assert.assertTrue("Should timeout", elapsed < 36000); // Jetty async timeout defaults to 30000.
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- JBoss, Home of Professional Open Source Copyright 2012, Red Hat, Inc.
and/or its affiliates, and individual contributors by the @authors tag. See
the copyright.txt in the distribution for a full listing of individual contributors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature -->
<defaultProtocol type="Servlet 3.0"/>
<engine>
<property name="deploymentExportPath">target/deployments</property>
</engine>
<container qualifier="jetty" default="true">
<configuration>
<property name="bindHttpPort">0</property>
</configuration>
</container>
</arquillian>