Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
rhbz1099695 - remove seam remoting
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed May 26, 2014
1 parent 93321b3 commit ff1a367
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 33 deletions.
4 changes: 0 additions & 4 deletions zanata-war/pom.xml
Expand Up @@ -1192,10 +1192,6 @@
<artifactId>jboss-seam-mail</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-remoting</artifactId>
</dependency>
<!-- RestEasy dependencies -->

<dependency>
Expand Down

This file was deleted.

@@ -0,0 +1,53 @@
package org.zanata.webtrans.server;

import javax.servlet.http.HttpServletRequest;

import lombok.extern.slf4j.Slf4j;
import net.customware.gwt.dispatch.shared.Action;
import net.customware.gwt.dispatch.shared.Result;

import org.jboss.seam.servlet.ContextualHttpServletRequest;
import org.zanata.util.ServiceLocator;
import org.zanata.webtrans.shared.DispatchService;

import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
* @author Patrick Huang <a
* href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
*/
@RemoteServiceRelativePath("seam/resource/gwt")
@Slf4j
public class GwtDispatchService extends RemoteServiceServlet implements
DispatchService {

@Override
public Result execute(final Action<?> action) throws Exception {
final Result[] result = { null };
final HttpServletRequest request = getThreadLocalRequest();
new ContextualHttpServletRequest(request) {
@Override
public void process() throws Exception {
SeamDispatch dispatch = ServiceLocator.instance()
.getInstance(SeamDispatch.class);
result[0] = dispatch.execute(action);
}
}.run();
return result[0];
}

@Override
public void rollback(final Action<Result> action, final Result result)
throws Exception {
final HttpServletRequest request = getThreadLocalRequest();
new ContextualHttpServletRequest(request) {
@Override
public void process() throws Exception {
SeamDispatch dispatch = ServiceLocator.instance()
.getInstance(SeamDispatch.class);
dispatch.rollback(action, result);
}
}.run();
}
}
9 changes: 9 additions & 0 deletions zanata-war/src/main/webapp-jboss/WEB-INF/web.xml
Expand Up @@ -271,6 +271,15 @@
<url-pattern>/webtrans/files/upload</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>gwtServlet</servlet-name>
<servlet-class>org.zanata.webtrans.server.GwtDispatchService</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>gwtServlet</servlet-name>
<url-pattern>/seam/resource/gwt</url-pattern>
</servlet-mapping>

<!-- Uncomment this to enable the H2Console
<servlet>
Expand Down
5 changes: 5 additions & 0 deletions zanata-war/src/main/webapp/WEB-INF/pages.xml
Expand Up @@ -771,6 +771,11 @@
</navigation>
</page>

<!-- we need to explicitly secure webtrans after removing seam remoting -->
<page view-id="/webtrans/Application.xhtml">
<restrict>#{identity.isLoggedIn()}</restrict>
</page>

<!-- Exceptions -->
<exception class="org.zanata.exception.KeyNotFoundException"
log-level="warn">
Expand Down

0 comments on commit ff1a367

Please sign in to comment.