This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Patrick Huang
committed
May 26, 2014
1 parent
93321b3
commit ff1a367
Showing
5 changed files
with
67 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
zanata-war/src/main/java/org/zanata/webtrans/server/DispatchServiceImpl.java
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
zanata-war/src/main/java/org/zanata/webtrans/server/GwtDispatchService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters