/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/web/BanListener.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/web/BanListener.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1803 by torben, Mon May 28 14:32:53 2012 UTC revision 1940 by torben, Wed Mar 20 16:41:20 2013 UTC
# Line 1  Line 1 
1  package dk.thoerup.bukkit.hoeruputils.web;  package dk.thoerup.bukkit.hoeruputils.web;
2    
3  import java.io.File;  import java.io.IOException;
4    import java.io.OutputStream;
5    import java.net.HttpURLConnection;
6  import java.text.SimpleDateFormat;  import java.text.SimpleDateFormat;
7  import java.util.Date;  import java.util.Date;
8  import java.util.Set;  
 import java.util.Map;  
 import org.bukkit.Location;  
 import org.bukkit.Server;  
9  import org.bukkit.OfflinePlayer;  import org.bukkit.OfflinePlayer;
10  import org.bukkit.entity.Player;  import org.bukkit.Server;
11  import org.bukkit.plugin.Plugin;  import org.bukkit.plugin.Plugin;
12    
13  import org.bukkit.configuration.Configuration;  import com.sun.net.httpserver.HttpExchange;
14    import com.sun.net.httpserver.HttpHandler;
15    
 /*import org.kokakiwi.apicraft.events.ApiEvent;  
 import org.kokakiwi.apicraft.events.ApiListener;*/  
 import de.codeinfection.quickwango.ApiBukkit.ApiBukkit;  
 import de.codeinfection.quickwango.ApiBukkit.ApiServer.*;  
16    
17    
18  @Controller( name = "bans", authenticate = false, serializer = "raw" )  public class BanListener implements HttpHandler {
 public class BanListener extends ApiController {  
19    
20          SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");          SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
21    
# Line 30  public class BanListener extends ApiCont Line 25  public class BanListener extends ApiCont
25          String cachedText = "";          String cachedText = "";
26    
27          public BanListener(Plugin plugin, Server server) {          public BanListener(Plugin plugin, Server server) {
                 super( new de.codeinfection.quickwango.Abstraction.Implementations.Bukkit.BukkitPlugin(plugin) );  
                 //super( new de.codeinfection.quickwango.ApiBukkit.Abstraction.Implementations.Bukkit.BukkitPlugin(plugin) );  
28    
29                  this.server = server;                  this.server = server;
30          }          }
# Line 44  public class BanListener extends ApiCont Line 37  public class BanListener extends ApiCont
37                  return format.format(d );                  return format.format(d );
38          }          }
39                    
40            
41            
42          @Override          @Override
43          public void defaultAction(ApiRequest request, ApiResponse response) {          public void handle(HttpExchange http) throws IOException {              
44  /*              if(!event.path[0].equalsIgnoreCase("webstatus")) {          /*              if(!event.path[0].equalsIgnoreCase("webstatus")) {
45                          return;                          return;
46                  }*/                  }*/
47    
# Line 62  public class BanListener extends ApiCont Line 57  public class BanListener extends ApiCont
57                                  text = cachedText;                                  text = cachedText;
58                          }                          }
59                  }                  }
                           
60    
61  /*              event.setResponse(xml);                  byte bytes[] = text.getBytes();
62                  event.setActionTaken(true);*/                  http.sendResponseHeaders(HttpURLConnection.HTTP_OK, bytes.length );
63                    final OutputStream os = http.getResponseBody();
64                  response.setContent( text );                  os.write(bytes);
65                    os.close();
66                    http.close();
67                    
68          }          }
69                    
70          private String buildText() {          private String buildText() {
# Line 93  public class BanListener extends ApiCont Line 90  public class BanListener extends ApiCont
90                                    
91          }          }
92    
93    
94    
95  }  }

Legend:
Removed from v.1803  
changed lines
  Added in v.1940

  ViewVC Help
Powered by ViewVC 1.1.20