You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2014/07/17 09:53:05 UTC
svn commit: r1611274 [11/15] - in /tomee/tomee/branches/tomee-1.7.x/server:
./ openejb-activemq/
openejb-activemq/src/main/java/org/apache/openejb/server/activemq/
openejb-axis/ openejb-axis/src/main/java/org/apache/openejb/server/axis/
openejb-axis/sr...
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/PropertiesPropogationTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/PropertiesPropogationTest.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/PropertiesPropogationTest.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/PropertiesPropogationTest.java Thu Jul 17 07:52:58 2014
@@ -48,34 +48,34 @@ import java.util.Properties;
public class PropertiesPropogationTest extends TestCase {
public void test() throws Exception {
- EjbServer ejbServer = new EjbServer();
+ final EjbServer ejbServer = new EjbServer();
- Properties initProps = new Properties();
+ final Properties initProps = new Properties();
initProps.setProperty("openejb.deployments.classpath.include", "");
initProps.setProperty("openejb.deployments.classpath.filter.descriptors", "true");
OpenEJB.init(initProps, new ServerFederation());
ejbServer.init(new Properties());
- ServicePool pool = new ServicePool(ejbServer, 10);
- ServiceDaemon serviceDaemon = new ServiceDaemon(pool, 0, "localhost");
+ final ServicePool pool = new ServicePool(ejbServer, 10);
+ final ServiceDaemon serviceDaemon = new ServiceDaemon(pool, 0, "localhost");
serviceDaemon.start();
- int port = serviceDaemon.getPort();
+ final int port = serviceDaemon.getPort();
- Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
- ConfigurationFactory config = new ConfigurationFactory();
+ final Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
+ final ConfigurationFactory config = new ConfigurationFactory();
- EjbModule ejbModule = new EjbModule(new EjbJar(), new OpenejbJar());
- EjbJar ejbJar = ejbModule.getEjbJar();
- OpenejbJar openejbJar = ejbModule.getOpenejbJar();
+ final EjbModule ejbModule = new EjbModule(new EjbJar(), new OpenejbJar());
+ final EjbJar ejbJar = ejbModule.getEjbJar();
+ final OpenejbJar openejbJar = ejbModule.getOpenejbJar();
- StatelessBean statelessBean = ejbJar.addEnterpriseBean(new StatelessBean(WidgetBean.class));
- EjbDeployment deployment = openejbJar.addEjbDeployment(statelessBean);
+ final StatelessBean statelessBean = ejbJar.addEnterpriseBean(new StatelessBean(WidgetBean.class));
+ final EjbDeployment deployment = openejbJar.addEjbDeployment(statelessBean);
deployment.getProperties().put("color", "orange");
deployment.getProperties().put("openejb.client.color", "red");
- EjbJarInfo ejbJarInfo = config.configureApplication(ejbModule);
- EnterpriseBeanInfo beanInfo = ejbJarInfo.enterpriseBeans.get(0);
+ final EjbJarInfo ejbJarInfo = config.configureApplication(ejbModule);
+ final EnterpriseBeanInfo beanInfo = ejbJarInfo.enterpriseBeans.get(0);
assertTrue(beanInfo.properties.containsKey("color"));
assertTrue(beanInfo.properties.containsKey("openejb.client.color"));
@@ -84,8 +84,8 @@ public class PropertiesPropogationTest e
assembler.createApplication(ejbJarInfo);
- ContainerSystem cs = SystemInstance.get().getComponent(ContainerSystem.class);
- BeanContext info = cs.getBeanContext("WidgetBean");
+ final ContainerSystem cs = SystemInstance.get().getComponent(ContainerSystem.class);
+ final BeanContext info = cs.getBeanContext("WidgetBean");
assertNotNull(info);
assertTrue(info.getProperties().containsKey("color"));
@@ -94,18 +94,18 @@ public class PropertiesPropogationTest e
assertEquals("orange", info.getProperties().get("color"));
assertEquals("red", info.getProperties().get("openejb.client.color"));
- Properties props = new Properties();
+ final Properties props = new Properties();
props.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
props.put("java.naming.provider.url", "ejbd://127.0.0.1:" + port);
- Context context = new InitialContext(props);
+ final Context context = new InitialContext(props);
- Widget remote = (Widget) context.lookup("WidgetBeanRemote");
+ final Widget remote = (Widget) context.lookup("WidgetBeanRemote");
- InvocationHandler handler = ProxyManager.getInvocationHandler(remote);
+ final InvocationHandler handler = ProxyManager.getInvocationHandler(remote);
- EJBObjectHandler objectHandler = EJBObjectHandler.class.cast(handler);
+ final EJBObjectHandler objectHandler = EJBObjectHandler.class.cast(handler);
- Properties properties = objectHandler.getEjb().getProperties();
+ final Properties properties = objectHandler.getEjb().getProperties();
// Should only contain "openejb.client.*" properties
assertFalse(properties.containsKey("color"));
@@ -123,7 +123,7 @@ public class PropertiesPropogationTest e
public static class WidgetBean implements Widget {
- public Object echo(Object o) {
+ public Object echo(final Object o) {
return o;
}
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/StaticFailoverTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/StaticFailoverTest.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/StaticFailoverTest.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/StaticFailoverTest.java Thu Jul 17 07:52:58 2014
@@ -63,24 +63,24 @@ public class StaticFailoverTest extends
public void testStatelessBeanTimeout() throws Exception {
- Properties initProps = new Properties();
+ final Properties initProps = new Properties();
initProps.setProperty("openejb.deployments.classpath.include", "");
initProps.setProperty("openejb.deployments.classpath.filter.descriptors", "true");
OpenEJB.init(initProps, new ServerFederation());
System.setProperty(org.apache.openejb.client.SocketConnectionFactory.PROPERTY_POOL_SIZE, "" + 20);
- EjbServer ejbServer = new EjbServer();
+ final EjbServer ejbServer = new EjbServer();
ejbServer.init(new Properties());
daemons.add(createServiceDaemon(20, ejbServer, red));
daemons.add(createServiceDaemon(20, ejbServer, blue));
- ConfigurationFactory config = new ConfigurationFactory();
- Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
+ final ConfigurationFactory config = new ConfigurationFactory();
+ final Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
// containers
- StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class);
+ final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class);
statelessContainerInfo.properties.setProperty("TimeOut", "100");
statelessContainerInfo.properties.setProperty("PoolSize", "" + 10);
statelessContainerInfo.properties.setProperty("MinSize", "2");
@@ -89,13 +89,13 @@ public class StaticFailoverTest extends
// Setup the descriptor information
- StatelessBean bean = new StatelessBean(CounterBean.class);
+ final StatelessBean bean = new StatelessBean(CounterBean.class);
bean.addBusinessLocal(Counter.class.getName());
bean.addBusinessRemote(RemoteCounter.class.getName());
bean.addPostConstruct("init");
bean.addPreDestroy("destroy");
- EjbJar ejbJar = new EjbJar();
+ final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(bean);
CounterBean.instances.set(0);
@@ -105,10 +105,10 @@ public class StaticFailoverTest extends
failoverURI += "ejbd://127.0.0.1:" + daemons.get(0).getPort() + "?red,";
failoverURI += "ejbd://127.0.0.1:" + daemons.get(1).getPort() + "?blue";
- Properties props = new Properties();
+ final Properties props = new Properties();
props.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
props.put("java.naming.provider.url", failoverURI);
- Context context = new InitialContext(props);
+ final Context context = new InitialContext(props);
counter = (Counter) context.lookup("CounterBeanRemote");
System.out.println(counter.hit());
@@ -127,7 +127,7 @@ public class StaticFailoverTest extends
protected void tearDown() throws Exception {
super.tearDown();
- for (ServiceDaemon daemon : daemons) {
+ for (final ServiceDaemon daemon : daemons) {
daemon.stop();
}
@@ -136,11 +136,11 @@ public class StaticFailoverTest extends
private final List<ServiceDaemon> daemons = new ArrayList<ServiceDaemon>();
- private ServiceDaemon createServiceDaemon(int poolSize, EjbServer ejbServer, URI uri) throws ServiceException {
- ServiceIdentifier serviceIdentifier = new ServiceIdentifier(ejbServer, uri);
- KeepAliveServer keepAliveServer = new KeepAliveServer(serviceIdentifier);
- ServicePool pool = new ServicePool(keepAliveServer, poolSize);
- ServiceDaemon daemon = new ServiceDaemon(pool, 0, "localhost");
+ private ServiceDaemon createServiceDaemon(final int poolSize, final EjbServer ejbServer, final URI uri) throws ServiceException {
+ final ServiceIdentifier serviceIdentifier = new ServiceIdentifier(ejbServer, uri);
+ final KeepAliveServer keepAliveServer = new KeepAliveServer(serviceIdentifier);
+ final ServicePool pool = new ServicePool(keepAliveServer, poolSize);
+ final ServiceDaemon daemon = new ServiceDaemon(pool, 0, "localhost");
daemon.start();
return daemon;
}
@@ -151,13 +151,13 @@ public class StaticFailoverTest extends
private final URI me;
- public ServiceIdentifier(ServerService service, URI me) {
+ public ServiceIdentifier(final ServerService service, final URI me) {
super(service);
this.me = me;
}
@Override
- public void service(InputStream in, OutputStream out) throws ServiceException, IOException {
+ public void service(final InputStream in, final OutputStream out) throws ServiceException, IOException {
synchronized (hits) {
hits.add(me);
}
@@ -172,7 +172,7 @@ public class StaticFailoverTest extends
public static Object lock = new Object[]{};
- private static void comment(String x) {
+ private static void comment(final String x) {
// synchronized(lock){
// System.out.println(x);
// System.out.flush();
@@ -207,13 +207,13 @@ public class StaticFailoverTest extends
}
public URI hit() {
- URI uri = host.get();
+ final URI uri = host.get();
if (hold.contains(uri)) {
try {
paused.countDown();
resume.await();
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
Thread.interrupted();
}
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java Thu Jul 17 07:52:58 2014
@@ -63,8 +63,8 @@ public class ZEjbdTest {
for (final ServerService daemon : SimpleServiceManager.class.cast(ServiceManager.get()).getDaemons()) {
if (ServiceDaemon.class.isInstance(daemon) && daemon.getName().equals("ejbd")) {
assertTrue(EjbDaemon.class.cast(Reflections.get(Reflections.get(Reflections.get(Reflections.get(Reflections.get(Reflections.get(Reflections.get(daemon, "next"),
- "service"), "service"), "service"),
- "service"), "service"), "server")).isGzip());
+ "service"), "service"), "service"),
+ "service"), "service"), "server")).isGzip());
checked++;
}
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/cdi/api/Hessian.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/cdi/api/Hessian.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/cdi/api/Hessian.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/cdi/api/Hessian.java Thu Jul 17 07:52:58 2014
@@ -27,6 +27,8 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
public @interface Hessian {
String path() default "";
+
boolean sendCollectionType() default true;
+
Class<?> serializerFactory() default Object.class;
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/cdi/internal/HessianExtension.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/cdi/internal/HessianExtension.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/cdi/internal/HessianExtension.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/cdi/internal/HessianExtension.java Thu Jul 17 07:52:58 2014
@@ -116,9 +116,9 @@ public class HessianExtension implements
final String appName = findAppName(bm);
try {
LOGGER.info("Hessian(url=" + registry.deploy(deployment.itf.getClassLoader(), server,
- service.getVirtualHost(), appName,
- service.getAuthMethod(), service.getTransportGuarantee(),
- service.getRealmName(), name) + ", interface=" + name + ")");
+ service.getVirtualHost(), appName,
+ service.getAuthMethod(), service.getTransportGuarantee(),
+ service.getRealmName(), name) + ", interface=" + name + ")");
deployed.add(new DeployedEndpoint(appName, name));
} catch (final URISyntaxException e) {
throw new OpenEJBRuntimeException(e);
@@ -135,7 +135,7 @@ public class HessianExtension implements
for (final AppContext app : SystemInstance.get().getComponent(ContainerSystem.class).getAppContexts()) {
for (final WebContext webContext : app.getWebContexts()) {
if (isSameContext(bm, webContext.getWebBeansContext())) {
- String contextRoot = webContext.getContextRoot();
+ final String contextRoot = webContext.getContextRoot();
if (contextRoot != null) {
if (contextRoot.startsWith("/")) {
return contextRoot.substring(1);
@@ -152,9 +152,9 @@ public class HessianExtension implements
throw new IllegalArgumentException("Can't find application matching bean manager " + bm);
}
- private static boolean isSameContext(final BeanManager bm, WebBeansContext app) {
+ private static boolean isSameContext(final BeanManager bm, final WebBeansContext app) {
return InjectableBeanManager.class.isInstance(bm) && app == InjectableBeanManager.class.cast(bm).getWebBeansContext()
- || BeanManagerImpl.class.isInstance(bm) && app == BeanManagerImpl.class.cast(bm).getWebBeansContext();
+ || BeanManagerImpl.class.isInstance(bm) && app == BeanManagerImpl.class.cast(bm).getWebBeansContext();
}
protected void shutdown(final @Observes BeforeShutdown unused) {
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/client/hessian/HessianInitialContextFactory.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/client/hessian/HessianInitialContextFactory.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/client/hessian/HessianInitialContextFactory.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/client/hessian/HessianInitialContextFactory.java Thu Jul 17 07:52:58 2014
@@ -113,8 +113,8 @@ public class HessianInitialContextFactor
try {
final Object clientFactory = factoryConstructor.newInstance(loader);
final Object factory = serializerConstructor.newInstance(loader);
- Reflections.invokeByReflection(factory, "setAllowNonSerializable", BOOLEAN_PARAM, new Object[] { allowNonSerializable});
- Reflections.invokeByReflection(clientFactory, "setSerializerFactory", new Class<?>[]{ serializerConstructor.getDeclaringClass() }, new Object[]{factory});
+ Reflections.invokeByReflection(factory, "setAllowNonSerializable", BOOLEAN_PARAM, new Object[]{allowNonSerializable});
+ Reflections.invokeByReflection(clientFactory, "setSerializerFactory", new Class<?>[]{serializerConstructor.getDeclaringClass()}, new Object[]{factory});
if (user != null) {
Reflections.invokeByReflection(clientFactory, "setUser", STRING_PARAM, new Object[]{user});
Reflections.invokeByReflection(clientFactory, "setPassword", STRING_PARAM, new Object[]{password});
@@ -127,7 +127,7 @@ public class HessianInitialContextFactor
final String completeUrl = url + name;
try {
if (api != null) { // just use it
- return Reflections.invokeByReflection(clientFactory, "create", CREATE_PARAM, new Object[] { api, completeUrl, loader });
+ return Reflections.invokeByReflection(clientFactory, "create", CREATE_PARAM, new Object[]{api, completeUrl, loader});
}
return Reflections.invokeByReflection(clientFactory, "create", STRING_PARAM, new Object[]{completeUrl});
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianRegistryImpl.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianRegistryImpl.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianRegistryImpl.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianRegistryImpl.java Thu Jul 17 07:52:58 2014
@@ -36,7 +36,7 @@ public class HessianRegistryImpl extends
}
@Override
- public void undeploy(String host, String app, String name) {
+ public void undeploy(final String host, final String app, final String name) {
SystemInstance.get().getComponent(HttpListenerRegistry.class).removeHttpListener(generateEndpointName(app, name));
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianServer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianServer.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianServer.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianServer.java Thu Jul 17 07:52:58 2014
@@ -30,8 +30,8 @@ import java.util.logging.Logger;
public class HessianServer {
public static final String CONTENT_TYPE_HESSIAN = "application/x-hessian";
- private static final Class<?>[] BOOLEAN_PARAM = new Class<?>[]{ boolean.class };
- private static final Object[] TRUE_PARAM = new Object[]{ true };
+ private static final Class<?>[] BOOLEAN_PARAM = new Class<?>[]{boolean.class};
+ private static final Object[] TRUE_PARAM = new Object[]{true};
private final ClassLoader loader;
private final Class<?> serializerFactoryClass;
@@ -58,11 +58,11 @@ public class HessianServer {
}
public HessianServer sendCollectionType(final boolean sendCollectionType) {
- Reflections.invokeByReflection(serializerFactory, "setSendCollectionType", BOOLEAN_PARAM, new Object[]{ sendCollectionType });
+ Reflections.invokeByReflection(serializerFactory, "setSendCollectionType", BOOLEAN_PARAM, new Object[]{sendCollectionType});
return this;
}
- public HessianServer debug(boolean debug) {
+ public HessianServer debug(final boolean debug) {
this.debugLogger = (debug ? Logger.getLogger("OpenEJB.hessian.DEBUG") : null);
return this;
}
@@ -97,12 +97,12 @@ public class HessianServer {
isToUse.mark(1);
}
- int code = isToUse.read();
- int major;
- int minor;
+ final int code = isToUse.read();
+ final int major;
+ final int minor;
- Object in;
- Object out;
+ final Object in;
+ final Object out;
if (code == 'H' || code == 'C') { // Hessian 2.0 stream
major = isToUse.read();
@@ -126,11 +126,11 @@ public class HessianServer {
throw new IOException("Expected 'H'/'C' (Hessian 2.0) or 'c' (Hessian 1.0) in hessian input at " + code);
}
- Reflections.invokeByReflection(in, "setSerializerFactory", new Class<?>[] { serializerFactoryClass }, new Object[] { serializerFactory });
- Reflections.invokeByReflection(out, "setSerializerFactory", new Class<?>[] { serializerFactoryClass }, new Object[] { serializerFactory });
+ Reflections.invokeByReflection(in, "setSerializerFactory", new Class<?>[]{serializerFactoryClass}, new Object[]{serializerFactory});
+ Reflections.invokeByReflection(out, "setSerializerFactory", new Class<?>[]{serializerFactoryClass}, new Object[]{serializerFactory});
try {
- Reflections.invokeByReflection(skeleton, "invoke", new Class<?>[] { loader.loadClass("com.caucho.hessian.io.AbstractHessianInput"), loader.loadClass("com.caucho.hessian.io.AbstractHessianOutput") }, new Object[] { in, out });
+ Reflections.invokeByReflection(skeleton, "invoke", new Class<?>[]{loader.loadClass("com.caucho.hessian.io.AbstractHessianInput"), loader.loadClass("com.caucho.hessian.io.AbstractHessianOutput")}, new Object[]{in, out});
} finally {
try {
Reflections.invokeByReflection(in, "close", new Class<?>[0], null);
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianService.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianService.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianService.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianService.java Thu Jul 17 07:52:58 2014
@@ -92,7 +92,7 @@ public class HessianService implements S
server.sendCollectionType(sendCollectionType);
}
- server.createSkeleton(ProxyEJB.simpleProxy(beanContext, new Class<?>[]{ remoteItf }), remoteItf);
+ server.createSkeleton(ProxyEJB.simpleProxy(beanContext, new Class<?>[]{remoteItf}), remoteItf);
try {
LOGGER.info("Hessian(url=" + registry.deploy(classLoader, server, virtualHost, appName(app, beanContext), authMethod, transportGuarantee, realmName, String.class.cast(beanContext.getDeploymentID())) + ", interface=" + remoteItf.getName() + ")");
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/TomcatHessianRegistry.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/TomcatHessianRegistry.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/TomcatHessianRegistry.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/TomcatHessianRegistry.java Thu Jul 17 07:52:58 2014
@@ -221,13 +221,13 @@ public class TomcatHessianRegistry imple
return context;
}
- private static String generateServletPath(String name) {
+ private static String generateServletPath(final String name) {
return HESSIAN + name;
}
private static String contextName(final String app) {
if (!app.startsWith("/") && !app.isEmpty()) {
- return "/" + app;
+ return "/" + app;
}
return app;
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianCdiByConfigTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianCdiByConfigTest.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianCdiByConfigTest.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianCdiByConfigTest.java Thu Jul 17 07:52:58 2014
@@ -36,7 +36,7 @@ import static org.hamcrest.CoreMatchers.
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-@EnableServices({ "hessian", "httpejbd" })
+@EnableServices({"hessian", "httpejbd"})
@RunWith(ApplicationComposer.class)
public class HessianCdiByConfigTest {
@Module
@@ -79,7 +79,7 @@ public class HessianCdiByConfigTest {
public static class In {
private String value;
- public In(String value) {
+ public In(final String value) {
this.value = value;
}
}
@@ -87,7 +87,7 @@ public class HessianCdiByConfigTest {
public static class Out {
private String value;
- public Out(String value) {
+ public Out(final String value) {
this.value = value;
}
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianCdiTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianCdiTest.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianCdiTest.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianCdiTest.java Thu Jul 17 07:52:58 2014
@@ -37,11 +37,11 @@ import static org.junit.Assert.assertEqu
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
-@EnableServices({ "hessian", "httpejbd" })
+@EnableServices({"hessian", "httpejbd"})
@RunWith(ApplicationComposer.class)
public class HessianCdiTest {
@Module
- @Classes(cdi = true, value = { MyCdiHessianService.class, CdiBean.class })
+ @Classes(cdi = true, value = {MyCdiHessianService.class, CdiBean.class})
public WebApp webApp() {
return new WebApp().contextRoot("web");
}
@@ -80,7 +80,7 @@ public class HessianCdiTest {
public static class In {
private String value;
- public In(String value) {
+ public In(final String value) {
this.value = value;
}
}
@@ -88,7 +88,7 @@ public class HessianCdiTest {
public static class Out {
private String value;
- public Out(String value) {
+ public Out(final String value) {
this.value = value;
}
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianInitialContextTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianInitialContextTest.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianInitialContextTest.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianInitialContextTest.java Thu Jul 17 07:52:58 2014
@@ -33,22 +33,22 @@ import static org.hamcrest.CoreMatchers.
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-@EnableServices({ "hessian", "httpejbd" })
+@EnableServices({"hessian", "httpejbd"})
@RunWith(ApplicationComposer.class)
public class HessianInitialContextTest {
@Module
public Class<?>[] classes() {
- return new Class<?>[] { Server.class };
+ return new Class<?>[]{Server.class};
}
@Test
public void client() throws Exception {
final MyApi client = MyApi.class.cast(
- new InitialContext(new PropertiesBuilder()
- .p(Context.INITIAL_CONTEXT_FACTORY, HessianInitialContextFactory.class.getName())
- .p(Context.PROVIDER_URL, "http://127.0.0.1:4204/HessianInitialContextTest/hessian/")
- .build())
- .lookup("Server"));
+ new InitialContext(new PropertiesBuilder()
+ .p(Context.INITIAL_CONTEXT_FACTORY, HessianInitialContextFactory.class.getName())
+ .p(Context.PROVIDER_URL, "http://127.0.0.1:4204/HessianInitialContextTest/hessian/")
+ .build())
+ .lookup("Server"));
final Out out = client.call(new In("test"));
assertThat(out, instanceOf(Out.class));
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianServiceTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianServiceTest.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianServiceTest.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianServiceTest.java Thu Jul 17 07:52:58 2014
@@ -32,12 +32,12 @@ import static org.hamcrest.CoreMatchers.
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-@EnableServices({ "hessian", "httpejbd" })
+@EnableServices({"hessian", "httpejbd"})
@RunWith(ApplicationComposer.class)
public class HessianServiceTest {
@Module
public Class<?>[] classes() {
- return new Class<?>[] { MyHessianWebService.class };
+ return new Class<?>[]{MyHessianWebService.class};
}
@Test
@@ -56,7 +56,7 @@ public class HessianServiceTest {
@Remote
public static interface HessianWebService {
- Out call(In in);
+ Out call(In in);
}
@Singleton
@@ -70,7 +70,7 @@ public class HessianServiceTest {
public static class In {
private String value;
- public In(String value) {
+ public In(final String value) {
this.value = value;
}
}
@@ -78,7 +78,7 @@ public class HessianServiceTest {
public static class Out {
private String value;
- public Out(String value) {
+ public Out(final String value) {
this.value = value;
}
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/pom.xml?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/pom.xml (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/pom.xml Thu Jul 17 07:52:58 2014
@@ -20,7 +20,8 @@
<!-- $Rev$ $Date$ -->
-<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">
+<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">
<parent>
<artifactId>server</artifactId>
<groupId>org.apache.openejb</groupId>
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/src/main/java/org/apache/openejb/server/hsql/HsqlPrintWriter.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/src/main/java/org/apache/openejb/server/hsql/HsqlPrintWriter.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/src/main/java/org/apache/openejb/server/hsql/HsqlPrintWriter.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/src/main/java/org/apache/openejb/server/hsql/HsqlPrintWriter.java Thu Jul 17 07:52:58 2014
@@ -22,23 +22,25 @@ import org.apache.openejb.util.LogCatego
import org.apache.openejb.util.Logger;
public class HsqlPrintWriter extends PrintWriter {
- private Logger logger;
- private boolean errorWriter;
- private StringBuffer text = new StringBuffer("");
- public HsqlPrintWriter(boolean errorWriter){
- super(System.err);
- logger = Logger.getInstance(LogCategory.OPENEJB_HSQL,HsqlPrintWriter.class);
- this.errorWriter = errorWriter;
- }
+ private Logger logger;
+ private boolean errorWriter;
+ private StringBuffer text = new StringBuffer("");
+
+ public HsqlPrintWriter(final boolean errorWriter) {
+ super(System.err);
+ logger = Logger.getInstance(LogCategory.OPENEJB_HSQL, HsqlPrintWriter.class);
+ this.errorWriter = errorWriter;
+ }
+
public void close() {
flush();
}
private void flushLine() {
- if(!errorWriter)
- logger.info(text.toString());
+ if (!errorWriter)
+ logger.info(text.toString());
else
- logger.error(text.toString());
+ logger.error(text.toString());
text.setLength(0);
}
@@ -48,39 +50,39 @@ public class HsqlPrintWriter extends Pri
}
}
- public void print(boolean b) {
+ public void print(final boolean b) {
text.append(b);
}
- public void print(char c) {
+ public void print(final char c) {
text.append(c);
}
- public void print(char[] s) {
+ public void print(final char[] s) {
text.append(s);
}
- public void print(double d) {
+ public void print(final double d) {
text.append(d);
}
- public void print(float f) {
+ public void print(final float f) {
text.append(f);
}
- public void print(int i) {
+ public void print(final int i) {
text.append(i);
}
- public void print(long l) {
+ public void print(final long l) {
text.append(l);
}
- public void print(Object obj) {
+ public void print(final Object obj) {
text.append(obj);
}
- public void print(String s) {
+ public void print(final String s) {
text.append(s);
}
@@ -90,47 +92,47 @@ public class HsqlPrintWriter extends Pri
}
}
- public void println(boolean x) {
+ public void println(final boolean x) {
text.append(x);
flushLine();
}
- public void println(char x) {
+ public void println(final char x) {
text.append(x);
flushLine();
}
- public void println(char[] x) {
+ public void println(final char[] x) {
text.append(x);
flushLine();
}
- public void println(double x) {
+ public void println(final double x) {
text.append(x);
flushLine();
}
- public void println(float x) {
+ public void println(final float x) {
text.append(x);
flushLine();
}
- public void println(int x) {
+ public void println(final int x) {
text.append(x);
flushLine();
}
- public void println(long x) {
+ public void println(final long x) {
text.append(x);
flushLine();
}
- public void println(Object x) {
+ public void println(final Object x) {
text.append(x);
flushLine();
}
- public void println(String x) {
+ public void println(final String x) {
text.append(x);
flushLine();
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/src/main/java/org/apache/openejb/server/hsql/HsqlService.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/src/main/java/org/apache/openejb/server/hsql/HsqlService.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/src/main/java/org/apache/openejb/server/hsql/HsqlService.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-hsql/src/main/java/org/apache/openejb/server/hsql/HsqlService.java Thu Jul 17 07:52:58 2014
@@ -97,7 +97,7 @@ public class HsqlService implements Serv
property.startsWith(sc_key_database + ".")) {
throw new ServiceException("Databases cannot be declared in the hsql.properties. " +
- "Instead declare a database connection in the openejb.conf file");
+ "Instead declare a database connection in the openejb.conf file");
}
if ("port".equals(property)) {
@@ -127,13 +127,13 @@ public class HsqlService implements Serv
connection = jdbc.getConnection();
final DatabaseMetaData meta = connection.getMetaData();
path = getPath(meta.getDriverName(), meta.getURL());
- } catch (Throwable t) {
+ } catch (final Throwable t) {
continue;
} finally {
if (connection != null) {
try {
connection.close();
- } catch (SQLException sqlEx) {
+ } catch (final SQLException sqlEx) {
// no-op
}
}
@@ -153,7 +153,7 @@ public class HsqlService implements Serv
}
}
}
- } catch (NameNotFoundException e) {
+ } catch (final NameNotFoundException e) {
//Ignore
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-http/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-http/pom.xml?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-http/pom.xml (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-http/pom.xml Thu Jul 17 07:52:58 2014
@@ -19,7 +19,8 @@
<!-- $Rev$ $Date$ -->
-<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">
+<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">
<parent>
<artifactId>server</artifactId>
<groupId>org.apache.openejb</groupId>
@@ -31,8 +32,8 @@
<name>OpenEJB :: Server :: Http</name>
<properties>
<openejb.osgi.import.pkg>
- org.mortbay*;resolution:=optional,
- *
+ org.mortbay*;resolution:=optional,
+ *
</openejb.osgi.import.pkg>
</properties>
<build>
@@ -66,7 +67,10 @@
<configuration>
<!-- DEBUG: Uncomment this line and comment out the next -->
<!--<argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -javaagent:${project.build.directory}/target/openejb-javaagent-${version}.jar=foo=bar</argLine>-->
- <argLine>"-javaagent:${project.build.directory}/openejb-javaagent-${project.version}.jar=foo=bar" -Dopenejb.classloader.forced-skip=org.apache.openejb.jee.,org.apache.openejb.api. -Dopenejb.classloader.forced-load=org.apache.openejb</argLine>
+ <argLine>"-javaagent:${project.build.directory}/openejb-javaagent-${project.version}.jar=foo=bar"
+ -Dopenejb.classloader.forced-skip=org.apache.openejb.jee.,org.apache.openejb.api.
+ -Dopenejb.classloader.forced-load=org.apache.openejb
+ </argLine>
<systemPropertyVariables>
<openejb.home>${project.build.directory}/test-classes</openejb.home>
</systemPropertyVariables>
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/EndWebBeansListener.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/EndWebBeansListener.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/EndWebBeansListener.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/EndWebBeansListener.java Thu Jul 17 07:52:58 2014
@@ -43,8 +43,8 @@ import java.util.Map;
/**
* @version $Rev$ $Date$
- *
- * Used as a stack executed at the end of the request too. Avoid multiple (useless) listeners.
+ * <p/>
+ * Used as a stack executed at the end of the request too. Avoid multiple (useless) listeners.
*/
public class EndWebBeansListener implements ServletContextListener, ServletRequestListener, HttpSessionListener, HttpSessionActivationListener {
@@ -70,7 +70,7 @@ public class EndWebBeansListener impleme
*
* @param webBeansContext the OWB context
*/
- public EndWebBeansListener(WebBeansContext webBeansContext) {
+ public EndWebBeansListener(final WebBeansContext webBeansContext) {
this.webBeansContext = webBeansContext;
if (webBeansContext != null) {
this.failoverService = this.webBeansContext.getService(FailOverService.class);
@@ -78,7 +78,7 @@ public class EndWebBeansListener impleme
this.contextKey = "org.apache.tomee.catalina.WebBeansListener@" + webBeansContext.hashCode();
} else {
this.contextKey = "notused";
- this.contextsService= null;
+ this.contextsService = null;
}
}
@@ -86,7 +86,7 @@ public class EndWebBeansListener impleme
* {@inheritDoc}
*/
@Override
- public void requestDestroyed(ServletRequestEvent event) {
+ public void requestDestroyed(final ServletRequestEvent event) {
if (webBeansContext == null) {
return;
}
@@ -106,10 +106,10 @@ public class EndWebBeansListener impleme
if (event != null
&& failoverService != null
&& failoverService.isSupportFailOver()) {
- Object request = event.getServletRequest();
+ final Object request = event.getServletRequest();
if (request instanceof HttpServletRequest) {
- HttpServletRequest httpRequest = (HttpServletRequest) request;
- javax.servlet.http.HttpSession session = httpRequest.getSession(false);
+ final HttpServletRequest httpRequest = (HttpServletRequest) request;
+ final javax.servlet.http.HttpSession session = httpRequest.getSession(false);
if (session != null) {
failoverService.sessionIsIdle(session);
}
@@ -136,7 +136,7 @@ public class EndWebBeansListener impleme
* {@inheritDoc}
*/
@Override
- public void requestInitialized(ServletRequestEvent event) {
+ public void requestInitialized(final ServletRequestEvent event) {
// no-op
}
@@ -144,7 +144,7 @@ public class EndWebBeansListener impleme
* {@inheritDoc}
*/
@Override
- public void sessionCreated(HttpSessionEvent event) {
+ public void sessionCreated(final HttpSessionEvent event) {
// no-op
}
@@ -152,7 +152,7 @@ public class EndWebBeansListener impleme
* {@inheritDoc}
*/
@Override
- public void sessionDestroyed(HttpSessionEvent event) {
+ public void sessionDestroyed(final HttpSessionEvent event) {
if (webBeansContext == null) {
return;
}
@@ -193,7 +193,7 @@ public class EndWebBeansListener impleme
@Override
- public void sessionWillPassivate(HttpSessionEvent event) {
+ public void sessionWillPassivate(final HttpSessionEvent event) {
if (webBeansContext == null) {
return;
}
@@ -205,17 +205,17 @@ public class EndWebBeansListener impleme
}
@Override
- public void sessionDidActivate(HttpSessionEvent event) {
+ public void sessionDidActivate(final HttpSessionEvent event) {
// no-op
}
@Override
- public void contextInitialized(ServletContextEvent servletContextEvent) {
+ public void contextInitialized(final ServletContextEvent servletContextEvent) {
destroyFakedRequest();
}
@Override
- public void contextDestroyed(ServletContextEvent servletContextEvent) {
+ public void contextDestroyed(final ServletContextEvent servletContextEvent) {
destroyFakedRequest();
}
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/FilterListener.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/FilterListener.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/FilterListener.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/FilterListener.java Thu Jul 17 07:52:58 2014
@@ -64,12 +64,12 @@ public class FilterListener implements H
}
@Override
- public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
+ public void doFilter(final ServletRequest request, final ServletResponse response) throws IOException, ServletException {
final HttpListenerRegistry registry = SystemInstance.get().getComponent(HttpListenerRegistry.class);
registry.setOrigin(origin);
try {
registry.onMessage((HttpRequest) request, (HttpResponse) response);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new ServletException(e);
} finally {
registry.setOrigin(origin);
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpListenerRegistry.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpListenerRegistry.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpListenerRegistry.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpListenerRegistry.java Thu Jul 17 07:52:58 2014
@@ -35,21 +35,21 @@ public class HttpListenerRegistry implem
}
@Override
- public void onMessage(HttpRequest request, HttpResponse response) throws Exception {
+ public void onMessage(final HttpRequest request, final HttpResponse response) throws Exception {
final String path = request.getURI().getPath();
final FilterListener currentFL = currentFilterListener.get();
// first look filters
- Map<String, Collection<HttpListener>> filters;
+ final Map<String, Collection<HttpListener>> filters;
synchronized (filterRegistry) {
filters = new HashMap<String, Collection<HttpListener>>(filterRegistry);
}
try {
boolean lastWasCurrent = false;
- for (Map.Entry<String, Collection<HttpListener>> entry : filters.entrySet()) {
- String pattern = entry.getKey();
- for (HttpListener listener : entry.getValue()) {
+ for (final Map.Entry<String, Collection<HttpListener>> entry : filters.entrySet()) {
+ final String pattern = entry.getKey();
+ for (final HttpListener listener : entry.getValue()) {
if ((lastWasCurrent || currentFL == null) && path.matches(pattern)) {
listener.onMessage(request, response);
return;
@@ -60,7 +60,7 @@ public class HttpListenerRegistry implem
// then others
- Map<String, HttpListener> listeners;
+ final Map<String, HttpListener> listeners;
synchronized (registry) {
listeners = new HashMap<String, HttpListener>(registry);
}
@@ -79,21 +79,21 @@ public class HttpListenerRegistry implem
}
}
- public void addHttpListener(HttpListener listener, String regex) {
+ public void addHttpListener(final HttpListener listener, final String regex) {
synchronized (registry) {
registry.put(regex, listener);
}
}
- public HttpListener removeHttpListener(String regex) {
- HttpListener listener;
+ public HttpListener removeHttpListener(final String regex) {
+ final HttpListener listener;
synchronized (registry) {
listener = registry.remove(regex);
}
return listener;
}
- public void addHttpFilter(HttpListener listener, String regex) {
+ public void addHttpFilter(final HttpListener listener, final String regex) {
synchronized (filterRegistry) {
if (!filterRegistry.containsKey(regex)) {
filterRegistry.put(regex, new ArrayList<HttpListener>());
@@ -102,7 +102,7 @@ public class HttpListenerRegistry implem
}
}
- public Collection<HttpListener> removeHttpFilter(String regex) {
+ public Collection<HttpListener> removeHttpFilter(final String regex) {
synchronized (filterRegistry) {
return filterRegistry.remove(regex);
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequest.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequest.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequest.java Thu Jul 17 07:52:58 2014
@@ -21,9 +21,9 @@ import javax.servlet.http.HttpServletReq
import java.util.Map;
-/** An interface to take care of HTTP Requests. It parses headers, content, form and url
- * parameters.
- *
+/**
+ * An interface to take care of HTTP Requests. It parses headers, content, form and url
+ * parameters.
*/
public interface HttpRequest extends java.io.Serializable, HttpServletRequest {
@@ -38,27 +38,49 @@ public interface HttpRequest extends jav
//
// Header variables
//
- /** the Accept header */
+ /**
+ * the Accept header
+ */
public static final String HEADER_ACCEPT = "Accept";
- /** the Accept-Encoding header */
+ /**
+ * the Accept-Encoding header
+ */
public static final String HEADER_ACCEPT_ENCODING = "Accept-Encoding";
- /** the Accept-Language header */
+ /**
+ * the Accept-Language header
+ */
public static final String HEADER_ACCEPT_LANGUAGE = "Accept-Language";
- /** the Content-Type header */
+ /**
+ * the Content-Type header
+ */
public static final String HEADER_CONTENT_TYPE = "Content-Type";
- /** the Content-Length header */
+ /**
+ * the Content-Length header
+ */
public static final String HEADER_CONTENT_LENGTH = "Content-Length";
- /** the Connection header */
+ /**
+ * the Connection header
+ */
public static final String HEADER_CONNECTION = "Connection";
- /** the Cache-Control header */
+ /**
+ * the Cache-Control header
+ */
public static final String HEADER_CACHE_CONTROL = "Cache-Control";
- /** the Host header */
+ /**
+ * the Host header
+ */
public static final String HEADER_HOST = "Host";
- /** the User-Agent header */
+ /**
+ * the User-Agent header
+ */
public static final String HEADER_USER_AGENT = "User-Agent";
- /** the Set-Cookie header */
+ /**
+ * the Set-Cookie header
+ */
public static final String HEADER_SET_COOKIE = "Set-Cookie";
- /** the Cookie header */
+ /**
+ * the Cookie header
+ */
public static final String HEADER_COOKIE = "Cookie";
//
@@ -86,18 +108,22 @@ public interface HttpRequest extends jav
/**
* Gets a form or URL query parameter based on the name passed in.
+ *
* @param name
*/
String getParameter(String name);
/**
* Gets all the form and URL query parameters
+ *
* @return All the form and URL query parameters
*/
Map getParameters();
- /** Gets the URI for the current URL page.
+ /**
+ * Gets the URI for the current URL page.
+ *
* @return The URI
*/
public java.net.URI getURI();
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java Thu Jul 17 07:52:58 2014
@@ -96,29 +96,29 @@ public class HttpRequestImpl implements
/**
* the headers for this page
*/
- private final Map<String,String> headers = new HashMap<String,String>();
+ private final Map<String, String> headers = new HashMap<String, String>();
/**
* the form parameters for this page
*/
- private final Map<String,String> formParams = new HashMap<String,String>();
+ private final Map<String, String> formParams = new HashMap<String, String>();
/**
* the URL (or query) parameters for this page
*/
- private final Map<String,String> queryParams = new HashMap<String,String>();
+ private final Map<String, String> queryParams = new HashMap<String, String>();
/**
* All form and query parameters. Query parameters override form parameters.
*/
- private final Map<String,String> parameters = new HashMap<String,String>();
+ private final Map<String, String> parameters = new HashMap<String, String>();
private final Map<String, Part> parts = new HashMap<String, Part>();
/**
* Cookies sent from the client
*/
- private Map<String,String> cookies;
+ private Map<String, String> cookies;
/**
* the content of the body of the request
@@ -136,7 +136,7 @@ public class HttpRequestImpl implements
/**
* Request scoped data which is set and used by application code.
*/
- private final Map<String,Object> attributes = new HashMap<String,Object>();
+ private final Map<String, Object> attributes = new HashMap<String, Object>();
private String path = "/";
private Locale locale = Locale.getDefault();
@@ -146,7 +146,7 @@ public class HttpRequestImpl implements
private String contextPath = "";
private String servletPath = null;
- public HttpRequestImpl(URI socketURI) {
+ public HttpRequestImpl(final URI socketURI) {
this.socketURI = socketURI;
}
@@ -156,7 +156,7 @@ public class HttpRequestImpl implements
* @param name The name of the header to get
* @return The value of the header
*/
- public String getHeader(String name) {
+ public String getHeader(final String name) {
return headers.get(name);
}
@@ -166,12 +166,12 @@ public class HttpRequestImpl implements
}
@Override
- public Enumeration<String> getHeaders(String s) {
+ public Enumeration<String> getHeaders(final String s) {
return new ArrayEnumeration(Arrays.asList(headers.get(s)));
}
@Override
- public int getIntHeader(String s) {
+ public int getIntHeader(final String s) {
return Integer.parseInt(s);
}
@@ -181,16 +181,16 @@ public class HttpRequestImpl implements
* @param name The name of the form parameter to get
* @return The value of the parameter
*/
- public String getFormParameter(String name) {
+ public String getFormParameter(final String name) {
return formParams.get(name);
}
- public Map<String,String> getFormParameters() {
- return new HashMap<String,String>(formParams);
+ public Map<String, String> getFormParameters() {
+ return new HashMap<String, String>(formParams);
}
- public Map<String,String> getQueryParameters() {
- return new HashMap<String,String>(queryParams);
+ public Map<String, String> getQueryParameters() {
+ return new HashMap<String, String>(queryParams);
}
/**
@@ -199,12 +199,13 @@ public class HttpRequestImpl implements
* @param name The name of the URL (or query) parameter
* @return The value of the URL (or query) parameter
*/
- public String getQueryParameter(String name) {
+ public String getQueryParameter(final String name) {
return queryParams.get(name);
}
/**
* Gets the request method.
+ *
* @return the request method
*/
public String getMethod() {
@@ -212,7 +213,7 @@ public class HttpRequestImpl implements
}
@Override
- public Part getPart(String s) throws IOException, ServletException {
+ public Part getPart(final String s) throws IOException, ServletException {
return parts.get(s);
}
@@ -236,11 +237,11 @@ public class HttpRequestImpl implements
@Override
public String getQueryString() {
- StringBuilder str = new StringBuilder("");
- for (Map.Entry<String, String> q : queryParams.entrySet()) {
+ final StringBuilder str = new StringBuilder("");
+ for (final Map.Entry<String, String> q : queryParams.entrySet()) {
str.append(q.getKey()).append("=").append(q.getValue()).append("&");
}
- String out = str.toString();
+ final String out = str.toString();
if (out.isEmpty()) {
return out;
}
@@ -336,13 +337,14 @@ public class HttpRequestImpl implements
/*------------------------------------------------------------*/
/* Methods for reading in and parsing a request */
/*------------------------------------------------------------*/
+
/**
* parses the request into the 3 different parts, request, headers, and body
*
* @param input the data input for this page
* @throws java.io.IOException if an exception is thrown
*/
- protected void readMessage(InputStream input) throws IOException {
+ protected void readMessage(final InputStream input) throws IOException {
final DataInput di = new DataInputStream(input);
readRequestLine(di);
@@ -356,7 +358,7 @@ public class HttpRequestImpl implements
final String cookie = headers.get("Cookie");
if (cookie != null) {
final String[] cookies = cookie.split(";");
- for (String c : cookies) {
+ for (final String c : cookies) {
final String current = c.trim();
if (current.startsWith("EJBSESSIONID=")) {
session = SESSIONS.get(current.substring("EJBSESSIONID=".length()));
@@ -366,12 +368,12 @@ public class HttpRequestImpl implements
}
}
- public void print(final Logger log, boolean formatXml) {
+ public void print(final Logger log, final boolean formatXml) {
if (log.isDebugEnabled()) {
final StringBuilder builder = new StringBuilder();
builder.append("******************* REQUEST ******************\n");
builder.append(method).append(" ").append(uri).append("\n");
- for (Map.Entry<String, String> entry : headers.entrySet()) {
+ for (final Map.Entry<String, String> entry : headers.entrySet()) {
builder.append(entry).append("\n");
}
builder.append("\n");
@@ -393,19 +395,19 @@ public class HttpRequestImpl implements
* @param in the input to be read
* @throws java.io.IOException if an exception is thrown
*/
- private void readRequestLine(DataInput in) throws IOException {
- String line;
+ private void readRequestLine(final DataInput in) throws IOException {
+ final String line;
try {
line = in.readLine();
// System.out.println(line);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IOException("Could not read the HTTP Request Line :"
- + e.getClass().getName()
- + " : "
- + e.getMessage());
+ + e.getClass().getName()
+ + " : "
+ + e.getMessage());
}
- StringTokenizer lineParts = new StringTokenizer(line, " ");
+ final StringTokenizer lineParts = new StringTokenizer(line, " ");
/* [1] Parse the method */
parseMethod(lineParts);
/* [2] Parse the URI */
@@ -418,15 +420,15 @@ public class HttpRequestImpl implements
* @param lineParts a StringTokenizer of the request line
* @throws java.io.IOException if an exeption is thrown
*/
- private void parseMethod(StringTokenizer lineParts) throws IOException {
- String token;
+ private void parseMethod(final StringTokenizer lineParts) throws IOException {
+ final String token;
try {
token = lineParts.nextToken();
} catch (final Exception e) {
throw new IOException("Could not parse the HTTP Request Method :"
- + e.getClass().getName()
- + " : "
- + e.getMessage());
+ + e.getClass().getName()
+ + " : "
+ + e.getMessage());
}
// in JAXRS you can create your own method
@@ -463,20 +465,20 @@ public class HttpRequestImpl implements
* @param lineParts a StringTokenizer of the URI
* @throws java.io.IOException if an exeption is thrown
*/
- private void parseURI(StringTokenizer lineParts) throws IOException {
- String token;
+ private void parseURI(final StringTokenizer lineParts) throws IOException {
+ final String token;
try {
token = lineParts.nextToken();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IOException("Could not parse the HTTP Request Method :"
- + e.getClass().getName()
- + " : "
- + e.getMessage());
+ + e.getClass().getName()
+ + " : "
+ + e.getMessage());
}
try {
- uri = new URI(socketURI.toString()+token);
- } catch (URISyntaxException e) {
+ uri = new URI(socketURI.toString() + token);
+ } catch (final URISyntaxException e) {
throw new IOException("Malformed URI :" + token + " Exception: " + e.getMessage());
}
@@ -488,24 +490,24 @@ public class HttpRequestImpl implements
*
* @param query the URL (or query) parameters to be parsed
*/
- private void parseQueryParams(String query) {
+ private void parseQueryParams(final String query) {
if (query == null)
return;
- StringTokenizer parameters = new StringTokenizer(query, "&");
+ final StringTokenizer parameters = new StringTokenizer(query, "&");
while (parameters.hasMoreTokens()) {
- StringTokenizer param = new StringTokenizer(parameters.nextToken(), "=");
+ final StringTokenizer param = new StringTokenizer(parameters.nextToken(), "=");
/* [1] Parse the Name */
if (!param.hasMoreTokens())
continue;
- String name = URLDecoder.decode(param.nextToken());
+ final String name = URLDecoder.decode(param.nextToken());
if (name == null)
continue;
- String value;
+ final String value;
/* [2] Parse the Value */
- if (!param.hasMoreTokens()){
+ if (!param.hasMoreTokens()) {
value = "";
} else {
value = URLDecoder.decode(param.nextToken());
@@ -522,20 +524,20 @@ public class HttpRequestImpl implements
* @param in the data input sent from the browser
* @throws java.io.IOException if an exeption is thrown
*/
- private void readHeaders(DataInput in) throws IOException {
+ private void readHeaders(final DataInput in) throws IOException {
// System.out.println("\nREQUEST");
while (true) {
// Header Field
- String hf;
+ final String hf;
try {
hf = in.readLine();
//System.out.println(hf);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IOException("Could not read the HTTP Request Header Field :"
- + e.getClass().getName()
- + " : "
- + e.getMessage());
+ + e.getClass().getName()
+ + " : "
+ + e.getMessage());
}
if (hf == null || hf.equals("")) {
@@ -543,8 +545,8 @@ public class HttpRequestImpl implements
}
/* [1] parse the name */
- int colonIndex = hf.indexOf((int) ':');
- String name = hf.substring(0, colonIndex);
+ final int colonIndex = hf.indexOf((int) ':');
+ final String name = hf.substring(0, colonIndex);
if (name == null)
break;
@@ -555,33 +557,32 @@ public class HttpRequestImpl implements
value = value.trim();
headers.put(name, value);
}
-
+
// Update the URI to be what the client sees the the server as.
- String host = headers.get("Host");
- if( host!=null ) {
- String hostName;
+ final String host = headers.get("Host");
+ if (host != null) {
+ final String hostName;
int port = uri.getPort();
- int idx = host.indexOf(":");
- if( idx >= 0 ) {
+ final int idx = host.indexOf(":");
+ if (idx >= 0) {
hostName = host.substring(0, idx);
try {
- port = Integer.parseInt(host.substring(idx+1));
- }
- catch (NumberFormatException ignore) {
+ port = Integer.parseInt(host.substring(idx + 1));
+ } catch (final NumberFormatException ignore) {
}
} else {
hostName = host;
}
-
+
try {
uri = new URI(uri.getScheme(),
- uri.getUserInfo(), hostName, port,
- uri.getPath(), uri.getQuery(),
- uri.getFragment());
- } catch (URISyntaxException ignore) {
- }
+ uri.getUserInfo(), hostName, port,
+ uri.getPath(), uri.getQuery(),
+ uri.getFragment());
+ } catch (final URISyntaxException ignore) {
+ }
}
-
+
//temp-debug-------------------------------------------
//java.util.Iterator myKeys = headers.keySet().iterator();
//String temp = null;
@@ -596,13 +597,14 @@ public class HttpRequestImpl implements
return !method.equals(Method.GET.name()) && !method.equals(Method.DELETE.name())
&& !method.equals(Method.HEAD.name()) && !method.equals(Method.OPTIONS.name());
}
+
/**
* reads the body from the data input passed in
*
* @param in the data input with the body of the page
* @throws java.io.IOException if an exception is thrown
*/
- private void readBody(DataInput in) throws IOException {
+ private void readBody(final DataInput in) throws IOException {
//System.out.println("Body Length: " + body.length);
// Content-type: application/x-www-form-urlencoded
// or multipart/form-data
@@ -612,22 +614,22 @@ public class HttpRequestImpl implements
final boolean hasBody = hasBody();
if (hasBody && FORM_URL_ENCODED.equals(contentType)) {
- String rawParams;
+ final String rawParams;
try {
body = readContent(in);
this.in = new ServletByteArrayIntputStream(body);
rawParams = new String(body);
- } catch (Exception e) {
- throw (IOException)new IOException("Could not read the HTTP Request Body: " + e.getMessage()).initCause(e);
+ } catch (final Exception e) {
+ throw (IOException) new IOException("Could not read the HTTP Request Body: " + e.getMessage()).initCause(e);
}
- StringTokenizer parameters = new StringTokenizer(rawParams, "&");
+ final StringTokenizer parameters = new StringTokenizer(rawParams, "&");
String name;
String value;
while (parameters.hasMoreTokens()) {
- StringTokenizer param = new StringTokenizer(parameters.nextToken(), "=");
+ final StringTokenizer param = new StringTokenizer(parameters.nextToken(), "=");
/* [1] Parse the Name */
name = URLDecoder.decode(param.nextToken(), "UTF-8");
@@ -645,21 +647,21 @@ public class HttpRequestImpl implements
value = "";
formParams.put(name, value);
- //System.out.println(name + ": " + value);
+ //System.out.println(name + ": " + value);
}
} else if (hasBody && CHUNKED.equals(headers.get(TRANSFER_ENCODING))) {
try {
- ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
+ final ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
for (String line = in.readLine(); line != null; line = in.readLine()) {
// read the size line which is in hex
- String sizeString = line.split(";", 2)[0];
- int size = Integer.parseInt(sizeString, 16);
+ final String sizeString = line.split(";", 2)[0];
+ final int size = Integer.parseInt(sizeString, 16);
// if size is 0 we are done
if (size == 0) break;
// read the chunk and append to byte array
- byte[] chunk = new byte[size];
+ final byte[] chunk = new byte[size];
in.readFully(chunk);
out.write(chunk);
@@ -668,10 +670,10 @@ public class HttpRequestImpl implements
}
body = out.toByteArray();
this.in = new ServletByteArrayIntputStream(body);
- } catch (Exception e) {
- throw (IOException)new IOException("Unable to read chunked body").initCause(e);
+ } catch (final Exception e) {
+ throw (IOException) new IOException("Unable to read chunked body").initCause(e);
}
- } else if (hasBody){
+ } else if (hasBody) {
// TODO This really is terrible
body = readContent(in);
this.in = new ServletByteArrayIntputStream(body);
@@ -682,13 +684,13 @@ public class HttpRequestImpl implements
}
- private byte[] readContent(DataInput in) throws IOException {
+ private byte[] readContent(final DataInput in) throws IOException {
if (length >= 0) {
- byte[] body = new byte[length];
+ final byte[] body = new byte[length];
in.readFully(body);
return body;
} else {
- ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
+ final ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
try {
boolean atLineStart = true;
while (true) {
@@ -711,24 +713,24 @@ public class HttpRequestImpl implements
}
out.write(b);
}
- } catch (EOFException e) {
+ } catch (final EOFException e) {
// done reading
}
- byte[] body = out.toByteArray();
+ final byte[] body = out.toByteArray();
return body;
}
}
private int parseContentLength() {
// Content-length: 384
- String len = getHeader(HttpRequest.HEADER_CONTENT_LENGTH);
+ final String len = getHeader(HttpRequest.HEADER_CONTENT_LENGTH);
//System.out.println("readRequestBody Content-Length: " + len);
int length = -1;
if (len != null) {
try {
length = Integer.parseInt(len);
- } catch (Exception e) {
+ } catch (final Exception e) {
//don't care
}
}
@@ -736,7 +738,7 @@ public class HttpRequestImpl implements
}
@Override
- public boolean authenticate(HttpServletResponse httpServletResponse) throws IOException, ServletException {
+ public boolean authenticate(final HttpServletResponse httpServletResponse) throws IOException, ServletException {
return true; // TODO?
}
@@ -759,7 +761,7 @@ public class HttpRequestImpl implements
if (uri.startsWith("/")) {
uri = uri.substring(1);
}
- int idx = uri.indexOf("/");
+ final int idx = uri.indexOf("/");
if (idx < 0) {
return uri;
}
@@ -770,16 +772,16 @@ public class HttpRequestImpl implements
public Cookie[] getCookies() {
if (cookies != null) return toCookies(cookies);
- cookies = new HashMap<String,String>();
+ cookies = new HashMap<String, String>();
- String cookieHeader = getHeader(HEADER_COOKIE);
+ final String cookieHeader = getHeader(HEADER_COOKIE);
if (cookieHeader == null) return toCookies(cookies);
- StringTokenizer tokens = new StringTokenizer(cookieHeader, ";");
+ final StringTokenizer tokens = new StringTokenizer(cookieHeader, ";");
while (tokens.hasMoreTokens()) {
- StringTokenizer token = new StringTokenizer(tokens.nextToken(), "=");
- String name = token.nextToken();
- String value = token.nextToken();
+ final StringTokenizer token = new StringTokenizer(tokens.nextToken(), "=");
+ final String name = token.nextToken();
+ final String value = token.nextToken();
cookies.put(name, value);
}
return toCookies(cookies);
@@ -788,40 +790,40 @@ public class HttpRequestImpl implements
protected Map<?, ?> getInternalCookies() {
if (cookies != null) return cookies;
- cookies = new HashMap<String,String>();
+ cookies = new HashMap<String, String>();
- String cookieHeader = getHeader(HEADER_COOKIE);
+ final String cookieHeader = getHeader(HEADER_COOKIE);
if (cookieHeader == null) return cookies;
- StringTokenizer tokens = new StringTokenizer(cookieHeader, ";");
+ final StringTokenizer tokens = new StringTokenizer(cookieHeader, ";");
while (tokens.hasMoreTokens()) {
- StringTokenizer token = new StringTokenizer(tokens.nextToken(), "=");
- String name = token.nextToken();
- String value = token.nextToken();
+ final StringTokenizer token = new StringTokenizer(tokens.nextToken(), "=");
+ final String name = token.nextToken();
+ final String value = token.nextToken();
cookies.put(name, value);
}
return cookies;
}
- private Cookie[] toCookies(Map<String, String> cookies) {
- Cookie[] out = new Cookie[cookies.size()];
+ private Cookie[] toCookies(final Map<String, String> cookies) {
+ final Cookie[] out = new Cookie[cookies.size()];
int i = 0;
- for (Map.Entry<String, String> entry : cookies.entrySet()) {
+ for (final Map.Entry<String, String> entry : cookies.entrySet()) {
out[i++] = new Cookie(entry.getKey(), entry.getValue());
}
return out;
}
@Override
- public long getDateHeader(String s) {
+ public long getDateHeader(final String s) {
return Long.parseLong(s);
}
- protected String getCookie(String name) {
+ protected String getCookie(final String name) {
return (String) getInternalCookies().get(name);
}
- public HttpSession getSession(boolean create) {
+ public HttpSession getSession(final boolean create) {
if (session == null && create) {
session = new HttpSessionImpl(SESSIONS);
final HttpSession previous = SESSIONS.putIfAbsent(session.getId(), session);
@@ -867,12 +869,12 @@ public class HttpRequestImpl implements
}
@Override
- public boolean isUserInRole(String s) {
+ public boolean isUserInRole(final String s) {
return true; // TODO?
}
@Override
- public void login(String s, String s1) throws ServletException {
+ public void login(final String s, final String s1) throws ServletException {
// no-op
}
@@ -890,7 +892,7 @@ public class HttpRequestImpl implements
return null;
}
- public Object getAttribute(String name) {
+ public Object getAttribute(final String name) {
return attributes.get(name);
}
@@ -904,12 +906,12 @@ public class HttpRequestImpl implements
return encoding;
}
- public void setAttribute(String name, Object value){
+ public void setAttribute(final String name, final Object value) {
attributes.put(name, value);
}
@Override
- public void setCharacterEncoding(String s) throws UnsupportedEncodingException {
+ public void setCharacterEncoding(final String s) throws UnsupportedEncodingException {
encoding = s;
}
@@ -919,19 +921,19 @@ public class HttpRequestImpl implements
}
@Override
- public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) {
+ public AsyncContext startAsync(final ServletRequest servletRequest, final ServletResponse servletResponse) {
return null;
}
- public String getParameter(String name) {
+ public String getParameter(final String name) {
return parameters.get(name);
}
@Override
public Map<String, String[]> getParameterMap() {
- Map<String, String[]> params = new HashMap<String, String[]>();
- for (Map.Entry<String, String> p : parameters.entrySet()) {
- params.put(p.getKey(), new String[] { p.getValue() });
+ final Map<String, String[]> params = new HashMap<String, String[]>();
+ for (final Map.Entry<String, String> p : parameters.entrySet()) {
+ params.put(p.getKey(), new String[]{p.getValue()});
}
return params;
}
@@ -942,8 +944,8 @@ public class HttpRequestImpl implements
}
@Override
- public String[] getParameterValues(String s) {
- return new String[] { parameters.get(s) };
+ public String[] getParameterValues(final String s) {
+ return new String[]{parameters.get(s)};
}
@Override
@@ -957,12 +959,12 @@ public class HttpRequestImpl implements
}
@Override
- public String getRealPath(String s) {
+ public String getRealPath(final String s) {
return path;
}
- public Map<String,String> getParameters() {
- return new HashMap<String,String>(parameters);
+ public Map<String, String> getParameters() {
+ return new HashMap<String, String>(parameters);
}
public String getRemoteAddr() {
@@ -981,7 +983,7 @@ public class HttpRequestImpl implements
}
@Override
- public RequestDispatcher getRequestDispatcher(String s) {
+ public RequestDispatcher getRequestDispatcher(final String s) {
return null;
}
@@ -1004,7 +1006,7 @@ public class HttpRequestImpl implements
public ServletContext getServletContext() { // we need a not null value but it is not intended to be used in standalone for now
if (context == null) {
context = (ServletContext) Proxy.newProxyInstance(
- Thread.currentThread().getContextClassLoader(), SERVLET_CONTEXT_INTERFACES, SERVLET_CONTEXT_HANDLER);
+ Thread.currentThread().getContextClassLoader(), SERVLET_CONTEXT_INTERFACES, SERVLET_CONTEXT_HANDLER);
}
return context;
}
@@ -1025,7 +1027,7 @@ public class HttpRequestImpl implements
}
@Override
- public void removeAttribute(String s) {
+ public void removeAttribute(final String s) {
attributes.remove(s);
}
@@ -1036,7 +1038,7 @@ public class HttpRequestImpl implements
public String requestRawPath() {
try {
return new URI(getRequestURI()).getRawPath();
- } catch (URISyntaxException e) {
+ } catch (final URISyntaxException e) {
return getRequestURI();
}
}
Modified: tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponse.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponse.java?rev=1611274&r1=1611273&r2=1611274&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponse.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpResponse.java Thu Jul 17 07:52:58 2014
@@ -27,18 +27,21 @@ import java.io.IOException;
public interface HttpResponse extends java.io.Serializable, HttpServletResponse {
/**
* Gets the content type that will be sent to the browser.
+ *
* @return the content type (i.e. "text/html")
*/
public String getContentType();
/**
* Sets the content type to be sent back to the browser.
+ *
* @param type the type to be sent to the browser (i.e. "text/html")
*/
public void setContentType(String type);
/**
* Sets the response string to be sent to the browser
+ *
* @param responseString the response string
*/
void setStatusMessage(String responseString);