You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2011/05/03 08:22:23 UTC
svn commit: r1098935 [19/20] - in /incubator/isis/trunk/runtimes/dflt:
bytecode/dflt/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/classsubstitutor/
bytecode/dflt/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/
byte...
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/testsystem/tests/TestProxyOid_ValueType.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/testsystem/tests/TestProxyOid_ValueType.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/testsystem/tests/TestProxyOid_ValueType.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/testsystem/tests/TestProxyOid_ValueType.java Tue May 3 06:22:09 2011
@@ -16,25 +16,24 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.runtimes.dflt.runtime.testsystem.tests;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid;
-import org.apache.isis.core.testsupport.value.ValueTypeContractTestAbstract;
-
-public class TestProxyOid_ValueType extends ValueTypeContractTestAbstract<TestProxyOid> {
-
- @Override
- protected List<TestProxyOid> getObjectsWithSameValue() {
- return Arrays.asList(new TestProxyOid(1, true), new TestProxyOid(1, true));
- }
-
- @Override
- protected List<TestProxyOid> getObjectsWithDifferentValue() {
- return Arrays.asList(new TestProxyOid(1, false), new TestProxyOid(2, true));
- }
-
-
-}
+package org.apache.isis.runtimes.dflt.runtime.testsystem.tests;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.isis.core.testsupport.value.ValueTypeContractTestAbstract;
+import org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyOid;
+
+public class TestProxyOid_ValueType extends ValueTypeContractTestAbstract<TestProxyOid> {
+
+ @Override
+ protected List<TestProxyOid> getObjectsWithSameValue() {
+ return Arrays.asList(new TestProxyOid(1, true), new TestProxyOid(1, true));
+ }
+
+ @Override
+ protected List<TestProxyOid> getObjectsWithDifferentValue() {
+ return Arrays.asList(new TestProxyOid(1, false), new TestProxyOid(2, true));
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/transaction/messagebroker/MessageBrokerNoop.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/transaction/messagebroker/MessageBrokerNoop.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/transaction/messagebroker/MessageBrokerNoop.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/transaction/messagebroker/MessageBrokerNoop.java Tue May 3 06:22:09 2011
@@ -17,40 +17,48 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.transaction.messagebroker;
+
+import java.util.List;
-package org.apache.isis.runtimes.dflt.runtime.transaction.messagebroker;
-
-import java.util.List;
-
import org.apache.isis.core.commons.components.Noop;
import org.apache.isis.runtimes.dflt.runtime.system.transaction.MessageBroker;
-
-public class MessageBrokerNoop implements MessageBroker, Noop {
-
- public void addMessage(String message) {}
-
- public void addWarning(String message) {}
-
- public void reset() {}
-
- public void ensureEmpty() {}
-
- public List<String> getMessages() {
- return null;
- }
-
- public String getMessagesCombined() {
- return null;
- }
-
- public List<String> getWarnings() {
- return null;
- }
-
- public String getWarningsCombined() {
- return null;
- }
-
-}
-
-
+
+public class MessageBrokerNoop implements MessageBroker, Noop {
+
+ @Override
+ public void addMessage(final String message) {
+ }
+
+ @Override
+ public void addWarning(final String message) {
+ }
+
+ public void reset() {
+ }
+
+ @Override
+ public void ensureEmpty() {
+ }
+
+ @Override
+ public List<String> getMessages() {
+ return null;
+ }
+
+ @Override
+ public String getMessagesCombined() {
+ return null;
+ }
+
+ @Override
+ public List<String> getWarnings() {
+ return null;
+ }
+
+ @Override
+ public String getWarningsCombined() {
+ return null;
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/transaction/messagebroker/MessageBrokerNoopInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/transaction/messagebroker/MessageBrokerNoopInstaller.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/transaction/messagebroker/MessageBrokerNoopInstaller.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/transaction/messagebroker/MessageBrokerNoopInstaller.java Tue May 3 06:22:09 2011
@@ -17,32 +17,27 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.runtime.transaction.messagebroker;
+
+import java.util.List;
-package org.apache.isis.runtimes.dflt.runtime.transaction.messagebroker;
-
-import java.util.List;
-
import org.apache.isis.core.commons.config.InstallerAbstract;
import org.apache.isis.runtimes.dflt.runtime.system.transaction.MessageBroker;
-import org.apache.isis.runtimes.dflt.runtime.transaction.messagebroker.MessageBrokerInstaller;
-
-
-public class MessageBrokerNoopInstaller extends InstallerAbstract implements MessageBrokerInstaller {
-
-
- public MessageBrokerNoopInstaller() {
- super(MessageBrokerInstaller.TYPE, "noop");
- }
-
- public MessageBroker createMessageBroker() {
- return new MessageBrokerNoop();
- }
-
- @Override
- public List<Class<?>> getTypes() {
- return listOf(MessageBroker.class);
- }
-
-}
-
-
+
+public class MessageBrokerNoopInstaller extends InstallerAbstract implements MessageBrokerInstaller {
+
+ public MessageBrokerNoopInstaller() {
+ super(MessageBrokerInstaller.TYPE, "noop");
+ }
+
+ @Override
+ public MessageBroker createMessageBroker() {
+ return new MessageBrokerNoop();
+ }
+
+ @Override
+ public List<Class<?>> getTypes() {
+ return listOf(MessageBroker.class);
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java Tue May 3 06:22:09 2011
@@ -17,17 +17,21 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.runtime.userprofile;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
import java.util.Iterator;
-import org.junit.Before;
-import org.junit.Test;
import org.apache.isis.core.commons.debug.DebugString;
import org.apache.isis.core.runtime.userprofile.Options;
-
-import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.Test;
public class OptionsTest {
@@ -38,7 +42,7 @@ public class OptionsTest {
public void setup() throws Exception {
suboptions = new Options();
suboptions.addOption("name-3", "value-2");
-
+
options = new Options();
options.addOption("test", "value");
options.addOption("anInt", "23");
@@ -49,65 +53,63 @@ public class OptionsTest {
public void savedValueIsRetrieved() throws Exception {
assertEquals("value", options.getString("test"));
}
-
+
@Test
public void unknownNameIsNull() throws Exception {
assertNull(options.getString("unknown"));
}
-
+
@Test
public void intValue() throws Exception {
assertEquals(23, options.getInteger("anInt", 0));
}
-
+
@Test
public void intDefault() throws Exception {
assertEquals(10, options.getInteger("unknown", 10));
}
-
+
@Test
public void stringDefault() throws Exception {
- assertEquals("def", options.getString("unknown", "def"));
+ assertEquals("def", options.getString("unknown", "def"));
}
-
+
@Test
public void debug() throws Exception {
- DebugString debug = new DebugString();
+ final DebugString debug = new DebugString();
options.debugData(debug);
assertNotNull(debug.toString());
}
-
+
@Test
public void names() throws Exception {
- Iterator<String> names = options.names();
+ final Iterator<String> names = options.names();
assertTrue(names.hasNext());
}
-
+
@Test
public void copy() throws Exception {
- Options copy = new Options();
+ final Options copy = new Options();
copy.copy(options);
assertEquals("value", copy.getString("test"));
}
-
+
@Test
public void addOptions() throws Exception {
- Options suboptions = options.getOptions("suboptions");
+ final Options suboptions = options.getOptions("suboptions");
assertEquals("value-2", suboptions.getString("name-3"));
}
-
+
@Test
public void emptyWhenOptionsWhenNotFound() throws Exception {
- Options suboptions = options.getOptions("unkown");
+ final Options suboptions = options.getOptions("unkown");
assertFalse(suboptions.names().hasNext());
}
-
+
@Test
public void newEmptyOptionsAdded() throws Exception {
- Options suboptions = options.getOptions("unknown");
+ final Options suboptions = options.getOptions("unknown");
suboptions.addOption("test", "value");
assertSame(suboptions, options.getOptions("unknown"));
}
}
-
-
Modified: incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/IsisSessionFilter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/IsisSessionFilter.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/IsisSessionFilter.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/IsisSessionFilter.java Tue May 3 06:22:09 2011
@@ -17,114 +17,117 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.webapp;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
-package org.apache.isis.runtimes.dflt.webapp;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.commons.factory.InstanceUtil;
import org.apache.isis.core.runtime.authentication.AuthenticationManager;
import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
import org.apache.isis.runtimes.dflt.webapp.auth.AuthenticationSessionLookupStrategy;
import org.apache.isis.runtimes.dflt.webapp.auth.AuthenticationSessionLookupStrategyDefault;
-
-
-public class IsisSessionFilter implements Filter {
-
- /**
- * Init parameter key to lookup implementation of {@link AuthenticationSessionLookupStrategy}.
- */
- public static final String AUTHENTICATION_SESSION_LOOKUP_STRATEGY_KEY = "authenticationSessionLookupStrategy";
-
- /**
- * Default value for {@link #AUTHENTICATION_SESSION_LOOKUP_STRATEGY_KEY} if not specified.
- */
- public static final String AUTHENTICATION_SESSION_LOOKUP_STRATEGY_DEFAULT = AuthenticationSessionLookupStrategyDefault.class
- .getName();
-
- /**
- * Init parameter key for (typically, a logon) page to redirect to if the {@link AuthenticationSession}
- * cannot be found or is invalid.
- */
- public static final String LOGON_PAGE_KEY = "logonPage";
-
- private AuthenticationSessionLookupStrategy authSessionLookupStrategy;
- private String redirectResourceIfNoSession;
-
- // /////////////////////////////////////////////////////////////////
- // init, destroy
- // /////////////////////////////////////////////////////////////////
-
- public void init(FilterConfig config) throws ServletException {
- lookupAuthenticationSessionLookupStrategy(config);
- lookupRedirectIfNoSessionKey(config);
- }
-
- private void lookupAuthenticationSessionLookupStrategy(FilterConfig config) {
- String authLookupStrategyClassName = config.getInitParameter(AUTHENTICATION_SESSION_LOOKUP_STRATEGY_KEY);
- if (authLookupStrategyClassName == null) {
- authLookupStrategyClassName = AUTHENTICATION_SESSION_LOOKUP_STRATEGY_DEFAULT;
- }
- authSessionLookupStrategy = (AuthenticationSessionLookupStrategy) InstanceUtil
- .createInstance(authLookupStrategyClassName);
- }
-
- private void lookupRedirectIfNoSessionKey(FilterConfig config) {
- redirectResourceIfNoSession = config.getInitParameter(LOGON_PAGE_KEY);
- }
-
- public void destroy() {}
-
- // /////////////////////////////////////////////////////////////////
- // doFilter
- // /////////////////////////////////////////////////////////////////
-
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
- ServletException {
-
- HttpServletRequest httpRequest = (HttpServletRequest) request;
- HttpServletResponse httpResponse = (HttpServletResponse) response;
-
- // forward/redirect as required
- AuthenticationSession authSession = authSessionLookupStrategy.lookup(request, response);
- if (!isValid(authSession)) {
- if (redirectResourceIfNoSession != null && !redirectResourceIfNoSession.equals(httpRequest.getServletPath())) {
- httpResponse.sendRedirect(redirectResourceIfNoSession);
- } else {
- // the destination servlet is expected to know that there
- // will be no open context
- chain.doFilter(request, response);
- }
- } else {
- // else, is authenticated so open session
- authSessionLookupStrategy.bind(request, response, authSession);
-
- IsisContext.openSession(authSession);
- chain.doFilter(request, response);
- IsisContext.closeSession();
- }
- }
-
- private boolean isValid(AuthenticationSession authSession) {
- return authSession != null && getAuthenticationManager().isSessionValid(authSession);
- }
-
- // /////////////////////////////////////////////////////////////////
- // Dependencies (from context)
- // /////////////////////////////////////////////////////////////////
-
- private static AuthenticationManager getAuthenticationManager() {
- return IsisContext.getAuthenticationManager();
- }
-
-}
+
+public class IsisSessionFilter implements Filter {
+
+ /**
+ * Init parameter key to lookup implementation of {@link AuthenticationSessionLookupStrategy}.
+ */
+ public static final String AUTHENTICATION_SESSION_LOOKUP_STRATEGY_KEY = "authenticationSessionLookupStrategy";
+
+ /**
+ * Default value for {@link #AUTHENTICATION_SESSION_LOOKUP_STRATEGY_KEY} if not specified.
+ */
+ public static final String AUTHENTICATION_SESSION_LOOKUP_STRATEGY_DEFAULT =
+ AuthenticationSessionLookupStrategyDefault.class.getName();
+
+ /**
+ * Init parameter key for (typically, a logon) page to redirect to if the {@link AuthenticationSession} cannot be
+ * found or is invalid.
+ */
+ public static final String LOGON_PAGE_KEY = "logonPage";
+
+ private AuthenticationSessionLookupStrategy authSessionLookupStrategy;
+ private String redirectResourceIfNoSession;
+
+ // /////////////////////////////////////////////////////////////////
+ // init, destroy
+ // /////////////////////////////////////////////////////////////////
+
+ @Override
+ public void init(final FilterConfig config) throws ServletException {
+ lookupAuthenticationSessionLookupStrategy(config);
+ lookupRedirectIfNoSessionKey(config);
+ }
+
+ private void lookupAuthenticationSessionLookupStrategy(final FilterConfig config) {
+ String authLookupStrategyClassName = config.getInitParameter(AUTHENTICATION_SESSION_LOOKUP_STRATEGY_KEY);
+ if (authLookupStrategyClassName == null) {
+ authLookupStrategyClassName = AUTHENTICATION_SESSION_LOOKUP_STRATEGY_DEFAULT;
+ }
+ authSessionLookupStrategy =
+ (AuthenticationSessionLookupStrategy) InstanceUtil.createInstance(authLookupStrategyClassName);
+ }
+
+ private void lookupRedirectIfNoSessionKey(final FilterConfig config) {
+ redirectResourceIfNoSession = config.getInitParameter(LOGON_PAGE_KEY);
+ }
+
+ @Override
+ public void destroy() {
+ }
+
+ // /////////////////////////////////////////////////////////////////
+ // doFilter
+ // /////////////////////////////////////////////////////////////////
+
+ @Override
+ public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
+ throws IOException, ServletException {
+
+ final HttpServletRequest httpRequest = (HttpServletRequest) request;
+ final HttpServletResponse httpResponse = (HttpServletResponse) response;
+
+ // forward/redirect as required
+ final AuthenticationSession authSession = authSessionLookupStrategy.lookup(request, response);
+ if (!isValid(authSession)) {
+ if (redirectResourceIfNoSession != null
+ && !redirectResourceIfNoSession.equals(httpRequest.getServletPath())) {
+ httpResponse.sendRedirect(redirectResourceIfNoSession);
+ } else {
+ // the destination servlet is expected to know that there
+ // will be no open context
+ chain.doFilter(request, response);
+ }
+ } else {
+ // else, is authenticated so open session
+ authSessionLookupStrategy.bind(request, response, authSession);
+
+ IsisContext.openSession(authSession);
+ chain.doFilter(request, response);
+ IsisContext.closeSession();
+ }
+ }
+
+ private boolean isValid(final AuthenticationSession authSession) {
+ return authSession != null && getAuthenticationManager().isSessionValid(authSession);
+ }
+
+ // /////////////////////////////////////////////////////////////////
+ // Dependencies (from context)
+ // /////////////////////////////////////////////////////////////////
+
+ private static AuthenticationManager getAuthenticationManager() {
+ return IsisContext.getAuthenticationManager();
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/IsisWebAppBootstrapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/IsisWebAppBootstrapper.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/IsisWebAppBootstrapper.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/IsisWebAppBootstrapper.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.webapp;
import java.util.List;
@@ -26,11 +25,6 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
-import org.apache.log4j.Logger;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
import org.apache.isis.core.commons.config.IsisConfigurationBuilderPrimer;
import org.apache.isis.core.commons.config.IsisConfigurationBuilderResourceStreams;
@@ -44,31 +38,28 @@ import org.apache.isis.runtimes.dflt.run
import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
import org.apache.isis.runtimes.dflt.runtime.system.IsisSystem;
import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+import org.apache.log4j.Logger;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
/**
- * Initialize the {@link IsisSystem} when the web application starts,
- * and destroys it when it ends.
+ * Initialize the {@link IsisSystem} when the web application starts, and destroys it when it ends.
* <p>
- * Implementation note: we use a number of helper builders to keep this class as
- * small and focused as possible. The builders are available for reuse by other
- * bootstrappers.
+ * Implementation note: we use a number of helper builders to keep this class as small and focused as possible. The
+ * builders are available for reuse by other bootstrappers.
*/
public class IsisWebAppBootstrapper implements ServletContextListener {
- private static final Logger LOG = Logger
- .getLogger(IsisWebAppBootstrapper.class);
+ private static final Logger LOG = Logger.getLogger(IsisWebAppBootstrapper.class);
private final IsisLoggingConfigurer loggingConfigurer = new IsisLoggingConfigurer();
private Injector injector;
/**
- * Convenience for servlets that need to obtain the
- * {@link IsisSystem}.
+ * Convenience for servlets that need to obtain the {@link IsisSystem}.
*/
- public static IsisSystem getSystemBoundTo(
- ServletContext servletContext) {
- Object system = servletContext
- .getAttribute(WebAppConstants.ISIS_SYSTEM_KEY);
+ public static IsisSystem getSystemBoundTo(final ServletContext servletContext) {
+ final Object system = servletContext.getAttribute(WebAppConstants.ISIS_SYSTEM_KEY);
return (IsisSystem) system;
}
@@ -79,92 +70,78 @@ public class IsisWebAppBootstrapper impl
@Override
public void contextInitialized(final ServletContextEvent servletContextEvent) {
try {
- ServletContext servletContext = servletContextEvent.getServletContext();
+ final ServletContext servletContext = servletContextEvent.getServletContext();
+
+ final String webappDir = servletContext.getRealPath("/");
+ final String webInfDir = servletContext.getRealPath("/WEB-INF");
+ loggingConfigurer.configureLogging(webInfDir, new String[0]);
+
+ // will load either from WEB-INF or from the classpath.
+ final IsisConfigurationBuilder isisConfigurationBuilder =
+ new IsisConfigurationBuilderResourceStreams(new ResourceStreamSourceForWebInf(servletContext),
+ new ResourceStreamSourceContextLoaderClassPath());
- String webappDir = servletContext.getRealPath("/");
- String webInfDir = servletContext.getRealPath("/WEB-INF");
- loggingConfigurer.configureLogging(webInfDir, new String[0]);
-
- // will load either from WEB-INF or from the classpath.
- final IsisConfigurationBuilder isisConfigurationBuilder = new IsisConfigurationBuilderResourceStreams(
- new ResourceStreamSourceForWebInf(servletContext),
- new ResourceStreamSourceContextLoaderClassPath());
-
- primeConfigurationBuilder(isisConfigurationBuilder, servletContext);
-
- final DeploymentType deploymentType = determineDeploymentType(
- isisConfigurationBuilder, servletContext);
-
- addConfigurationResourcesForWebApps(isisConfigurationBuilder);
- addConfigurationResourcesForDeploymentType(isisConfigurationBuilder,
- deploymentType);
- addConfigurationResourcesForViewers(isisConfigurationBuilder,
- servletContext);
-
- isisConfigurationBuilder.add(WebAppConstants.WEB_APP_DIR, webappDir);
- isisConfigurationBuilder.add(SystemConstants.NOSPLASH_KEY, "true");
-
- InstallerLookup installerLookup = new InstallerLookupDefault(
- getClass());
-
- injector = createGuiceInjector(isisConfigurationBuilder,
- deploymentType, installerLookup);
-
- IsisSystem system = injector.getInstance(IsisSystem.class);
-
- servletContext.setAttribute(WebAppConstants.ISIS_SYSTEM_KEY,
- system);
- } catch (RuntimeException e) {
+ primeConfigurationBuilder(isisConfigurationBuilder, servletContext);
+
+ final DeploymentType deploymentType = determineDeploymentType(isisConfigurationBuilder, servletContext);
+
+ addConfigurationResourcesForWebApps(isisConfigurationBuilder);
+ addConfigurationResourcesForDeploymentType(isisConfigurationBuilder, deploymentType);
+ addConfigurationResourcesForViewers(isisConfigurationBuilder, servletContext);
+
+ isisConfigurationBuilder.add(WebAppConstants.WEB_APP_DIR, webappDir);
+ isisConfigurationBuilder.add(SystemConstants.NOSPLASH_KEY, "true");
+
+ final InstallerLookup installerLookup = new InstallerLookupDefault(getClass());
+
+ injector = createGuiceInjector(isisConfigurationBuilder, deploymentType, installerLookup);
+
+ final IsisSystem system = injector.getInstance(IsisSystem.class);
+
+ servletContext.setAttribute(WebAppConstants.ISIS_SYSTEM_KEY, system);
+ } catch (final RuntimeException e) {
LOG.error("startup failed", e);
throw e;
}
LOG.info("server started");
}
- private Injector createGuiceInjector(
- final IsisConfigurationBuilder isisConfigurationBuilder,
- final DeploymentType deploymentType, InstallerLookup installerLookup) {
- IsisModule isisModule = new IsisModule(deploymentType, isisConfigurationBuilder, installerLookup);
+ private Injector createGuiceInjector(final IsisConfigurationBuilder isisConfigurationBuilder,
+ final DeploymentType deploymentType, final InstallerLookup installerLookup) {
+ final IsisModule isisModule = new IsisModule(deploymentType, isisConfigurationBuilder, installerLookup);
return Guice.createInjector(isisModule);
}
@SuppressWarnings("unchecked")
- private void primeConfigurationBuilder(
- IsisConfigurationBuilder isisConfigurationBuilder,
- ServletContext servletContext) {
- List<IsisConfigurationBuilderPrimer> isisConfigurationBuilderPrimers = (List<IsisConfigurationBuilderPrimer>) servletContext
+ private void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder,
+ final ServletContext servletContext) {
+ final List<IsisConfigurationBuilderPrimer> isisConfigurationBuilderPrimers =
+ (List<IsisConfigurationBuilderPrimer>) servletContext
.getAttribute(WebAppConstants.CONFIGURATION_PRIMERS_KEY);
if (isisConfigurationBuilderPrimers == null) {
return;
}
- for (IsisConfigurationBuilderPrimer isisConfigurationBuilderPrimer : isisConfigurationBuilderPrimers) {
+ for (final IsisConfigurationBuilderPrimer isisConfigurationBuilderPrimer : isisConfigurationBuilderPrimers) {
isisConfigurationBuilderPrimer.primeConfigurationBuilder(isisConfigurationBuilder);
}
}
/**
- * Checks {@link IsisConfigurationBuilder configuration} for
- * {@value SystemConstants#DEPLOYMENT_TYPE_KEY},
- * (that is, from the command line), but otherwise searches in the
- * {@link ServletContext}, first for
- * {@value WebAppConstants#DEPLOYMENT_TYPE_KEY} and also
- * {@value SystemConstants#DEPLOYMENT_TYPE_KEY}.
+ * Checks {@link IsisConfigurationBuilder configuration} for {@value SystemConstants#DEPLOYMENT_TYPE_KEY}, (that is,
+ * from the command line), but otherwise searches in the {@link ServletContext}, first for
+ * {@value WebAppConstants#DEPLOYMENT_TYPE_KEY} and also {@value SystemConstants#DEPLOYMENT_TYPE_KEY}.
* <p>
- * If no setting is found, defaults to
- * {@value WebAppConstants#DEPLOYMENT_TYPE_DEFAULT}.
+ * If no setting is found, defaults to {@value WebAppConstants#DEPLOYMENT_TYPE_DEFAULT}.
*/
- private DeploymentType determineDeploymentType(
- IsisConfigurationBuilder isisConfigurationBuilder,
- final ServletContext servletContext) {
- String deploymentTypeStr = isisConfigurationBuilder.getConfiguration()
- .getString(SystemConstants.DEPLOYMENT_TYPE_KEY);
+ private DeploymentType determineDeploymentType(final IsisConfigurationBuilder isisConfigurationBuilder,
+ final ServletContext servletContext) {
+ String deploymentTypeStr =
+ isisConfigurationBuilder.getConfiguration().getString(SystemConstants.DEPLOYMENT_TYPE_KEY);
if (deploymentTypeStr == null) {
- deploymentTypeStr = servletContext
- .getInitParameter(WebAppConstants.DEPLOYMENT_TYPE_KEY);
+ deploymentTypeStr = servletContext.getInitParameter(WebAppConstants.DEPLOYMENT_TYPE_KEY);
}
if (deploymentTypeStr == null) {
- deploymentTypeStr = servletContext
- .getInitParameter(SystemConstants.DEPLOYMENT_TYPE_KEY);
+ deploymentTypeStr = servletContext.getInitParameter(SystemConstants.DEPLOYMENT_TYPE_KEY);
}
if (deploymentTypeStr == null) {
deploymentTypeStr = WebAppConstants.DEPLOYMENT_TYPE_DEFAULT;
@@ -172,26 +149,21 @@ public class IsisWebAppBootstrapper impl
return DeploymentType.lookup(deploymentTypeStr);
}
- private void addConfigurationResourcesForDeploymentType(
- final IsisConfigurationBuilder configurationLoader,
- final DeploymentType deploymentType) {
- String type = deploymentType.name().toLowerCase();
- configurationLoader.addConfigurationResource(type + ".properties",
- NotFoundPolicy.CONTINUE);
+ private void addConfigurationResourcesForDeploymentType(final IsisConfigurationBuilder configurationLoader,
+ final DeploymentType deploymentType) {
+ final String type = deploymentType.name().toLowerCase();
+ configurationLoader.addConfigurationResource(type + ".properties", NotFoundPolicy.CONTINUE);
}
- private void addConfigurationResourcesForWebApps(
- final IsisConfigurationBuilder configurationLoader) {
- for (String config : (new String[] { "web.properties", "war.properties" })) {
+ private void addConfigurationResourcesForWebApps(final IsisConfigurationBuilder configurationLoader) {
+ for (final String config : (new String[] { "web.properties", "war.properties" })) {
if (config != null) {
- configurationLoader.addConfigurationResource(config,
- NotFoundPolicy.CONTINUE);
+ configurationLoader.addConfigurationResource(config, NotFoundPolicy.CONTINUE);
}
}
}
- private void addConfigurationResourcesForViewers(
- final IsisConfigurationBuilder configurationLoader,
+ private void addConfigurationResourcesForViewers(final IsisConfigurationBuilder configurationLoader,
final ServletContext servletContext) {
addConfigurationResourcesForContextParam(configurationLoader, servletContext, "isis.viewers");
addConfigurationResourcesForContextParam(configurationLoader, servletContext, "isis.viewer");
@@ -200,16 +172,14 @@ public class IsisWebAppBootstrapper impl
private void addConfigurationResourcesForContextParam(final IsisConfigurationBuilder configurationLoader,
final ServletContext servletContext, final String name) {
final String viewers = servletContext.getInitParameter(name);
- if(viewers==null) {
+ if (viewers == null) {
return;
}
- for (String viewer : viewers.split(",")) {
- configurationLoader.addConfigurationResource("viewer_" + viewer + ".properties",
- NotFoundPolicy.CONTINUE);
+ for (final String viewer : viewers.split(",")) {
+ configurationLoader.addConfigurationResource("viewer_" + viewer + ".properties", NotFoundPolicy.CONTINUE);
}
}
-
// /////////////////////////////////////////////////////
// Destroy
// /////////////////////////////////////////////////////
@@ -217,21 +187,18 @@ public class IsisWebAppBootstrapper impl
@Override
public void contextDestroyed(final ServletContextEvent ev) {
LOG.info("server shutting down");
- ServletContext servletContext = ev.getServletContext();
+ final ServletContext servletContext = ev.getServletContext();
try {
- final IsisSystem system = (IsisSystem) servletContext
- .getAttribute(WebAppConstants.ISIS_SYSTEM_KEY);
+ final IsisSystem system = (IsisSystem) servletContext.getAttribute(WebAppConstants.ISIS_SYSTEM_KEY);
if (system != null) {
LOG.info("calling system shutdown");
system.shutdown();
}
} finally {
- servletContext
- .removeAttribute(WebAppConstants.ISIS_SYSTEM_KEY);
+ servletContext.removeAttribute(WebAppConstants.ISIS_SYSTEM_KEY);
LOG.info("server shut down");
}
}
}
-
Modified: incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/WebAppConstants.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/WebAppConstants.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/WebAppConstants.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/WebAppConstants.java Tue May 3 06:22:09 2011
@@ -17,66 +17,57 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.webapp;
-package org.apache.isis.runtimes.dflt.webapp;
-
import org.apache.isis.applib.fixtures.LogonFixture;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.commons.config.IsisConfigurationBuilderPrimer;
import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
import org.apache.isis.runtimes.dflt.runtime.system.IsisSystem;
-
-public final class WebAppConstants {
-
- /**
- * Name of context-param (<tt>ServletContext#getInitParameter(String)</tt>)
- * to specify the deployment type.
- */
- public static final String DEPLOYMENT_TYPE_KEY = "deploymentType";
- /**
- * Deployment type to use if there is none {@link DEPLOYMENT_TYPE_KEY specified}.
- */
- public static final String DEPLOYMENT_TYPE_DEFAULT = DeploymentType.SERVER.name();
-
-
-
- /**
- * Key under which the list of {@link IsisConfigurationBuilderPrimer}s is bound as a
- * servlet context attribute (<tt>ServletContext#getAttribute(String)</tt>); used to pass
- * from the <tt>webserver</tt> module to this.
- */
- public static final String CONFIGURATION_PRIMERS_KEY = "isis.configurationPrimers";
-
- /**
- * Key under which the {@link IsisSystem} is bound as a
- * servlet context attribute (<tt>ServletContext#getAttribute(String)</tt>).
- */
- public final static String ISIS_SYSTEM_KEY = WebAppConstants.class
- .getPackage().getName()
- + ".isisSystem";
-
-
- /**
- * Key under which the {@link AuthenticationSession} is bound as a
- * session attribute (<tt>HttpSession#getAttribute(String)</tt>).
- */
- public final static String HTTP_SESSION_AUTHENTICATION_SESSION_KEY = WebAppConstants.class
- .getPackage().getName()
- + ".authenticationSession";
-
- /**
- * Key used to determine if a logon has already been performed implicitly using the
- * {@link LogonFixture}, meaning that a Logout should be followed by the Logon page.
- */
- public final static String HTTP_SESSION_LOGGED_ON_PREVIOUSLY_USING_LOGON_FIXTURE_KEY = WebAppConstants.class
- .getPackage().getName()
- + ".loggedOnPreviouslyUsingLogonFixture";
-
- /**
- * Property name given to the web app directory.
- */
- public static final String WEB_APP_DIR = "application.webapp.dir";
-
- private WebAppConstants(){}
-
-}
+
+public final class WebAppConstants {
+
+ /**
+ * Name of context-param (<tt>ServletContext#getInitParameter(String)</tt>) to specify the deployment type.
+ */
+ public static final String DEPLOYMENT_TYPE_KEY = "deploymentType";
+ /**
+ * Deployment type to use if there is none {@link DEPLOYMENT_TYPE_KEY specified}.
+ */
+ public static final String DEPLOYMENT_TYPE_DEFAULT = DeploymentType.SERVER.name();
+
+ /**
+ * Key under which the list of {@link IsisConfigurationBuilderPrimer}s is bound as a servlet context attribute (
+ * <tt>ServletContext#getAttribute(String)</tt>); used to pass from the <tt>webserver</tt> module to this.
+ */
+ public static final String CONFIGURATION_PRIMERS_KEY = "isis.configurationPrimers";
+
+ /**
+ * Key under which the {@link IsisSystem} is bound as a servlet context attribute (
+ * <tt>ServletContext#getAttribute(String)</tt>).
+ */
+ public final static String ISIS_SYSTEM_KEY = WebAppConstants.class.getPackage().getName() + ".isisSystem";
+
+ /**
+ * Key under which the {@link AuthenticationSession} is bound as a session attribute (
+ * <tt>HttpSession#getAttribute(String)</tt>).
+ */
+ public final static String HTTP_SESSION_AUTHENTICATION_SESSION_KEY = WebAppConstants.class.getPackage().getName()
+ + ".authenticationSession";
+
+ /**
+ * Key used to determine if a logon has already been performed implicitly using the {@link LogonFixture}, meaning
+ * that a Logout should be followed by the Logon page.
+ */
+ public final static String HTTP_SESSION_LOGGED_ON_PREVIOUSLY_USING_LOGON_FIXTURE_KEY = WebAppConstants.class
+ .getPackage().getName() + ".loggedOnPreviouslyUsingLogonFixture";
+
+ /**
+ * Property name given to the web app directory.
+ */
+ public static final String WEB_APP_DIR = "application.webapp.dir";
+
+ private WebAppConstants() {
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategy.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategy.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategy.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategy.java Tue May 3 06:22:09 2011
@@ -17,22 +17,20 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.webapp.auth;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
-package org.apache.isis.runtimes.dflt.webapp.auth;
-
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.runtimes.dflt.webapp.IsisSessionFilter;
-
-/**
- * Decouples the {@link IsisSessionFilter} from the mechanism of obtaining
- * the {@link AuthenticationSession}.
- */
-public interface AuthenticationSessionLookupStrategy {
-
- AuthenticationSession lookup(ServletRequest servletRequest, ServletResponse servletResponse);
-
- void bind(ServletRequest servletRequest, ServletResponse servletResponse, AuthenticationSession authSession);
-}
+
+/**
+ * Decouples the {@link IsisSessionFilter} from the mechanism of obtaining the {@link AuthenticationSession}.
+ */
+public interface AuthenticationSessionLookupStrategy {
+
+ AuthenticationSession lookup(ServletRequest servletRequest, ServletResponse servletResponse);
+
+ void bind(ServletRequest servletRequest, ServletResponse servletResponse, AuthenticationSession authSession);
+}
Modified: incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategyAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategyAbstract.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategyAbstract.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategyAbstract.java Tue May 3 06:22:09 2011
@@ -17,31 +17,23 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.webapp.auth;
-package org.apache.isis.runtimes.dflt.webapp.auth;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.apache.isis.applib.fixtures.LogonFixture;
-import org.apache.isis.runtimes.dflt.runtime.fixtures.authentication.AuthenticationRequestLogonFixture;
-import org.apache.isis.runtimes.dflt.runtime.system.IsisSystem;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.webapp.WebAppConstants;
-
-public abstract class AuthenticationSessionLookupStrategyAbstract implements
- AuthenticationSessionLookupStrategy {
-
- protected HttpSession getHttpSession(ServletRequest servletRequest) {
- HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
- return httpServletRequest.getSession();
- }
-
- protected ServletContext getServletContext(ServletRequest servletRequest) {
- HttpSession httpSession = getHttpSession(servletRequest);
- return httpSession.getServletContext();
- }
-
-}
+import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+public abstract class AuthenticationSessionLookupStrategyAbstract implements AuthenticationSessionLookupStrategy {
+
+ protected HttpSession getHttpSession(final ServletRequest servletRequest) {
+ final HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
+ return httpServletRequest.getSession();
+ }
+
+ protected ServletContext getServletContext(final ServletRequest servletRequest) {
+ final HttpSession httpSession = getHttpSession(servletRequest);
+ return httpSession.getServletContext();
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategyDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategyDefault.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategyDefault.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/auth/AuthenticationSessionLookupStrategyDefault.java Tue May 3 06:22:09 2011
@@ -47,27 +47,27 @@ import org.apache.isis.runtimes.dflt.web
public class AuthenticationSessionLookupStrategyDefault extends AuthenticationSessionLookupStrategyAbstract {
@Override
- public AuthenticationSession lookup(ServletRequest servletRequest, ServletResponse servletResponse) {
+ public AuthenticationSession lookup(final ServletRequest servletRequest, final ServletResponse servletResponse) {
// use previously authenticated session if available.
- HttpSession httpSession = getHttpSession(servletRequest);
+ final HttpSession httpSession = getHttpSession(servletRequest);
AuthenticationSession authSession =
(AuthenticationSession) httpSession.getAttribute(WebAppConstants.HTTP_SESSION_AUTHENTICATION_SESSION_KEY);
if (authSession != null) {
- boolean sessionValid = getAuthenticationManager().isSessionValid(authSession);
+ final boolean sessionValid = getAuthenticationManager().isSessionValid(authSession);
if (sessionValid) {
return authSession;
}
}
// otherwise, look for LogonFixture and try to authenticate
- ServletContext servletContext = getServletContext(servletRequest);
- IsisSystem system = (IsisSystem) servletContext.getAttribute(WebAppConstants.ISIS_SYSTEM_KEY);
+ final ServletContext servletContext = getServletContext(servletRequest);
+ final IsisSystem system = (IsisSystem) servletContext.getAttribute(WebAppConstants.ISIS_SYSTEM_KEY);
if (system == null) {
// not expected to happen...
return null;
}
- LogonFixture logonFixture = system.getLogonFixture();
+ final LogonFixture logonFixture = system.getLogonFixture();
// see if exploration is supported
if (system.getDeploymentType().isExploring()) {
@@ -77,7 +77,7 @@ public class AuthenticationSessionLookup
}
}
- boolean loggedInUsingLogonFixture =
+ final boolean loggedInUsingLogonFixture =
httpSession.getAttribute(WebAppConstants.HTTP_SESSION_LOGGED_ON_PREVIOUSLY_USING_LOGON_FIXTURE_KEY) != null;
if (logonFixture != null && !loggedInUsingLogonFixture) {
httpSession.setAttribute(WebAppConstants.HTTP_SESSION_LOGGED_ON_PREVIOUSLY_USING_LOGON_FIXTURE_KEY, true);
@@ -88,8 +88,9 @@ public class AuthenticationSessionLookup
}
@Override
- public void bind(ServletRequest servletRequest, ServletResponse servletResponse, AuthenticationSession authSession) {
- HttpSession httpSession = getHttpSession(servletRequest);
+ public void bind(final ServletRequest servletRequest, final ServletResponse servletResponse,
+ final AuthenticationSession authSession) {
+ final HttpSession httpSession = getHttpSession(servletRequest);
httpSession.setAttribute(WebAppConstants.HTTP_SESSION_AUTHENTICATION_SESSION_KEY, authSession);
}
Modified: incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/monitor/MonitorServlet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/monitor/MonitorServlet.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/monitor/MonitorServlet.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/monitor/MonitorServlet.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.webapp.monitor;
import java.io.IOException;
@@ -33,14 +32,13 @@ import javax.servlet.http.HttpServletRes
import org.apache.isis.runtimes.dflt.monitoring.servermonitor.MonitorListenerImpl;
-
public class MonitorServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private MonitorListenerImpl monitor;
@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException,
- IOException {
+ IOException {
final String queryString = request.getQueryString();
final String query = queryString == null ? "Overview" : URLDecoder.decode(queryString, "UTF-8");
response.setContentType("text/html");
@@ -63,29 +61,20 @@ public class MonitorServlet extends Http
private static String listSessions() {
final StringBuffer str = new StringBuffer();
/*
- final Iterator<?> it = SessionAccess.getSessions().iterator();
- while (it.hasNext()) {
- final HttpSession session = (HttpSession) it.next();
- final String id = session.getId();
- str.append(id);
- str.append(" \t");
-
- final long creationTime = session.getCreationTime();
- str.append(new Date(creationTime));
- str.append(" \t");
-
- final long lastAccessedTime = session.getLastAccessedTime();
- str.append(new Date(lastAccessedTime));
- str.append(" \t");
-
- final AuthenticationSession nofSession = (AuthenticationSession) session.getAttribute("NOF_SESSION_ATTRIBUTE");
- if (nofSession != null) {
- str.append(nofSession.getUserName());
- }
-
- str.append("\n");
- }
- */
+ * final Iterator<?> it = SessionAccess.getSessions().iterator(); while (it.hasNext()) { final HttpSession
+ * session = (HttpSession) it.next(); final String id = session.getId(); str.append(id); str.append(" \t");
+ *
+ * final long creationTime = session.getCreationTime(); str.append(new Date(creationTime)); str.append(" \t");
+ *
+ * final long lastAccessedTime = session.getLastAccessedTime(); str.append(new Date(lastAccessedTime));
+ * str.append(" \t");
+ *
+ * final AuthenticationSession nofSession = (AuthenticationSession)
+ * session.getAttribute("NOF_SESSION_ATTRIBUTE"); if (nofSession != null) {
+ * str.append(nofSession.getUserName()); }
+ *
+ * str.append("\n"); }
+ */
return str.toString();
}
@@ -95,4 +84,3 @@ public class MonitorServlet extends Http
monitor = new MonitorListenerImpl();
}
}
-
Modified: incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/monitor/WebServerMonitorInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/monitor/WebServerMonitorInstaller.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/monitor/WebServerMonitorInstaller.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webapp/src/main/java/org/apache/isis/runtimes/dflt/webapp/monitor/WebServerMonitorInstaller.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.webapp.monitor;
import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.IsisViewerInstallerAbstract;
@@ -25,19 +24,18 @@ import org.apache.isis.runtimes.dflt.run
import org.apache.isis.runtimes.dflt.runtime.viewer.web.WebAppSpecification;
import org.apache.isis.runtimes.dflt.runtime.web.EmbeddedWebViewer;
-
public class WebServerMonitorInstaller extends IsisViewerInstallerAbstract {
- public WebServerMonitorInstaller() {
- super("web-monitor");
- }
+ public WebServerMonitorInstaller() {
+ super("web-monitor");
+ }
@Override
public IsisViewer doCreateViewer() {
return new EmbeddedWebViewer() {
- @Override
+ @Override
public WebAppSpecification getWebAppSpecification() {
- WebAppSpecification requirements = new WebAppSpecification();
+ final WebAppSpecification requirements = new WebAppSpecification();
requirements.addServletSpecification(MonitorServlet.class, "/monitor/*");
return requirements;
}
@@ -45,5 +43,3 @@ public class WebServerMonitorInstaller e
}
}
-
-
Modified: incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/WebServer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/WebServer.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/WebServer.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/WebServer.java Tue May 3 06:22:09 2011
@@ -17,14 +17,12 @@
* under the License.
*/
+package org.apache.isis;
-package org.apache.isis;
-
-public class WebServer {
-
- public static void main(String[] args) {
- org.apache.isis.runtimes.dflt.webserver.WebServer.main(args);
- }
-
-
-}
+public class WebServer {
+
+ public static void main(final String[] args) {
+ org.apache.isis.runtimes.dflt.webserver.WebServer.main(args);
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServer.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServer.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServer.java Tue May 3 06:22:09 2011
@@ -17,38 +17,34 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.webserver;
-package org.apache.isis.runtimes.dflt.webserver;
-
-
-
import org.apache.isis.core.commons.lang.ArrayUtils;
import org.apache.isis.runtimes.dflt.runtime.runner.IsisRunner;
import org.apache.isis.runtimes.dflt.webserver.internal.OptionHandlerAddress;
import org.apache.isis.runtimes.dflt.webserver.internal.OptionHandlerDeploymentTypeWebServer;
import org.apache.isis.runtimes.dflt.webserver.internal.OptionHandlerPort;
import org.apache.isis.runtimes.dflt.webserver.internal.OptionHandlerResourceBase;
-
-
-public class WebServer {
-
- public static void main(String[] args) {
- new WebServer().run(ArrayUtils.append(args, "--nosplash"));
- }
-
- public void run(final String[] args) {
- final IsisRunner runner = new IsisRunner(args, new OptionHandlerDeploymentTypeWebServer());
-
- // adjustments
- runner.addOptionHandler(new OptionHandlerPort());
- runner.addOptionHandler(new OptionHandlerAddress());
- runner.addOptionHandler(new OptionHandlerResourceBase());
-
- if (!runner.parseAndValidate()) {
- return;
- }
-
- runner.bootstrap(new WebServerBootstrapper(runner));
- }
-
-}
+
+public class WebServer {
+
+ public static void main(final String[] args) {
+ new WebServer().run(ArrayUtils.append(args, "--nosplash"));
+ }
+
+ public void run(final String[] args) {
+ final IsisRunner runner = new IsisRunner(args, new OptionHandlerDeploymentTypeWebServer());
+
+ // adjustments
+ runner.addOptionHandler(new OptionHandlerPort());
+ runner.addOptionHandler(new OptionHandlerAddress());
+ runner.addOptionHandler(new OptionHandlerResourceBase());
+
+ if (!runner.parseAndValidate()) {
+ return;
+ }
+
+ runner.bootstrap(new WebServerBootstrapper(runner));
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerBootstrapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerBootstrapper.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerBootstrapper.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerBootstrapper.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.webserver;
import static org.apache.isis.runtimes.dflt.webserver.WebServerConstants.EMBEDDED_WEB_SERVER_PORT_DEFAULT;
@@ -29,45 +28,44 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.webapp.WebAppContext;
-
+import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
import org.apache.isis.core.commons.config.IsisConfigurationBuilderPrimer;
-import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.commons.exceptions.IsisException;
import org.apache.isis.core.commons.lang.CastUtils;
import org.apache.isis.runtimes.dflt.runtime.runner.IsisBootstrapper;
import org.apache.isis.runtimes.dflt.runtime.runner.IsisRunner;
import org.apache.isis.runtimes.dflt.webapp.WebAppConstants;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.webapp.WebAppContext;
import com.google.inject.Injector;
-final class WebServerBootstrapper implements
- IsisBootstrapper {
+final class WebServerBootstrapper implements IsisBootstrapper {
private static final String SRC_MAIN_WEBAPP = "src/main/webapp";
private final IsisRunner runner;
- WebServerBootstrapper(IsisRunner runner) {
+ WebServerBootstrapper(final IsisRunner runner) {
this.runner = runner;
}
/**
* ignores the arguments and just bootstraps JettyViewer, come what may.
*/
- public void bootstrap(Injector injector) {
+ @Override
+ public void bootstrap(final Injector injector) {
- IsisConfigurationBuilder isisConfigurationBuilder = injector.getInstance(IsisConfigurationBuilder.class);
+ final IsisConfigurationBuilder isisConfigurationBuilder = injector.getInstance(IsisConfigurationBuilder.class);
// we don't actually bootstrap the system here; instead we expect it to be bootstrapped
// from the ServletContextInitializer in the web.xml
- IsisConfiguration configuration = isisConfigurationBuilder.getConfiguration();
- int port = configuration.getInteger(EMBEDDED_WEB_SERVER_PORT_KEY, EMBEDDED_WEB_SERVER_PORT_DEFAULT);
- String webappContextPath = configuration.getString(EMBEDDED_WEB_SERVER_RESOURCE_BASE_KEY,
- EMBEDDED_WEB_SERVER_RESOURCE_BASE_DEFAULT);
+ final IsisConfiguration configuration = isisConfigurationBuilder.getConfiguration();
+ final int port = configuration.getInteger(EMBEDDED_WEB_SERVER_PORT_KEY, EMBEDDED_WEB_SERVER_PORT_DEFAULT);
+ final String webappContextPath =
+ configuration.getString(EMBEDDED_WEB_SERVER_RESOURCE_BASE_KEY, EMBEDDED_WEB_SERVER_RESOURCE_BASE_DEFAULT);
- Server server = new Server(port);
- WebAppContext context = new WebAppContext(SRC_MAIN_WEBAPP, webappContextPath);
+ final Server server = new Server(port);
+ final WebAppContext context = new WebAppContext(SRC_MAIN_WEBAPP, webappContextPath);
copyConfigurationPrimersIntoServletContext(context);
@@ -75,23 +73,25 @@ final class WebServerBootstrapper implem
try {
server.start();
server.join();
- } catch (Exception ex) {
+ } catch (final Exception ex) {
throw new IsisException("Unable to start Jetty server", ex);
}
}
/**
- * Bound to the {@link WebAppContext} so that they can be used when bootstrapping.
+ * Bound to the {@link WebAppContext} so that they can be used when bootstrapping.
+ *
* @param context
*/
@SuppressWarnings("unchecked")
- private void copyConfigurationPrimersIntoServletContext(WebAppContext context) {
- List<IsisConfigurationBuilderPrimer> isisConfigurationBuilderPrimers = (List<IsisConfigurationBuilderPrimer>) (List<?>) runner.getOptionHandlers();
+ private void copyConfigurationPrimersIntoServletContext(final WebAppContext context) {
+ final List<IsisConfigurationBuilderPrimer> isisConfigurationBuilderPrimers =
+ (List<IsisConfigurationBuilderPrimer>) (List<?>) runner.getOptionHandlers();
context.setAttribute(WebAppConstants.CONFIGURATION_PRIMERS_KEY, isisConfigurationBuilderPrimers);
}
@SuppressWarnings("unused")
- private void copyDeploymentTypeIntoInitParams(WebAppContext context) {
+ private void copyDeploymentTypeIntoInitParams(final WebAppContext context) {
Map<String, String> initParams = CastUtils.cast(context.getInitParams());
initParams = new HashMap<String, String>(initParams);
context.setInitParams(initParams);
Modified: incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerConstants.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerConstants.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerConstants.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerConstants.java Tue May 3 06:22:09 2011
@@ -17,26 +17,25 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.webserver;
-package org.apache.isis.runtimes.dflt.webserver;
-
import org.apache.isis.core.commons.config.ConfigurationConstants;
import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.EmbeddedWebServerInstaller;
-
-
-public final class WebServerConstants {
-
- private static final String ROOT = ConfigurationConstants.ROOT + EmbeddedWebServerInstaller.TYPE + ".";
-
- public static final String EMBEDDED_WEB_SERVER_PORT_KEY = ROOT + "port";
- public static final int EMBEDDED_WEB_SERVER_PORT_DEFAULT = 8080;
-
- public static final String EMBEDDED_WEB_SERVER_ADDRESS_KEY = ROOT + "address";
- public static final String EMBEDDED_WEB_SERVER_ADDRESS_DEFAULT = "localhost";
-
- public static final String EMBEDDED_WEB_SERVER_RESOURCE_BASE_KEY = ROOT + "webapp";
- public static final String EMBEDDED_WEB_SERVER_RESOURCE_BASE_DEFAULT = ""; // or "webapp" ??
-
- private WebServerConstants() {}
-
-}
+
+public final class WebServerConstants {
+
+ private static final String ROOT = ConfigurationConstants.ROOT + EmbeddedWebServerInstaller.TYPE + ".";
+
+ public static final String EMBEDDED_WEB_SERVER_PORT_KEY = ROOT + "port";
+ public static final int EMBEDDED_WEB_SERVER_PORT_DEFAULT = 8080;
+
+ public static final String EMBEDDED_WEB_SERVER_ADDRESS_KEY = ROOT + "address";
+ public static final String EMBEDDED_WEB_SERVER_ADDRESS_DEFAULT = "localhost";
+
+ public static final String EMBEDDED_WEB_SERVER_RESOURCE_BASE_KEY = ROOT + "webapp";
+ public static final String EMBEDDED_WEB_SERVER_RESOURCE_BASE_DEFAULT = ""; // or "webapp" ??
+
+ private WebServerConstants() {
+ }
+
+}
Modified: incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerException.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerException.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/WebServerException.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.webserver;
public class WebServerException extends RuntimeException {
@@ -29,4 +28,3 @@ public class WebServerException extends
}
}
-
Modified: incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/embedded/jetty/EmbeddedWebServerJetty.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/embedded/jetty/EmbeddedWebServerJetty.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/embedded/jetty/EmbeddedWebServerJetty.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/embedded/jetty/EmbeddedWebServerJetty.java Tue May 3 06:22:09 2011
@@ -17,14 +17,19 @@
* under the License.
*/
-
-
package org.apache.isis.runtimes.dflt.webserver.embedded.jetty;
import java.util.List;
import javax.servlet.ServletContextListener;
+import org.apache.isis.core.commons.factory.InstanceUtil;
+import org.apache.isis.runtimes.dflt.runtime.viewer.web.FilterSpecification;
+import org.apache.isis.runtimes.dflt.runtime.viewer.web.ServletSpecification;
+import org.apache.isis.runtimes.dflt.runtime.viewer.web.WebAppSpecification;
+import org.apache.isis.runtimes.dflt.runtime.web.EmbeddedWebServerAbstract;
+import org.apache.isis.runtimes.dflt.webserver.WebServerConstants;
+import org.apache.isis.runtimes.dflt.webserver.WebServerException;
import org.apache.log4j.Logger;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.NCSARequestLog;
@@ -39,14 +44,6 @@ import org.mortbay.jetty.servlet.Servlet
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.servlet.ServletMapping;
import org.mortbay.jetty.servlet.SessionHandler;
-import org.apache.isis.core.commons.factory.InstanceUtil;
-import org.apache.isis.runtimes.dflt.runtime.viewer.web.FilterSpecification;
-import org.apache.isis.runtimes.dflt.runtime.viewer.web.ServletSpecification;
-import org.apache.isis.runtimes.dflt.runtime.viewer.web.WebAppSpecification;
-import org.apache.isis.runtimes.dflt.runtime.web.EmbeddedWebServerAbstract;
-import org.apache.isis.runtimes.dflt.webserver.WebServerConstants;
-import org.apache.isis.runtimes.dflt.webserver.WebServerException;
-
public class EmbeddedWebServerJetty extends EmbeddedWebServerAbstract {
private final static Logger LOG = Logger.getLogger(EmbeddedWebServerJetty.class);
@@ -55,6 +52,7 @@ public class EmbeddedWebServerJetty exte
// init, shutdown
// ///////////////////////////////////////////////////////
+ @Override
public void init() {
super.init();
@@ -62,10 +60,6 @@ public class EmbeddedWebServerJetty exte
final ContextHandler contextHandler = createContextHandler(handlers);
-
-
-
-
startServer(contextHandler);
}
@@ -85,9 +79,9 @@ public class EmbeddedWebServerJetty exte
// handlers.addHandler(new DefaultHandler());
// TODO use properties to set up
- RequestLogHandler requestLogHandler = new RequestLogHandler();
+ final RequestLogHandler requestLogHandler = new RequestLogHandler();
handlers.addHandler(requestLogHandler);
- NCSARequestLog requestLog = new NCSARequestLog("./logs/jetty-yyyy_mm_dd.request.log");
+ final NCSARequestLog requestLog = new NCSARequestLog("./logs/jetty-yyyy_mm_dd.request.log");
requestLog.setRetainDays(90);
requestLog.setAppend(true);
requestLog.setExtended(false);
@@ -101,16 +95,16 @@ public class EmbeddedWebServerJetty exte
* TODO: the welcome files don't seem to be picked up.
*
* <p>
- * not sure if meant to add welcome files here or at the context handler level, in fact, doesn't seem to
- * work even when register in both...
+ * not sure if meant to add welcome files here or at the context handler level, in fact, doesn't seem to work even
+ * when register in both...
*
* @see #setWelcomeFiles(ContextHandler)
*/
private void addResourcesAndWelcomeFiles(final HandlerList handlers) {
- for (WebAppSpecification specification : getSpecifications()) {
- List<String> files = specification.getWelcomeFiles();
- String[] welcomeFiles = files.toArray(new String[files.size()]);
- for (String resourcePath : specification.getResourcePaths()) {
+ for (final WebAppSpecification specification : getSpecifications()) {
+ final List<String> files = specification.getWelcomeFiles();
+ final String[] welcomeFiles = files.toArray(new String[files.size()]);
+ for (final String resourcePath : specification.getResourcePaths()) {
final ResourceHandler resourceHandler = new ResourceHandler();
resourceHandler.setResourceBase(resourcePath);
resourceHandler.setWelcomeFiles(welcomeFiles);
@@ -120,20 +114,20 @@ public class EmbeddedWebServerJetty exte
}
private void addServletsAndFilters(final ServletHandler servletHandler) {
- for (WebAppSpecification requirement : getSpecifications()) {
+ for (final WebAppSpecification requirement : getSpecifications()) {
addServletMappings(servletHandler, requirement);
addFilterMappings(servletHandler, requirement);
}
}
private void addServletMappings(final ServletHandler servletHandler, final WebAppSpecification webAppSpec) {
- for (ServletSpecification servletSpec : webAppSpec.getServletSpecifications()) {
+ for (final ServletSpecification servletSpec : webAppSpec.getServletSpecifications()) {
- ServletHolder servletHolder = new ServletHolder(servletSpec.getServletClass());
+ final ServletHolder servletHolder = new ServletHolder(servletSpec.getServletClass());
servletHolder.setInitParameters(servletSpec.getInitParams());
servletHandler.addServlet(servletHolder);
- ServletMapping servletMapping = new ServletMapping();
+ final ServletMapping servletMapping = new ServletMapping();
servletMapping.setServletName(servletHolder.getName());
servletMapping.setPathSpecs(servletSpec.getPathSpecs().toArray(new String[] {}));
@@ -142,13 +136,13 @@ public class EmbeddedWebServerJetty exte
}
private void addFilterMappings(final ServletHandler servletHandler, final WebAppSpecification webAppSpec) {
- for (FilterSpecification filterSpec : webAppSpec.getFilterSpecifications()) {
+ for (final FilterSpecification filterSpec : webAppSpec.getFilterSpecifications()) {
- FilterHolder filterHolder = new FilterHolder(filterSpec.getFilterClass());
+ final FilterHolder filterHolder = new FilterHolder(filterSpec.getFilterClass());
filterHolder.setInitParameters(filterSpec.getInitParams());
servletHandler.addFilter(filterHolder);
- FilterMapping filterMapping = new FilterMapping();
+ final FilterMapping filterMapping = new FilterMapping();
filterMapping.setFilterName(filterHolder.getName());
filterMapping.setPathSpecs(filterSpec.getPathSpecs().toArray(new String[] {}));
filterMapping.setDispatches(Handler.DEFAULT);
@@ -172,16 +166,16 @@ public class EmbeddedWebServerJetty exte
}
private void addContextParams(final ContextHandler contextHandler) {
- for (WebAppSpecification specification : getSpecifications()) {
+ for (final WebAppSpecification specification : getSpecifications()) {
contextHandler.setInitParams(specification.getContextParams());
}
}
private void addServletContextListeners(final ContextHandler contextHandler) {
- for (WebAppSpecification specification : getSpecifications()) {
- for (Class<?> servletContextListenerClass : specification.getServletContextListeners()) {
- ServletContextListener servletContext = (ServletContextListener) InstanceUtil
- .createInstance(servletContextListenerClass);
+ for (final WebAppSpecification specification : getSpecifications()) {
+ for (final Class<?> servletContextListenerClass : specification.getServletContextListeners()) {
+ final ServletContextListener servletContext =
+ (ServletContextListener) InstanceUtil.createInstance(servletContextListenerClass);
contextHandler.addEventListener(servletContext);
}
}
@@ -191,24 +185,25 @@ public class EmbeddedWebServerJetty exte
* TODO: this doesn't seem to be being picked up
*
* <p>
- * not sure if meant to add welcome files here or at the resource base level, in fact, doesn't seem to
- * work even when register in both...
+ * not sure if meant to add welcome files here or at the resource base level, in fact, doesn't seem to work even
+ * when register in both...
*
* @see #addResourcesAndWelcomeFiles(HandlerList)
*/
private void setWelcomeFiles(final ContextHandler contextHandler) {
- for (WebAppSpecification specification : getSpecifications()) {
+ for (final WebAppSpecification specification : getSpecifications()) {
contextHandler.setWelcomeFiles(specification.getWelcomeFiles().toArray(new String[] {}));
}
}
private void startServer(final ContextHandler contextHandler) {
- final int port = getConfiguration().getInteger(WebServerConstants.EMBEDDED_WEB_SERVER_PORT_KEY,
+ final int port =
+ getConfiguration().getInteger(WebServerConstants.EMBEDDED_WEB_SERVER_PORT_KEY,
WebServerConstants.EMBEDDED_WEB_SERVER_PORT_DEFAULT);
if (LOG.isInfoEnabled()) {
LOG.info("Starting web server on http://localhost:" + port);
- for (WebAppSpecification specification : getSpecifications()) {
- String logHint = specification.getLogHint();
+ for (final WebAppSpecification specification : getSpecifications()) {
+ final String logHint = specification.getLogHint();
if (logHint != null) {
LOG.info(logHint);
}
@@ -225,8 +220,9 @@ public class EmbeddedWebServerJetty exte
}
}
+ @Override
public void shutdown() {
- // does nothing
+ // does nothing
}
}
Modified: incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/embedded/jetty/JettyEmbeddedWebServerInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/embedded/jetty/JettyEmbeddedWebServerInstaller.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/embedded/jetty/JettyEmbeddedWebServerInstaller.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/embedded/jetty/JettyEmbeddedWebServerInstaller.java Tue May 3 06:22:09 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.runtimes.dflt.webserver.embedded.jetty;
import java.util.List;
@@ -29,22 +28,22 @@ import org.apache.isis.runtimes.dflt.run
import org.apache.isis.runtimes.dflt.runtime.web.EmbeddedWebViewer;
/**
- * Not to be confused with {@link IsisViewerInstaller}, this installer
- * is for a component to <i>host</i> any {@link EmbeddedWebViewer} implementations.
+ * Not to be confused with {@link IsisViewerInstaller}, this installer is for a component to <i>host</i> any
+ * {@link EmbeddedWebViewer} implementations.
*/
public class JettyEmbeddedWebServerInstaller extends InstallerAbstract implements EmbeddedWebServerInstaller {
public JettyEmbeddedWebServerInstaller() {
- super(EmbeddedWebServerInstaller.TYPE, "jetty");
- }
+ super(EmbeddedWebServerInstaller.TYPE, "jetty");
+ }
+ @Override
public EmbeddedWebServer createEmbeddedWebServer() {
return new EmbeddedWebServerJetty();
}
+ @Override
public List<Class<?>> getTypes() {
- return listOf(EmbeddedWebServer.class);
+ return listOf(EmbeddedWebServer.class);
}
}
-
-
Modified: incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerAddress.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerAddress.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerAddress.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerAddress.java Tue May 3 06:22:09 2011
@@ -17,45 +17,45 @@
* under the License.
*/
+/**
+ *
+ */
+package org.apache.isis.runtimes.dflt.webserver.internal;
-/**
- *
- */
-package org.apache.isis.runtimes.dflt.webserver.internal;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
import org.apache.isis.core.runtime.optionhandler.BootPrinter;
import org.apache.isis.core.runtime.optionhandler.OptionHandler;
import org.apache.isis.runtimes.dflt.webserver.WebServerConstants;
-
-public final class OptionHandlerAddress implements OptionHandler {
- private String address;
- static final String ADDRESS_OPT = "a";
- static final String ADDRESS_LONG_OPT = "address";
-
- @SuppressWarnings("static-access")
- public void addOption(Options options) {
- Option option = OptionBuilder.withArgName("address").hasArg().withLongOpt(OptionHandlerAddress.ADDRESS_LONG_OPT).withDescription(
- "address to listen on").create(OptionHandlerAddress.ADDRESS_OPT);
- options.addOption(option);
- }
-
- public boolean handle(CommandLine commandLine,
- BootPrinter bootPrinter, Options options) {
- address = commandLine.getOptionValue(OptionHandlerAddress.ADDRESS_OPT);
- return true;
- }
-
- public void primeConfigurationBuilder(
- IsisConfigurationBuilder isisConfigurationBuilder) {
- if (address == null) {
- return;
- }
- isisConfigurationBuilder.add(WebServerConstants.EMBEDDED_WEB_SERVER_ADDRESS_KEY, address);
- }
+
+public final class OptionHandlerAddress implements OptionHandler {
+ private String address;
+ static final String ADDRESS_OPT = "a";
+ static final String ADDRESS_LONG_OPT = "address";
+
+ @Override
+ @SuppressWarnings("static-access")
+ public void addOption(final Options options) {
+ final Option option =
+ OptionBuilder.withArgName("address").hasArg().withLongOpt(OptionHandlerAddress.ADDRESS_LONG_OPT)
+ .withDescription("address to listen on").create(OptionHandlerAddress.ADDRESS_OPT);
+ options.addOption(option);
+ }
+
+ @Override
+ public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+ address = commandLine.getOptionValue(OptionHandlerAddress.ADDRESS_OPT);
+ return true;
+ }
+
+ @Override
+ public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+ if (address == null) {
+ return;
+ }
+ isisConfigurationBuilder.add(WebServerConstants.EMBEDDED_WEB_SERVER_ADDRESS_KEY, address);
+ }
}
\ No newline at end of file
Modified: incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerDeploymentTypeWebServer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerDeploymentTypeWebServer.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerDeploymentTypeWebServer.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerDeploymentTypeWebServer.java Tue May 3 06:22:09 2011
@@ -17,20 +17,19 @@
* under the License.
*/
+package org.apache.isis.runtimes.dflt.webserver.internal;
-package org.apache.isis.runtimes.dflt.webserver.internal;
-
import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.TYPE_SERVER;
import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.TYPE_SERVER_EXPLORATION;
import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.TYPE_SERVER_PROTOTYPE;
-
+
import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerDeploymentType;
import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
-
-
-public class OptionHandlerDeploymentTypeWebServer extends OptionHandlerDeploymentType {
-
- public OptionHandlerDeploymentTypeWebServer() {
- super(DeploymentType.SERVER_PROTOTYPE, TYPE_SERVER_EXPLORATION + "; " + TYPE_SERVER_PROTOTYPE + " (default); " + TYPE_SERVER);
- }
-}
+
+public class OptionHandlerDeploymentTypeWebServer extends OptionHandlerDeploymentType {
+
+ public OptionHandlerDeploymentTypeWebServer() {
+ super(DeploymentType.SERVER_PROTOTYPE, TYPE_SERVER_EXPLORATION + "; " + TYPE_SERVER_PROTOTYPE + " (default); "
+ + TYPE_SERVER);
+ }
+}
Modified: incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerPort.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerPort.java?rev=1098935&r1=1098934&r2=1098935&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerPort.java (original)
+++ incubator/isis/trunk/runtimes/dflt/webserver/src/main/java/org/apache/isis/runtimes/dflt/webserver/internal/OptionHandlerPort.java Tue May 3 06:22:09 2011
@@ -17,49 +17,49 @@
* under the License.
*/
+/**
+ *
+ */
+package org.apache.isis.runtimes.dflt.webserver.internal;
-/**
- *
- */
-package org.apache.isis.runtimes.dflt.webserver.internal;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
import org.apache.isis.core.runtime.optionhandler.BootPrinter;
import org.apache.isis.core.runtime.optionhandler.OptionHandler;
import org.apache.isis.runtimes.dflt.webserver.WebServerConstants;
-
-public final class OptionHandlerPort implements OptionHandler {
- private Integer port;
- static final String PORT_LONG_OPT = "port";
- static final String PORT_OPT = "p";
-
- @SuppressWarnings("static-access")
- public void addOption(Options options) {
- OptionBuilder.withArgName("port");
- Option option = OptionBuilder.hasArg().withLongOpt(OptionHandlerPort.PORT_LONG_OPT)
- .withDescription("port to listen on").create(OptionHandlerPort.PORT_OPT);
- options.addOption(option);
- }
-
- public boolean handle(CommandLine commandLine,
- BootPrinter bootPrinter, Options options) {
- String portStr = commandLine.getOptionValue(OptionHandlerPort.PORT_OPT);
- if (portStr != null){
- port = Integer.parseInt(portStr);
- }
- return true;
- }
-
- public void primeConfigurationBuilder(
- IsisConfigurationBuilder isisConfigurationBuilder) {
- if (port == null) {
- return;
- }
- isisConfigurationBuilder.add(WebServerConstants.EMBEDDED_WEB_SERVER_PORT_KEY, ""+port);
- }
+
+public final class OptionHandlerPort implements OptionHandler {
+ private Integer port;
+ static final String PORT_LONG_OPT = "port";
+ static final String PORT_OPT = "p";
+
+ @Override
+ @SuppressWarnings("static-access")
+ public void addOption(final Options options) {
+ OptionBuilder.withArgName("port");
+ final Option option =
+ OptionBuilder.hasArg().withLongOpt(OptionHandlerPort.PORT_LONG_OPT).withDescription("port to listen on")
+ .create(OptionHandlerPort.PORT_OPT);
+ options.addOption(option);
+ }
+
+ @Override
+ public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+ final String portStr = commandLine.getOptionValue(OptionHandlerPort.PORT_OPT);
+ if (portStr != null) {
+ port = Integer.parseInt(portStr);
+ }
+ return true;
+ }
+
+ @Override
+ public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+ if (port == null) {
+ return;
+ }
+ isisConfigurationBuilder.add(WebServerConstants.EMBEDDED_WEB_SERVER_PORT_KEY, "" + port);
+ }
}
\ No newline at end of file