diff --git a/README.md b/README.md index a4bcd32..3c1d295 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ where the available `` are: * `modular-webapp` * `modular-requestfactory` -* `dagger-guice-rf-activities` This should use the latest release from the Central Repository. Alternatively, and/or if you want to hack on / contribute to the archetypes, diff --git a/dagger-guice-rf-activities/pom.xml b/dagger-guice-rf-activities/pom.xml deleted file mode 100644 index 6c9b44b..0000000 --- a/dagger-guice-rf-activities/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - 4.0.0 - - - net.ltgt.gwt.archetypes - gwt-maven-archetypes - HEAD-SNAPSHOT - - - dagger-guice-rf-activities - HEAD-SNAPSHOT - maven-archetype - - GWT Modular Dagger/Guice/RequestFactory/Activities WebApp Archetype - GWT application with user authentication, using Dagger and Places/Activities on client side, Guice on server side, RequestFactory for communication. - diff --git a/dagger-guice-rf-activities/src/main/resources/META-INF/maven/archetype-metadata.xml b/dagger-guice-rf-activities/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index 1e32593..0000000 --- a/dagger-guice-rf-activities/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - App - - - ${module.toLowerCase()} - - - - - - - src/main/java - - **/*.java - **/*.xml - - - - src/main - - module.gwt.xml - - - - - - - - src/main/java - - **/*.java - - - - - - - - src/main/java - - **/*.java - - - - src/main/webapp - - **/*.xml - **/*.html - **/*.jsp - - - - src/main/webapp - - **/*.ico - **/*.css - - - - src/main/jettyconf - - **/*.xml - - - - src/etc - - **/*.properties - - - - - - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/pom.xml b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/pom.xml deleted file mode 100644 index 53b49fd..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - -#set( $dollar = '$' ) - - 4.0.0 - - - ${groupId} - ${rootArtifactId} - ${version} - - - ${artifactId} - gwt-app - - - - ${dollar}{project.groupId} - ${rootArtifactId}-shared - ${dollar}{project.version} - - - ${dollar}{project.groupId} - ${rootArtifactId}-shared - ${dollar}{project.version} - sources - - - org.gwtproject - gwt-user - - - org.gwtproject - gwt-dev - - - com.google.dagger - dagger-gwt - - - - - - - net.ltgt.gwt.maven - gwt-maven-plugin - - ${package}.${module} - ${module-short-name} - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - com.google.dagger - dagger-compiler - ${dollar}{dagger.version} - - - - - - - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/AuthAwareRequestTransport.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/AuthAwareRequestTransport.java deleted file mode 100644 index c06cbc8..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/AuthAwareRequestTransport.java +++ /dev/null @@ -1,54 +0,0 @@ -package ${package}; - -import com.google.gwt.http.client.Request; -import com.google.gwt.http.client.RequestCallback; -import com.google.gwt.http.client.Response; -import com.google.gwt.user.client.Window; -import com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport; -import com.google.web.bindery.requestfactory.shared.ServerFailure; - -/** - * Extends {@link DefaultRequestTransport} to handle unauthenticated requests (HTTP status 401 (Unauthorized)). - * - * Implementation note: largely inspired by GaeAuthRequestTransport. - */ -public class AuthAwareRequestTransport extends DefaultRequestTransport { - - private boolean lastResponseWasUnauthorized = false; - - @Override - protected RequestCallback createRequestCallback(final TransportReceiver receiver) { - final RequestCallback superCallback = super.createRequestCallback(receiver); - return new RequestCallback() { - @Override - public void onResponseReceived(Request request, Response response) { - if (Response.SC_UNAUTHORIZED == response.getStatusCode()) { - /* - * Hand the receiver a non-fatal callback, so that - * com.google.gwt.requestfactory.shared.Receiver will not post a - * runtime exception. - */ - receiver.onTransportFailure( - new ServerFailure("Unauthenticated user", null, null, false /* non-fatal */)); - boolean responseWasUnauthorized = AuthAwareRequestTransport.this.lastResponseWasUnauthorized; - AuthAwareRequestTransport.this.lastResponseWasUnauthorized = true; - if (!responseWasUnauthorized) { - // TODO: Maybe fire an event on the EventBus instead... - Window.alert("You've been disconnected. Reload the page to authenticate back."); - } - return; - } - AuthAwareRequestTransport.this.lastResponseWasUnauthorized = false; - superCallback.onResponseReceived(request, response); - } - - @Override - public void onError(Request request, Throwable exception) { - superCallback.onError(request, exception); - } - }; - } -} - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingActivity.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingActivity.java deleted file mode 100644 index 8aca1ac..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingActivity.java +++ /dev/null @@ -1,113 +0,0 @@ -package ${package}; - -import com.google.gwt.activity.shared.AbstractActivity; -import com.google.gwt.event.shared.EventBus; -import com.google.gwt.place.shared.PlaceController; -import com.google.gwt.safehtml.shared.SafeHtml; -import com.google.gwt.safehtml.shared.SafeHtmlBuilder; -import com.google.gwt.safehtml.shared.SafeHtmlUtils; -import com.google.gwt.user.client.ui.AcceptsOneWidget; -import com.google.gwt.user.client.ui.IsWidget; -import com.google.web.bindery.requestfactory.shared.Receiver; -import com.google.web.bindery.requestfactory.shared.ServerFailure; - -import dagger.assisted.Assisted; -import dagger.assisted.AssistedFactory; -import dagger.assisted.AssistedInject; - -import javax.inject.Inject; - -public class GreetingActivity extends AbstractActivity implements GreetingView.Presenter { - /** - * The message displayed to the user when the server cannot be reached or - * returns an error. - */ - private static final SafeHtml SERVER_ERROR = - SafeHtmlUtils.fromSafeConstant("An error occurred while " - + "attempting to contact the server. Please check your network " - + "connection and try again."); - - @AssistedFactory - public interface Factory { - GreetingActivity create(String name); - } - - private final GreetingView view; - private final PlaceController placeController; - private final ${module}Factory factory; - private final String name; - - private boolean cancelled; - - @AssistedInject - GreetingActivity(GreetingViewImpl view, PlaceController placeController, - ${module}Factory factory, @Assisted String name) { - this((GreetingView) view, placeController, factory, name); - } - - // For tests, independent from view implementation - GreetingActivity(GreetingView view, PlaceController placeController, ${module}Factory factory, String name) { - this.view = view; - this.placeController = placeController; - this.factory = factory; - this.name = name; - } - - @Override - public void start(final AcceptsOneWidget panel, com.google.gwt.event.shared.EventBus eventBus) { - cancelled = false; - - view.setPresenter(this); - view.setName(this.name); - - factory.greeting().greetServer(this.name).fire( - new Receiver() { - public void onFailure(ServerFailure failure) { - if (cancelled) { - return; - } - - showFailureMessage(); - } - - public void onSuccess(GreetingResponseProxy response) { - if (cancelled) { - return; - } - - if (!response.isSuccessful()) { - showFailureMessage(); - return; - } - - view.setError(false); - view.setServerResponse(new SafeHtmlBuilder() - .appendEscaped(response.getGreeting()) - .appendHtmlConstant("

I am running ") - .appendEscaped(response.getServerInfo()) - .appendHtmlConstant(".

It looks like you are using:
") - .appendEscaped(response.getUserAgent()) - .toSafeHtml()); - - panel.setWidget(view); - } - - private void showFailureMessage() { - view.setError(true); - view.setServerResponse(SERVER_ERROR); - - panel.setWidget(view); - } - }); - } - - @Override - public void onCancel() { - cancelled = true; - } - - @Override - public void goBack() { - placeController.goTo(new HomePlace()); - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingPlace.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingPlace.java deleted file mode 100644 index 25def35..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingPlace.java +++ /dev/null @@ -1,50 +0,0 @@ -package ${package}; - -import com.google.gwt.place.shared.Place; -import com.google.gwt.place.shared.PlaceTokenizer; -import com.google.gwt.place.shared.Prefix; - -import java.util.Objects; - -public class GreetingPlace extends Place { - - @Prefix("greeting") - public static class Tokenizer implements PlaceTokenizer { - - @Override - public GreetingPlace getPlace(String token) { - return new GreetingPlace(token); - } - - @Override - public String getToken(GreetingPlace place) { - return place.getUser(); - } - } - - private final String user; - - public GreetingPlace(String user) { - this.user = user; - } - - public String getUser() { - return this.user; - } - - @Override - public boolean equals(Object o) { - if (o == this) return true; - if (o instanceof GreetingPlace) { - GreetingPlace other = (GreetingPlace) o; - return Objects.equals(this.user, other.user); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(this.user); - } -} - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingView.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingView.java deleted file mode 100644 index 1bf692d..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingView.java +++ /dev/null @@ -1,20 +0,0 @@ -package ${package}; - -import com.google.gwt.safehtml.shared.SafeHtml; -import com.google.gwt.user.client.ui.IsWidget; - -public interface GreetingView extends IsWidget { - - public interface Presenter { - - void goBack(); - } - - void setError(boolean error); - - void setName(String name); - - void setPresenter(Presenter presenter); - - void setServerResponse(SafeHtml response); -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingViewImpl.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingViewImpl.java deleted file mode 100644 index 35983cf..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/GreetingViewImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -package ${package}; - -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.safehtml.shared.SafeHtml; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; - -import javax.inject.Inject; -import javax.inject.Singleton; - -@Singleton -public class GreetingViewImpl implements GreetingView { - - private final VerticalPanel dialogVPanel; - private final Label textToServerLabel; - private final HTML serverResponseLabel; - - private Presenter presenter; - - @Inject - GreetingViewImpl() { - textToServerLabel = new Label(); - serverResponseLabel = new HTML(); - dialogVPanel = new VerticalPanel(); - - Button closeButton = new Button("Back"); - - dialogVPanel.addStyleName("dialogVPanel"); - dialogVPanel.add(new HTML("Sending name to the server:")); - dialogVPanel.add(textToServerLabel); - dialogVPanel.add(new HTML("
Server replies:")); - dialogVPanel.add(serverResponseLabel); - dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); - dialogVPanel.add(closeButton); - - closeButton.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent event) { - if (presenter != null) { - presenter.goBack(); - } - } - }); - } - - @Override - public void setError(boolean error) { - if (error) { - serverResponseLabel.addStyleName("serverResponseLabelError"); - } else { - serverResponseLabel.removeStyleName("serverResponseLabelError"); - } - } - - @Override - public void setName(String name) { - textToServerLabel.setText(name); - } - - @Override - public void setPresenter(Presenter presenter) { - this.presenter = presenter; - } - - @Override - public void setServerResponse(SafeHtml response) { - serverResponseLabel.setHTML(response); - } - - @Override - public Widget asWidget() { - return dialogVPanel; - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeActivity.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeActivity.java deleted file mode 100644 index b6c6825..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeActivity.java +++ /dev/null @@ -1,49 +0,0 @@ -package ${package}; - -import com.google.gwt.activity.shared.AbstractActivity; -import com.google.gwt.place.shared.PlaceController; -import com.google.gwt.user.client.ui.AcceptsOneWidget; - -import javax.inject.Inject; - -public class HomeActivity extends AbstractActivity implements HomeView.Presenter { - - private final HomeView view; - private final PlaceController placeController; - private final String userName; - - @Inject - HomeActivity(HomeViewImpl view, PlaceController placeController, @CurrentUser String userName) { - this((HomeView) view, placeController, userName); - } - - // For tests, independent from view implementation - HomeActivity(HomeView view, PlaceController placeController, @CurrentUser String userName) { - this.view = view; - this.placeController = placeController; - this.userName = userName; - } - - @Override - public void start(AcceptsOneWidget panel, com.google.gwt.event.shared.EventBus eventBus) { - view.setPresenter(this); - view.setEnabled(true); - view.setUserName(userName); - panel.setWidget(view); - } - - @Override - public void sendNameToServer(String name) { - // First, we validate the input. - view.setError(""); - if (!FieldVerifier.isValidName(name)) { - view.setError("Please enter at least four characters"); - return; - } - - // Then, we send the input to the server. - view.setEnabled(false); - - placeController.goTo(new GreetingPlace(name)); - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomePlace.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomePlace.java deleted file mode 100644 index 73888d6..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomePlace.java +++ /dev/null @@ -1,7 +0,0 @@ -package ${package}; - -import com.google.gwt.place.shared.Place; - -public class HomePlace extends Place { -} - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeView.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeView.java deleted file mode 100644 index 9414b90..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeView.java +++ /dev/null @@ -1,19 +0,0 @@ -package ${package}; - -import com.google.gwt.user.client.ui.IsWidget; - -public interface HomeView extends IsWidget { - - public interface Presenter { - - void sendNameToServer(String name); - } - - void setUserName(String userName); - - void setEnabled(boolean enabled); - - void setError(String error); - - void setPresenter(Presenter presenter); -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeViewImpl.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeViewImpl.java deleted file mode 100644 index 55bdbf7..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeViewImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -package ${package}; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.event.dom.client.KeyUpEvent; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.Widget; - -import javax.inject.Inject; -import javax.inject.Singleton; - -@Singleton -public class HomeViewImpl implements HomeView { - - public interface Binder extends UiBinder { - } - - private static final Binder binder = GWT.create(Binder.class); - - private final Widget w; - - private Presenter presenter; - - @UiField TextBox nameField; - @UiField Button sendButton; - @UiField Label errorLabel; - - @Inject - HomeViewImpl() { - w = binder.createAndBindUi(this); - } - - @Override - public void setUserName(String userName) { - nameField.setText(userName); - } - - @Override - public void setEnabled(boolean enabled) { - sendButton.setEnabled(enabled); - } - - @Override - public void setError(String error) { - errorLabel.setText(error); - } - - @Override - public void setPresenter(Presenter presenter) { - this.presenter = presenter; - } - - @Override - public Widget asWidget() { - return w; - } - - @UiHandler("sendButton") - void onClick(ClickEvent event) { - sendNameToServer(); - } - - @UiHandler("nameField") - void onKeyUp(KeyUpEvent event) { - if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { - sendNameToServer(); - } - } - - private void sendNameToServer() { - if (presenter != null) { - presenter.sendNameToServer(nameField.getText()); - } - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeViewImpl.ui.xml b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeViewImpl.ui.xml deleted file mode 100644 index 66f07e9..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/HomeViewImpl.ui.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - -

Web Application Starter Project

- - - - - - - - - - - - -
Please enter your name:
Send
- -
-
-
- diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/MainActivityMapper.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/MainActivityMapper.java deleted file mode 100644 index beef31f..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/MainActivityMapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package ${package}; - -import java.util.logging.Logger; - -import com.google.gwt.activity.shared.Activity; -import com.google.gwt.activity.shared.ActivityMapper; -import com.google.gwt.place.shared.Place; - -import javax.inject.Inject; -import javax.inject.Provider; - -public class MainActivityMapper implements ActivityMapper { - - private static final Logger logger = Logger.getLogger(MainActivityMapper.class.getName()); - - @Inject Provider homeActivityProvider; - @Inject GreetingActivity.Factory greetingActivityFactory; - - @Inject MainActivityMapper() { - } - - @Override - public Activity getActivity(Place place) { - if (place instanceof HomePlace) { - return homeActivityProvider.get(); - } - if (place instanceof GreetingPlace) { - GreetingPlace greetingPlace = (GreetingPlace) place; - return greetingActivityFactory.create(greetingPlace.getUser()); - } - logger.severe("Unhandled place type: " + place.getClass().getName()); - return null; - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__.java deleted file mode 100644 index 999ccde..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__.java +++ /dev/null @@ -1,24 +0,0 @@ -package ${package}; - -import com.google.gwt.activity.shared.ActivityManager; -import com.google.gwt.core.client.EntryPoint; -import com.google.gwt.place.shared.PlaceHistoryHandler; -import com.google.gwt.user.client.ui.RootPanel; -import com.google.gwt.user.client.ui.SimplePanel; -import com.google.web.bindery.event.shared.EventBus; - -public class ${module} implements EntryPoint { - - public void onModuleLoad() { - ${module}Component component = Dagger${module}Component.create(); - - SimplePanel mainContainer = new SimplePanel(); - MainActivityMapper mainMapper = component.mainActivityMapper(); - ActivityManager mainManager = new ActivityManager(mainMapper, component.eventBus()); - mainManager.setDisplay(mainContainer); - - RootPanel.get().add(mainContainer); - - component.placeHistoryHandler().handleCurrentHistory(); - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__Component.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__Component.java deleted file mode 100644 index dc1618b..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__Component.java +++ /dev/null @@ -1,19 +0,0 @@ -package ${package}; - -import com.google.gwt.place.shared.PlaceHistoryHandler; -import com.google.web.bindery.event.shared.EventBus; - -import dagger.Component; - -import javax.inject.Singleton; - -@Singleton -@Component(modules = ${module}Module.class) -public interface ${module}Component { - - EventBus eventBus(); - - PlaceHistoryHandler placeHistoryHandler(); - - MainActivityMapper mainActivityMapper(); -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__Module.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__Module.java deleted file mode 100644 index bd99173..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__Module.java +++ /dev/null @@ -1,97 +0,0 @@ -package ${package}; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.core.client.Scheduler; -import com.google.gwt.place.shared.Place; -import com.google.gwt.place.shared.PlaceController; -import com.google.gwt.place.shared.PlaceHistoryHandler; -import com.google.gwt.place.shared.PlaceHistoryHandler.DefaultHistorian; -import com.google.gwt.place.shared.PlaceHistoryHandler.Historian; -import com.google.gwt.place.shared.PlaceHistoryMapper; -import com.google.web.bindery.event.shared.EventBus; -import com.google.web.bindery.event.shared.SimpleEventBus; -import com.google.web.bindery.requestfactory.shared.RequestTransport; - -import dagger.Binds; -import dagger.Module; -import dagger.Provides; - -import jsinterop.annotations.JsPackage; -import jsinterop.annotations.JsProperty; - -import javax.inject.Singleton; - -@Module -public abstract class ${module}Module { - - private static Place getDefaultPlace() { - return new HomePlace(); - } - - @Provides @Singleton - static SimpleEventBus provideSimpleEventBus() { - return new SimpleEventBus(); - } - - @Binds - abstract EventBus provideEventBus(SimpleEventBus bus); - - @Provides - static PlaceHistoryMapper providePlaceHistoryMapper() { - return GWT.create(${module}PlaceHistoryMapper.class); - } - - @Provides - static Historian provideHistorian() { - // For best UX at login time (preserving place), use an Html5History: https://gist.github.com/1883821 - return new DefaultHistorian(); - } - - @Provides - static RequestTransport provideRequestTransport() { - return new AuthAwareRequestTransport(); - } - - @Provides @Singleton - static PlaceController providePlaceController(EventBus eventBus) { - return new PlaceController(eventBus); - } - - @Provides @Singleton - static PlaceHistoryHandler providePlaceHistoryHandler(PlaceHistoryMapper mapper, Historian historian, - PlaceController controller, EventBus eventBus) { - PlaceHistoryHandler handler = new PlaceHistoryHandler(mapper, historian); - handler.register(controller, eventBus, getDefaultPlace()); - return handler; - } - - @Provides @Singleton - static ${module}Factory provide${module}Factory(EventBus eventBus, RequestTransport transport) { - ${module}Factory factory = GWT.create(${module}Factory.class); - factory.initialize(eventBus, transport); - return factory; - } - - @Provides - static Scheduler provideScheduler() { - return Scheduler.get(); - } - - @Provides @LogoutUrl - @JsProperty(name = "logoutUrl", namespace = JsPackage.GLOBAL) - static native String provideLogoutUrl(); - - @Provides @CurrentUser @Singleton - @JsProperty(name = "user", namespace = JsPackage.GLOBAL) - static native User provideCurrentUser(); - - @Provides @CurrentUser - static String provideUserName(@CurrentUser User user) { - return user.getUserName(); - } - - @Provides @IsAdmin - static boolean provideIsAdmin(@CurrentUser User user) { - return user.isAdmin(); - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__PlaceHistoryMapper.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__PlaceHistoryMapper.java deleted file mode 100644 index 96e8b1d..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/java/__module__PlaceHistoryMapper.java +++ /dev/null @@ -1,8 +0,0 @@ -package ${package}; - -import com.google.gwt.place.shared.PlaceHistoryMapper; -import com.google.gwt.place.shared.WithTokenizers; - -@WithTokenizers(GreetingPlace.Tokenizer.class) -public interface ${module}PlaceHistoryMapper extends PlaceHistoryMapper { -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/module.gwt.xml b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/module.gwt.xml deleted file mode 100644 index 185288b..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-client/src/main/module.gwt.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/pom.xml b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/pom.xml deleted file mode 100644 index a120aad..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/pom.xml +++ /dev/null @@ -1,174 +0,0 @@ - -#set( $dollar = '$' ) - - 4.0.0 - - - ${groupId} - ${rootArtifactId} - ${version} - - - ${artifactId} - war - - - - ${dollar}{project.groupId} - ${rootArtifactId}-shared - ${dollar}{project.version} - - - org.gwtproject.web.bindery - requestfactory-apt - - true - - provided - - - org.gwtproject.web.bindery - requestfactory-server - - - com.google.inject - guice - - - com.google.inject.extensions - guice-jndi - - - com.google.inject.extensions - guice-servlet - - - javax.servlet - javax.servlet-api - provided - - - - - - - org.codehaus.mojo - exec-maven-plugin - - - process-classes - requestfactory-validation-tool - - exec - - - java - compile - - -Dverbose=true - -cp - - com.google.web.bindery.requestfactory.apt.ValidationTool - ${dollar}{project.build.outputDirectory} - ${package}.${module}Factory - - - - - - - - - - org.eclipse.jetty - jetty-maven-plugin - - 1 - - ${dollar}{basedir}/../${rootArtifactId}-shared/target/classes/ - - ${dollar}{basedir}/src/main/jettyconf/context.xml - - - ${module} - ${dollar}{basedir}/src/etc/dev-realm.properties - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.codehaus.mojo - exec-maven-plugin - [1.2,) - - exec - - - - - - - - - - - - - - - - - - env-prod - - true - - - - ${dollar}{project.groupId} - ${rootArtifactId}-client - ${dollar}{project.version} - war - runtime - - - - - env-dev - - - env - dev - - - - - - - org.eclipse.jetty - jetty-maven-plugin - - - - ${dollar}{basedir}/src/main/webapp - ${dollar}{basedir}/../target/gwt/launcherDir/ - - - - - - - - - - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/etc/dev-realm.properties b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/etc/dev-realm.properties deleted file mode 100644 index 1bfe5d3..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/etc/dev-realm.properties +++ /dev/null @@ -1,3 +0,0 @@ -admin = admin, admin -user = user, user - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/AjaxAuthenticationFilter.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/AjaxAuthenticationFilter.java deleted file mode 100644 index 777c19c..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/AjaxAuthenticationFilter.java +++ /dev/null @@ -1,52 +0,0 @@ -package ${package}; - -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; - -/** - * Filter for Ajax requests, for applicative (client) authentication handling. - *

- * Returns a 401 (Unauthorized) HTTP status code if a request is not authenticated, instead of using the container's - * "standard" authentication method (e.g. redirecting to a login page) which could be undetected by the client Web app. - *

- * Implémentation note: largely inspired by GaeAuthFilter. - */ -public class AjaxAuthenticationFilter implements Filter { - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - // no-op - } - - @Override - public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) - throws IOException, ServletException { - HttpServletRequest request = (HttpServletRequest) servletRequest; - HttpServletResponse response = (HttpServletResponse) servletResponse; - - if (request.getUserPrincipal() == null) { - // TODO: per spec, HTTP requires a WWW-Authenticate header on 401 (Unauthorized) responses - // Should it use http://tools.ietf.org/html/draft-broyer-http-cookie-auth ? - // or a "custom" authentication scheme? - response.sendError(HttpServletResponse.SC_UNAUTHORIZED); - return; - } - - filterChain.doFilter(servletRequest, servletResponse); - } - - @Override - public void destroy() { - // no-op - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GreetingResponse.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GreetingResponse.java deleted file mode 100644 index a419690..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GreetingResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -package ${package}; - -import com.google.web.bindery.requestfactory.server.RequestFactoryServlet; - -public class GreetingResponse { - private boolean successful; - private String error; - private String greeting; - private String serverInfo; - private String userAgent; - - public boolean isSuccessful() { - return successful; - } - - public void setSuccessful(boolean successful) { - this.successful = successful; - } - - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } - - public String getGreeting() { - return greeting; - } - - public void setGreeting(String greeting) { - this.greeting = greeting; - } - - public String getServerInfo() { - return serverInfo; - } - - public void setServerInfo(String serverInfo) { - this.serverInfo = serverInfo; - } - - public String getUserAgent() { - return userAgent; - } - - public void setUserAgent(String userAgent) { - this.userAgent = userAgent; - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GreetingService.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GreetingService.java deleted file mode 100644 index 5aaa6be..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GreetingService.java +++ /dev/null @@ -1,39 +0,0 @@ -package ${package}; - -import javax.inject.Inject; -import javax.inject.Provider; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; - -/** - * The server side implementation of the GreetingContext. - */ -public class GreetingService { - - private final Provider ctx; - private final Provider req; - - @Inject - GreetingService(Provider ctx, Provider req) { - this.ctx = ctx; - this.req = req; - } - - public GreetingResponse greetServer(String input) { - GreetingResponse response = new GreetingResponse(); - - // Verify that the input is valid. - if (!FieldVerifier.isValidName(input)) { - // If the input is not valid, return an error back to the client. - response.setSuccessful(false); - response.setError("Name must be at least 4 characters long"); - } else { - response.setSuccessful(true); - response.setGreeting("Hello, " + input + "!"); - response.setServerInfo(ctx.get().getServerInfo()); - response.setUserAgent(req.get().getHeader("User-Agent")); - } - - return response; - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GuiceRequestFactoryServlet.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GuiceRequestFactoryServlet.java deleted file mode 100644 index 2f187ca..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GuiceRequestFactoryServlet.java +++ /dev/null @@ -1,17 +0,0 @@ -package ${package}; - -import com.google.web.bindery.requestfactory.server.ExceptionHandler; -import com.google.web.bindery.requestfactory.server.RequestFactoryServlet; - -import javax.inject.Inject; -import javax.inject.Singleton; - -@Singleton -public class GuiceRequestFactoryServlet extends RequestFactoryServlet { - - @Inject - GuiceRequestFactoryServlet(ExceptionHandler exceptionHandler, GuiceServiceLayer guiceSL) { - super(exceptionHandler, guiceSL); - } -} - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GuiceServiceLayer.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GuiceServiceLayer.java deleted file mode 100644 index 3653c31..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GuiceServiceLayer.java +++ /dev/null @@ -1,31 +0,0 @@ -package ${package}; - -import static java.util.Objects.requireNonNull; - -import com.google.inject.Injector; -import com.google.web.bindery.requestfactory.shared.Locator; -import com.google.web.bindery.requestfactory.shared.ServiceLocator; -import com.google.web.bindery.requestfactory.server.ServiceLayerDecorator; - -import javax.inject.Inject; - -public class GuiceServiceLayer extends ServiceLayerDecorator { - - private final Injector injector; - - @Inject - GuiceServiceLayer(Injector injector) { - this.injector = requireNonNull(injector); - } - - @Override - public > T createLocator(java.lang.Class clazz) { - return injector.getInstance(clazz); - } - - @Override - public T createServiceLocator(java.lang.Class clazz) { - return injector.getInstance(clazz); - } -} - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GuiceServiceLocator.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GuiceServiceLocator.java deleted file mode 100644 index e82686a..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/GuiceServiceLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package ${package}; - -import com.google.inject.Injector; -import com.google.web.bindery.requestfactory.shared.ServiceLocator; - -import javax.inject.Inject; - -public class GuiceServiceLocator implements ServiceLocator { - - private final Injector injector; - - @Inject - GuiceServiceLocator(Injector injector) { - this.injector = injector; - } - - @Override - public Object getInstance(Class clazz) { - return injector.getInstance(clazz); - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/ServerUser.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/ServerUser.java deleted file mode 100644 index 25f8107..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/ServerUser.java +++ /dev/null @@ -1,42 +0,0 @@ -package ${package}; - -import com.google.web.bindery.autobean.shared.AutoBean; -import com.google.web.bindery.autobean.shared.AutoBeanCodex; -import com.google.web.bindery.autobean.shared.AutoBeanFactory; -import com.google.web.bindery.autobean.vm.AutoBeanFactorySource; - -import javax.inject.Inject; - -public class ServerUser implements User { - - private final String userName; - private final boolean admin; - - @Inject - ServerUser(@CurrentUser String userName, @IsAdmin boolean admin) { - this.userName = userName; - this.admin = admin; - } - - @Override - public String getUserName() { - return userName; - } - - @Override - public boolean isAdmin() { - return admin; - } - - public String toJson() { - // This could use any JSON library instead of AutoBean. - Factory factory = AutoBeanFactorySource.create(Factory.class); - AutoBean wrapper = factory.user(this); - return AutoBeanCodex.encode(wrapper).getPayload(); - } - - interface Factory extends AutoBeanFactory { - AutoBean user(User wrapped); - } -} - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/__module__ServletContextListener.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/__module__ServletContextListener.java deleted file mode 100644 index 3858447..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/java/__module__ServletContextListener.java +++ /dev/null @@ -1,58 +0,0 @@ -package ${package}; - -import javax.inject.Inject; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.servlet.http.HttpServletRequest; - -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.google.inject.Provides; -import com.google.inject.jndi.JndiIntegration; -import com.google.inject.name.Names; -import com.google.inject.servlet.GuiceServletContextListener; -import com.google.inject.servlet.ServletModule; -import com.google.inject.servlet.RequestScoped; -import com.google.web.bindery.requestfactory.server.ExceptionHandler; -import com.google.web.bindery.requestfactory.server.DefaultExceptionHandler; - -public class ${module}ServletContextListener extends GuiceServletContextListener { - - @Override - protected Injector getInjector() { - final Context ctx; - try { - InitialContext ic = new InitialContext(); - ctx = (Context) ic.lookup("java:comp/env"); - } catch (NamingException ne) { - throw new RuntimeException(ne); - } - - return Guice.createInjector(new ServletModule() { - @Override - protected void configureServlets() { - serve("/gwtRequest").with(GuiceRequestFactoryServlet.class); - - bind(ExceptionHandler.class).to(DefaultExceptionHandler.class); - - bind(Context.class).toInstance(ctx); - bind(String.class).annotatedWith(Names.named("${module-short-name}/logoutUrl")).toProvider( - JndiIntegration.fromJndi(String.class, "${module-short-name}/logoutUrl")); - - bind(User.class).annotatedWith(CurrentUser.class).to(ServerUser.class); - } - - @Provides @CurrentUser @RequestScoped - String provideCurrentUser(HttpServletRequest request) { - return request.getRemoteUser(); - } - - @Provides @IsAdmin @RequestScoped - boolean provideIsAdmin(HttpServletRequest request) { - return request.isUserInRole("admin"); - } - }); - } -} - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/jettyconf/context.xml b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/jettyconf/context.xml deleted file mode 100644 index eaea86d..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/jettyconf/context.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - org.eclipse.jetty.servlet.Default.useFileMappedBuffer - false - - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/WEB-INF/web.xml b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 40be023..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - ${package}.${module}ServletContextListener - - - - ${module-short-name}/logoutUrl - java.lang.String - logout.jsp - - - - AjaxAuth - ${package}.AjaxAuthenticationFilter - - - AjaxAuth - /gwtRequest - - - - guiceFilter - com.google.inject.servlet.GuiceFilter - - - guiceFilter - /* - - - - FORM - ${module} - - /login.html - /login.html - - - - - Authentification required (everywhere) - - - /* - - /gwtRequest - /favicon.ico - /logout.jsp - /static/* - /${module-short-name}/* - - - * - - - - Unauthenticated access for AJAX requests (applicative handling) - - - /gwtRequest - POST - - - - Unauthenticated access for images and CSS (for use in login.html and logout.jsp) - - - /favicon.ico - /logout.jsp - /static/* - /${module-short-name}/* - GET - - - - - user - - - admin - - - - index.jsp - - - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/favicon.ico b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/favicon.ico deleted file mode 100644 index 858a707..0000000 Binary files a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/favicon.ico and /dev/null differ diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/index.jsp b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/index.jsp deleted file mode 100644 index d6da550..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/index.jsp +++ /dev/null @@ -1,74 +0,0 @@ -<%@ page session="false" contentType="text/html;charset=utf-8" %> -<%-- see http://turbomanage.wordpress.com/2009/12/11/how-to-inject-guice-objects-in-a-jsp/ --%> -<%@ page import="com.google.inject.Guice" %> -<%@ page import="com.google.inject.Injector" %> -<%@ page import="com.google.inject.Key" %> -<%@ page import="com.google.inject.name.Names" %> -<%@ page import="${package}.ServerUser" %> -<% - Injector injector = (Injector) pageContext.getServletContext().getAttribute(Injector.class.getName()); - ServerUser user = injector.getInstance(ServerUser.class); - String logoutUrl = injector.getInstance(Key.get(String.class, Names.named("${module-short-name}/logoutUrl"))); -%> -<%! - private String htmlEscape(String str) { - if (str == null) { - return null; - } - return str.replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """); - } -%> - - - - - - <%-- --%> - <%-- Consider inlining CSS to reduce the number of requested files --%> - <%-- --%> - - - <%-- --%> - <%-- Any title is fine --%> - <%-- --%> - Web Application Starter Project - - <%-- Tell GWT where to find its permutations, as we inline the *.nocache.js --%> - - - - -

- Your web browser must have JavaScript enabled in order for this application to display correctly. -
- - -
- Signed in as <%= htmlEscape(user.getUserName()) %> -<% - if (user.isAdmin()) { -%> - (you're an administrator) -<% - } - - if (logoutUrl != null) { - logoutUrl = logoutUrl.trim(); - if (!logoutUrl.isEmpty()) { -%> - | Sign out -<% - } - } -%> -
- - - - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/login.html b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/login.html deleted file mode 100644 index 33801a3..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/login.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - Web Application Starter Project - - -
-
- - -
-
- - -
-
- -
-
- - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/logout.jsp b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/logout.jsp deleted file mode 100644 index 971c6bc..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/logout.jsp +++ /dev/null @@ -1,32 +0,0 @@ -<%@ page session="false" contentType="text/html;charset=utf-8" %> - - - - - Web Application Starter Project - - - -<%! - private String htmlEscape(String str) { - if (str == null) { - return null; - } - return str.replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """); - } -%> -<%-- Some servlet containers will clear the remote user when invalidating the session --%> -<% - String userName = request.getRemoteUser(); -%> -<%-- FIXME: use request.logout() instead, if you can use Servlets 3.0 --%> -<% - HttpSession session = request.getSession(false); - if (session != null) { - session.invalidate(); - } -%> -

You've been logged out (<%= htmlEscape(userName) %>)

-

To log back in, click here. - - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/static/__rootArtifactId__.css b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/static/__rootArtifactId__.css deleted file mode 100644 index 7aca7ac..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-server/src/main/webapp/static/__rootArtifactId__.css +++ /dev/null @@ -1,34 +0,0 @@ -/** Add css rules here for your application. */ - - -/** Example rules used by the template application (remove for your app) */ -h1 { - font-size: 2em; - font-weight: bold; - color: #777777; - margin: 40px 0px 70px; - text-align: center; -} - -.sendButton { - display: block; - font-size: 16pt; -} - -/** Most GWT widgets already have a style name defined */ -.gwt-DialogBox { - width: 400px; -} - -.dialogVPanel { - margin: 5px; -} - -.serverResponseLabelError { - color: red; -} - -/** Set ids using widget.getElement().setId("idOfElement") */ -#closeButton { - margin: 15px 6px 6px; -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/pom.xml b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/pom.xml deleted file mode 100644 index 41359da..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - 4.0.0 - - - ${groupId} - ${rootArtifactId} - ${version} - - - ${artifactId} - - - - javax.inject - javax.inject - - - com.google.jsinterop - jsinterop-annotations - provided - - - org.gwtproject.web.bindery - requestfactory-client - provided - - - - - - - org.apache.maven.plugins - maven-source-plugin - - - - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/CurrentUser.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/CurrentUser.java deleted file mode 100644 index c3af7b9..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/CurrentUser.java +++ /dev/null @@ -1,17 +0,0 @@ -package ${package}; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -@Retention(RUNTIME) -@Target({ FIELD, PARAMETER, METHOD }) -@Qualifier -public @interface CurrentUser { -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/FieldVerifier.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/FieldVerifier.java deleted file mode 100644 index 3c83860..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/FieldVerifier.java +++ /dev/null @@ -1,42 +0,0 @@ -package ${package}; - -/** - *

- * FieldVerifier validates that the name the user enters is valid. - *

- *

- * This class is in the shared project because we use it in both - * the client code and on the server. On the client, we verify that the name is - * valid before sending an RPC request so the user doesn't have to wait for a - * network round trip to get feedback. On the server, we verify that the name is - * correct to ensure that the input is correct regardless of where the RPC - * originates. - *

- *

- * When creating a class that is used on both the client and the server, be sure - * that all code is translatable and does not use native JavaScript. Code that - * is not translatable (such as code that interacts with a database or the file - * system) cannot be compiled into client side JavaScript. Code that uses native - * JavaScript (such as Widgets) cannot be run on the server. - *

- */ -public class FieldVerifier { - - /** - * Verifies that the specified name is valid for our service. - * - * In this example, we only require that the name is at least four - * characters. In your application, you can use more complex checks to ensure - * that usernames, passwords, email addresses, URLs, and other fields have the - * proper syntax. - * - * @param name the name to validate - * @return true if valid, false if invalid - */ - public static boolean isValidName(String name) { - if (name == null) { - return false; - } - return name.length() > 3; - } -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/GreetingContext.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/GreetingContext.java deleted file mode 100644 index 25dd60b..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/GreetingContext.java +++ /dev/null @@ -1,13 +0,0 @@ -package ${package}; - -import com.google.web.bindery.requestfactory.shared.Request; -import com.google.web.bindery.requestfactory.shared.RequestContext; -import com.google.web.bindery.requestfactory.shared.ServiceName; - -/** - * The client side stub for the RequestFactory service. - */ -@ServiceName(value="${package}.GreetingService", locator="${package}.GuiceServiceLocator") -public interface GreetingContext extends RequestContext { - Request greetServer(String name); -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/GreetingResponseProxy.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/GreetingResponseProxy.java deleted file mode 100644 index ceb4983..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/GreetingResponseProxy.java +++ /dev/null @@ -1,18 +0,0 @@ -package ${package}; - -import com.google.web.bindery.requestfactory.shared.ProxyForName; -import com.google.web.bindery.requestfactory.shared.ValueProxy; - -@ProxyForName("${package}.GreetingResponse") -public interface GreetingResponseProxy extends ValueProxy { - - boolean isSuccessful(); - - String getError(); - - String getGreeting(); - - String getServerInfo(); - - String getUserAgent(); -} \ No newline at end of file diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/IsAdmin.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/IsAdmin.java deleted file mode 100644 index 08bfe7b..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/IsAdmin.java +++ /dev/null @@ -1,17 +0,0 @@ -package ${package}; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -@Retention(RUNTIME) -@Target({ FIELD, PARAMETER, METHOD }) -@Qualifier -public @interface IsAdmin { -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/LogoutUrl.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/LogoutUrl.java deleted file mode 100644 index 09b4f74..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/LogoutUrl.java +++ /dev/null @@ -1,17 +0,0 @@ -package ${package}; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -@Retention(RUNTIME) -@Target({ FIELD, PARAMETER, METHOD }) -@Qualifier -public @interface LogoutUrl { -} diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/User.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/User.java deleted file mode 100644 index 55460ef..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/User.java +++ /dev/null @@ -1,15 +0,0 @@ -package ${package}; - -import jsinterop.annotations.JsProperty; -import jsinterop.annotations.JsType; - -@JsType(isNative = true) -public interface User { - - @JsProperty - String getUserName(); - - @JsProperty - boolean isAdmin(); -} - diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/__module__Factory.java b/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/__module__Factory.java deleted file mode 100644 index 735c57b..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/__rootArtifactId__-shared/src/main/java/__module__Factory.java +++ /dev/null @@ -1,7 +0,0 @@ -package ${package}; - -import com.google.web.bindery.requestfactory.shared.RequestFactory; - -public interface ${module}Factory extends RequestFactory { - GreetingContext greeting(); -} \ No newline at end of file diff --git a/dagger-guice-rf-activities/src/main/resources/archetype-resources/pom.xml b/dagger-guice-rf-activities/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index 00a616d..0000000 --- a/dagger-guice-rf-activities/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - -#set( $dollar = '$' ) - - 4.0.0 - - ${groupId} - ${artifactId} - ${version} - pom - - - UTF-8 - - 2.50 - 6.0.0 - - - - - - org.gwtproject - gwt - 2.11.0 - pom - import - - - com.google.inject - guice-bom - ${dollar}{guice.version} - pom - import - - - javax.inject - javax.inject - 1 - - - com.google.dagger - dagger-gwt - ${dollar}{dagger.version} - - - javax.servlet - javax.servlet-api - 3.1.0 - - - - - - - - net.ltgt.gwt.maven - gwt-maven-plugin - false - - ${project.build.directory}/gwt/launcherDir - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - 11 - - - - org.apache.maven.plugins - maven-resources-plugin - 3.3.1 - - - org.apache.maven.plugins - maven-surefire-plugin - 3.2.5 - - - org.apache.maven.plugins - maven-war-plugin - 3.4.0 - - - org.eclipse.jetty - jetty-maven-plugin - 9.4.53.v20231009 - - - net.ltgt.gwt.maven - gwt-maven-plugin - 1.1.0 - true - - 11 - true - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - package - - jar-no-fork - - - - - - org.codehaus.mojo - exec-maven-plugin - 3.1.1 - - - - - diff --git a/dagger-guice-rf-activities/src/test/resources/projects/basic/archetype.properties b/dagger-guice-rf-activities/src/test/resources/projects/basic/archetype.properties deleted file mode 100644 index 4b1bdc5..0000000 --- a/dagger-guice-rf-activities/src/test/resources/projects/basic/archetype.properties +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Apr 26 01:26:07 CEST 2012 -package=it.pkg -version=0.1-SNAPSHOT -groupId=archetype.it -artifactId=basic -module=Basic -module-short-name=basic - diff --git a/dagger-guice-rf-activities/src/test/resources/projects/basic/goal.txt b/dagger-guice-rf-activities/src/test/resources/projects/basic/goal.txt deleted file mode 100644 index 2c66442..0000000 --- a/dagger-guice-rf-activities/src/test/resources/projects/basic/goal.txt +++ /dev/null @@ -1,2 +0,0 @@ -verify -Dgwt.draftCompile=true - diff --git a/pom.xml b/pom.xml index 042df3c..852ba72 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,6 @@ modular-webapp modular-requestfactory - dagger-guice-rf-activities