Skip to content

Commit

Permalink
Issue CruxFramework#2 - Make Showcase project compatible with Crux 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Cardoso committed Dec 18, 2015
1 parent 3260f50 commit 8cf2ef2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
databaseNotSupportedError=Database not supported by your browser
databaseNotSupportedError=Database not supported by your browser
viewSourceCode=Source
loading=Loading
enableLog=Enable Log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.cruxframework.showcasecore.client.util;

import org.cruxframework.crux.core.client.Crux;
import org.cruxframework.crux.core.client.rest.Callback;
import org.cruxframework.crux.smartfaces.client.dialog.MessageBox;
import org.cruxframework.crux.smartfaces.client.dialog.MessageBox.MessageType;
import org.cruxframework.crux.smartfaces.client.dialog.WaitBox;
import org.cruxframework.crux.smartfaces.client.dialog.animation.DialogAnimation;
import org.cruxframework.showcasecore.client.resource.ShowcaseCoreMessages;
Expand Down Expand Up @@ -113,7 +114,7 @@ public void onError(Exception e)
{
try
{
Crux.getErrorHandler().handleError(e.getLocalizedMessage(), e);
MessageBox.show(e.getMessage(), MessageType.ERROR);
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import java.io.IOException;
import java.util.ArrayList;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.cruxframework.crux.core.server.rest.annotation.RestService;
import org.cruxframework.crux.core.shared.rest.RestException;
import org.cruxframework.crux.core.shared.rest.annotation.GET;
import org.cruxframework.crux.core.shared.rest.annotation.Path;
import org.cruxframework.crux.core.shared.rest.annotation.PathParam;
Expand All @@ -14,33 +17,40 @@
@Path("source")
public class SourceCodeRestService
{
private static final Log LOG = LogFactory.getLog(SourceCodeRestService.class);

@GET
@Path("sourceFile/{path}")
public String getSourceFile(@PathParam("path") String path)
public String getSourceFile(@PathParam("path") String path) throws RestException
{
try
{
return GitExplorer.getSourceFile(path);
}
catch (IOException | JSONException e)
{
e.printStackTrace();
LOG.error(e);
throw new RestException(e);
}
return null;
}

@GET
@Path("listSourceFiles/{viewName}")
public ArrayList<String> listSourceFilesForView(@PathParam("viewName") String viewName)
public ArrayList<String> listSourceFilesForView(@PathParam("viewName") String viewName) throws RestException
{
try
{
return GitExplorer.getListSourceFilesForView(viewName.toLowerCase().trim());
ArrayList<String> listSourceFilesForView = GitExplorer.getListSourceFilesForView(viewName.toLowerCase().trim());
if(listSourceFilesForView == null || listSourceFilesForView.isEmpty())
{
throw new RestException("GitHub souce code server offline. Try again later.");
}
return listSourceFilesForView;
}
catch (IOException | JSONException e)
{
e.printStackTrace();
LOG.error(e);
throw new RestException(e);
}
return null;
}
}
2 changes: 1 addition & 1 deletion showcase-core/src/main/webapp/WEB-INF/appengine-web.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>crux-crossdevice-showcase</application>
<version>23</version>
<version>37</version>
<threadsafe>true</threadsafe>
</appengine-web-app>

0 comments on commit 8cf2ef2

Please sign in to comment.