You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2011/10/18 21:46:55 UTC
svn commit: r1185819 - in /openejb/trunk/openejb/server:
openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBRuntimeDelegateImpl.java
openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
Author: rmannibucau
Date: Tue Oct 18 19:46:55 2011
New Revision: 1185819
URL: http://svn.apache.org/viewvc?rev=1185819&view=rev
Log:
weird behavior needed by TCK but it seems UriBuilder.fromPath(null) is forbidden and UriBuilder.fromPath(foo).replacePath(null) is allowed
Modified:
openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBRuntimeDelegateImpl.java
openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
Modified: openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBRuntimeDelegateImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBRuntimeDelegateImpl.java?rev=1185819&r1=1185818&r2=1185819&view=diff
==============================================================================
--- openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBRuntimeDelegateImpl.java (original)
+++ openejb/trunk/openejb/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBRuntimeDelegateImpl.java Tue Oct 18 19:46:55 2011
@@ -25,12 +25,16 @@ public class OpenEJBRuntimeDelegateImpl
private static class OpenEJBUriBuilderImpl extends UriBuilderImpl {
private static final String[][] PREFIX = new String[][]{ { "http:/", "http://" }, { "https:/", "https://" } };
+ private boolean init = false;
- @Override public UriBuilder replacePath(String path) {
- if (path == null) {
- throw new IllegalArgumentException("path is null");
+ @Override public UriBuilder replacePath(String value) {
+ // UriBuilder.fromPath("foo").replacePath(null) is ok
+ // but not UriBuilder.fromPath(null)
+ if (value == null && !init) {
+ throw new IllegalArgumentException("value is null");
}
- return super.replacePath(path);
+ init = true;
+ return super.replacePath(value);
}
@Override public URI build(Object... values) throws IllegalArgumentException, UriBuilderException {
Modified: openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java?rev=1185819&r1=1185818&r2=1185819&view=diff
==============================================================================
--- openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java (original)
+++ openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java Tue Oct 18 19:46:55 2011
@@ -108,7 +108,6 @@ public abstract class RESTService implem
for (String clazz : webApp.restClass) {
if (restEjbs.containsKey(clazz)) {
deployEJB(webApp.contextRoot, restEjbs.get(clazz).context);
- LOGGER.info("REST EJB deployed: " + clazz);
} else {
try {
Class<?> loadedClazz = classLoader.loadClass(clazz);
@@ -116,7 +115,6 @@ public abstract class RESTService implem
} catch (ClassNotFoundException e) {
throw new OpenEJBRestRuntimeException("can't find class " + clazz, e);
}
- LOGGER.info("REST service deployed: " + clazz);
}
}
} else {
@@ -153,19 +151,15 @@ public abstract class RESTService implem
if (restEjbs.containsKey(o.getClass().getName())) {
// no more a singleton if the ejb i not a singleton...but it is a weird case
deployEJB(appPrefix, restEjbs.get(o.getClass().getName()).context);
- LOGGER.info("deployed REST EJB: " + o);
} else {
deploySingleton(appPrefix, o, appInstance, classLoader);
- LOGGER.info("deployed REST singleton: " + o);
}
}
for (Class<?> clazz : appInstance.getClasses()) {
if (restEjbs.containsKey(clazz.getName())) {
deployEJB(appPrefix, restEjbs.get(clazz.getName()).context);
- LOGGER.info("deployed REST EJB: " + clazz);
} else {
deployPojo(appPrefix, clazz, appInstance, classLoader, injections, context);
- LOGGER.info("deployed REST class: " + clazz);
}
}
@@ -232,15 +226,23 @@ public abstract class RESTService implem
services.add(address);
listener.deploySingleton(getFullContext(address, contextRoot), o, appInstance);
+
+ LOGGER.info("deployed REST singleton: " + o);
}
private void deployPojo(String contextRoot, Class<?> loadedClazz, Application app, ClassLoader classLoader, Collection<Injection> injections, Context context) {
+ if (loadedClazz.isInterface()) {
+ return;
+ }
+
final String nopath = getAddress(contextRoot, loadedClazz) + "/.*";
final RsHttpListener listener = createHttpListener();
final String address = rsRegistry.createRsHttpListener(listener, classLoader, nopath.substring(NOPATH_PREFIX.length() - 1), virtualHost);
services.add(address);
listener.deployPojo(getFullContext(address, contextRoot), loadedClazz, app, injections, context);
+
+ LOGGER.info("deployed POJO class: " + loadedClazz.getName());
}
private void deployEJB(String context, BeanContext beanContext) {
@@ -250,6 +252,8 @@ public abstract class RESTService implem
services.add(address);
listener.deployEJB(getFullContext(address, context), beanContext);
+
+ LOGGER.info("REST EJB deployed: " + beanContext.getBeanClass().getName());
}
/**