removed unused classes
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@76402 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e87dff2fdc
commit
0694f1e63c
|
@ -3,12 +3,9 @@ package org.gcube.portlets.user.td.server;
|
|||
import javax.servlet.ServletException;
|
||||
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portlets.user.csvimportwizardgxt3.server.csv.CSVTargetRegistry;
|
||||
import org.gcube.portlets.user.csvimportwizardgxt3.server.csv.DemoCSVTarget;
|
||||
import org.gcube.portlets.user.td.ciw.server.CSVTDImporter;
|
||||
import org.gcube.portlets.user.td.client.rpc.TabularDataService;
|
||||
import org.gcube.portlets.user.td.importer.server.TabularDataImporterManager;
|
||||
import org.gcube.portlets.user.td.shared.FieldVerifier;
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
|
||||
/**
|
||||
|
@ -23,17 +20,17 @@ public class TabularDataServiceImpl extends RemoteServiceServlet implements Tabu
|
|||
@Override
|
||||
public void init() throws ServletException {
|
||||
super.init();
|
||||
|
||||
|
||||
System.out.println("initializing the TabularDataImporterManager");
|
||||
TabularDataImporterManager importerManager = new TabularDataImporterManager();
|
||||
//importerManager.scanAvailableImporters();
|
||||
importerManager.add(new CSVTDImporter());
|
||||
importerManager.setupImporters();
|
||||
|
||||
|
||||
//register the demo csv target
|
||||
//CSVTargetRegistry.getInstance().add(new DemoCSVTarget());
|
||||
//System.out.println("Registered DemoCSVTarget");
|
||||
|
||||
|
||||
ScopeProvider.instance.set("/gcube/devsec");
|
||||
}
|
||||
|
||||
|
@ -41,37 +38,8 @@ public class TabularDataServiceImpl extends RemoteServiceServlet implements Tabu
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
public String greetServer(String input) throws IllegalArgumentException {
|
||||
// Verify that the input is valid.
|
||||
if (!FieldVerifier.isValidName(input)) {
|
||||
// If the input is not valid, throw an IllegalArgumentException back to
|
||||
// the client.
|
||||
throw new IllegalArgumentException(
|
||||
"Name must be at least 4 characters long");
|
||||
}
|
||||
|
||||
String serverInfo = getServletContext().getServerInfo();
|
||||
String userAgent = getThreadLocalRequest().getHeader("User-Agent");
|
||||
|
||||
// Escape data from the client to avoid cross-site script vulnerabilities.
|
||||
input = escapeHtml(input);
|
||||
userAgent = escapeHtml(userAgent);
|
||||
|
||||
return "Hello, " + input + "!<br><br>I am running " + serverInfo
|
||||
+ ".<br><br>It looks like you are using:<br>" + userAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape an html string. Escaping data received from the client helps to
|
||||
* prevent cross-site script vulnerabilities.
|
||||
*
|
||||
* @param html the html string to escape
|
||||
* @return the escaped string
|
||||
*/
|
||||
private String escapeHtml(String html) {
|
||||
if (html == null) {
|
||||
return null;
|
||||
}
|
||||
return html.replaceAll("&", "&").replaceAll("<", "<").replaceAll(
|
||||
">", ">");
|
||||
return "Hello";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
package org.gcube.portlets.user.td.shared;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* FieldVerifier validates that the name the user enters is valid.
|
||||
* </p>
|
||||
* <p>
|
||||
* This class is in the <code>shared</code> packing 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.
|
||||
* </p>
|
||||
* <p>
|
||||
* 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 note 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.
|
||||
* </p>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue