Skip to content

Commit

Permalink
AS7-6199 Resteasy 2.3.5.Final
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas authored and kabir committed Jan 9, 2013
1 parent 55b23cf commit f49c628
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
5 changes: 4 additions & 1 deletion jaxrs/src/main/java/org/jboss/as/jaxrs/JaxrsMessages.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package org.jboss.as.jaxrs;

import java.util.List;

import javax.ws.rs.core.Application;

import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
Expand Down Expand Up @@ -82,12 +84,13 @@ public interface JaxrsMessages {
/**
* JAX-RS resource @Path annotation is on a class or interface that is not a view
*
*
* @param type The class with the annotation
* @param ejbName The ejb
* @return
*/
@Message(id = 11234, value = "JAX-RS resource %s does not correspond to a view on the EJB %s. @Path annotations can only be placed on classes or interfaces that represent a local, remote or no-interface view of an EJB.")
DeploymentUnitProcessingException typeNameNotAnEjbView(String type, String ejbName);
DeploymentUnitProcessingException typeNameNotAnEjbView(List<Class> type, String ejbName);

@Message(id = 11235, value = "Invalid value for parameter %s: %s")
DeploymentUnitProcessingException invalidParamValue(String param, String value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package org.jboss.as.jaxrs.deployment;

import java.util.Arrays;

import org.jboss.as.ee.component.Attachments;
import org.jboss.as.ee.component.ComponentDescription;
import org.jboss.as.ee.component.EEModuleDescription;
Expand Down Expand Up @@ -79,24 +81,30 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
if (!GetRestful.isRootResource(componentClass)) continue;

if (component instanceof SessionBeanComponentDescription) {
Class jaxrsType = GetRestful.getSubResourceClass(componentClass);
Class[] jaxrsType = GetRestful.getSubResourceClass(componentClass);
final String jndiName;
if (component.getViews().size() == 1) {
//only 1 view, just use the simple JNDI name
jndiName = "java:app/" + moduleDescription.getModuleName() + "/" + componentClass.getSimpleName();
} else {
final String jaxRsTypeName = jaxrsType.getName();
boolean found = false;
String foundType = null;
for (final ViewDescription view : component.getViews()) {
if (view.getViewClassName().equals(jaxRsTypeName)) {
found = true;
for(Class subResource : jaxrsType) {
if (view.getViewClassName().equals(subResource.getName())) {
foundType = subResource.getName();
found = true;
break;
}
}
if(found) {
break;
}
}
if (!found) {
throw JaxrsMessages.MESSAGES.typeNameNotAnEjbView(jaxRsTypeName, component.getComponentName());
throw JaxrsMessages.MESSAGES.typeNameNotAnEjbView(Arrays.asList(jaxrsType), component.getComponentName());
}
jndiName = "java:app/" + moduleDescription.getModuleName() + "/" + componentClass.getSimpleName() + "!" + jaxRsTypeName;
jndiName = "java:app/" + moduleDescription.getModuleName() + "/" + componentClass.getSimpleName() + "!" + foundType;
}

JAXRS_LOGGER.debugf("Found JAX-RS Managed Bean: %s local jndi jaxRsTypeName: %s", component.getComponentClassName(), jndiName);
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
<version.org.jboss.remote-naming>1.0.5.Final</version.org.jboss.remote-naming>
<version.org.jboss.remoting3>3.2.14.GA</version.org.jboss.remoting3>
<version.org.jboss.remotingjmx.remoting-jmx>1.1.0.Beta1</version.org.jboss.remotingjmx.remoting-jmx>
<version.org.jboss.resteasy>2.3.4.Final</version.org.jboss.resteasy>
<version.org.jboss.resteasy>2.3.5.Final</version.org.jboss.resteasy>
<version.org.jboss.sasl>1.0.3.Final</version.org.jboss.sasl>
<version.org.jboss.seam.int>6.0.0.GA</version.org.jboss.seam.int>
<version.org.jboss.security.jboss-negotiation>2.2.2.Final</version.org.jboss.security.jboss-negotiation>
Expand Down Expand Up @@ -944,7 +944,7 @@
<artifactId>jboss-as-core-model-test-controller-7.1.2</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ee</artifactId>
Expand Down

0 comments on commit f49c628

Please sign in to comment.