Modul Laderoutinen für SuperX
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
1.1 KiB

package de.superx.sxrest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import de.memtext.util.DateUtils;
import de.superx.common.SxUser;
import de.superx.elt.EtlActionJob;
import de.superx.servlet.SuperXManager;
@Path("/execute")
public class JobExecutor {
@Context
Request request;
@GET
@Path("/{param}")
@Produces(MediaType.TEXT_PLAIN)
public String printLogs(@PathParam("param") String job, @Context HttpServletRequest request) {
String returntext = "";
SxUser user = (SxUser) request.getSession().getAttribute("user");
if (user == null || !user.isAdmin()) {
returntext = "Fehlende Rechte";
} else {
EtlActionJob myJob = new EtlActionJob(job, "", "");
try {
myJob.execute();
} catch (Exception e) {
e.printStackTrace();
returntext = "Fehler " + e;
}
}
return returntext;
}
}