Revision 33

Date:
2008/12/07 18:11:36
Author:
decke
Revision Log:
Http Protocol improvements
Files:

Legend:

 
Added
 
Removed
 
Modified
  • trunk/src/at/bluelife/blueengine/core/auth/AbstractAuthenticator.java

     
    27 27
    28 28 package at.bluelife.blueengine.core.auth;
    29 29
    30 import at.bluelife.blueengine.core.CoreContext;
    30 31 import at.bluelife.blueengine.core.pools.UserPool;
    31 32 import at.bluelife.blueengine.interfaces.IAuthenticator;
    32 33
    33 34
    34 35 public abstract class AbstractAuthenticator implements IAuthenticator
    35 36 {
    37 protected CoreContext core;
    36 38 protected UserPool pool;
    37 39
    38 public AbstractAuthenticator(UserPool pool)
    40 public AbstractAuthenticator(CoreContext core)
    39 41 {
    40 this.pool = pool;
    42 this.core = core;
    43 this.pool = core.getUserPool();
    41 44 }
    42 45 }
  • trunk/src/at/bluelife/blueengine/core/auth/NoAuthenticator.java

     
    29 29
    30 30 import java.awt.Color;
    31 31
    32 import at.bluelife.blueengine.core.pools.UserPool;
    32 import at.bluelife.blueengine.core.CoreContext;
    33 33 import at.bluelife.blueengine.core.user.GuestUser;
    34 34 import at.bluelife.blueengine.interfaces.IUser;
    35 35
    36 36
    37 37 public class NoAuthenticator extends AbstractAuthenticator
    38 38 {
    39 public NoAuthenticator(UserPool pool)
    39 public NoAuthenticator(CoreContext core)
    40 40 {
    41 super(pool);
    41 super(core);
    42 42 }
    43 43
    44 44 public IUser login(String username, String password)
  • trunk/src/at/bluelife/blueengine/core/auth/PasswordAuthenticator.java

     
    27 27
    28 28 package at.bluelife.blueengine.core.auth;
    29 29
    30 import at.bluelife.blueengine.core.pools.UserPool;
    30 import at.bluelife.blueengine.core.CoreContext;
    31 31 import at.bluelife.blueengine.interfaces.IUser;
    32 32 import at.bluelife.util.crypto.BCrypt;
    33 33 import at.bluelife.util.crypto.Digest;
     
    35 35
    36 36 public class PasswordAuthenticator extends AbstractAuthenticator
    37 37 {
    38 public PasswordAuthenticator(UserPool pool)
    38 public PasswordAuthenticator(CoreContext core)
    39 39 {
    40 super(pool);
    40 super(core);
    41 41 }
    42 42
    43 43 public IUser login(String username, String password)
  • trunk/src/at/bluelife/blueengine/core/CoreContext.java

     
    49 49 config = conf;
    50 50 userbackend = new FileBackend(config.get("USERFILE"));
    51 51 userpool = new UserPool(this);
    52 auth = new NoAuthenticator(userpool);
    52 auth = new NoAuthenticator(this);
    53 53 messagepool = new MessagePool(this);
    54 54 }
    55 55
  • trunk/src/at/bluelife/blueengine/core/pools/MessagePool.java

     
    27 27
    28 28 package at.bluelife.blueengine.core.pools;
    29 29
    30 import org.apache.log4j.Logger;
    31
    30 32 import at.bluelife.blueengine.core.CoreContext;
    31 33 import at.bluelife.blueengine.core.RequestContext;
    32 34 import at.bluelife.blueengine.interfaces.ICommand;
     
    35 37
    36 38 public class MessagePool extends Thread
    37 39 {
    40 protected static Logger log = Logger.getLogger(MessagePool.class);
    38 41 protected CoreContext core;
    39 42
    40 43 public MessagePool(CoreContext core)
     
    53 56 RequestContext context = new RequestContext(core);
    54 57 context.setMessage(user, message);
    55 58
    59 log.info("Protocol: " + user.getProtocol());
    60
    56 61 ICommand command = user.getProtocol().parseMessage(message, context);
    57 62
    58 if(command.match(message, context))
    63 if(command != null && command.match(message, context))
    59 64 {
    60 65 command.getAction().execute(context);
    61 66 }
  • trunk/src/at/bluelife/blueengine/core/pools/UserPool.java

     
    35 35
    36 36 import at.bluelife.blueengine.core.CoreContext;
    37 37 import at.bluelife.blueengine.interfaces.IUser;
    38 import at.bluelife.util.DateDiff;
    39 38
    40 39
    41 40 public class UserPool extends Thread
     
    142 141
    143 142 public void cleanup()
    144 143 {
    145 int max_silent = Integer.parseInt(core.getProperty("MAX_SILENT_TIME", "900"));
    144 //int max_silent = Integer.parseInt(core.getProperty("MAX_SILENT_TIME", "900"));
    146 145
    147 146 synchronized(userpool)
    148 147 {
     
    152 151 {
    153 152 IUser user = users.nextElement();
    154 153
    155 //if(user.getProtocol().isSocketClosed())
    156 // removeUser(user);
    154 if(user.isOnline())
    155 continue;
    157 156
    158 if(DateDiff.diff(user.getLastMessageDate()) > max_silent)
    159 removeUser(user);
    157 //if(DateDiff.diff(user.getLastMessageDate()) > max_silent)
    158 // removeUser(user);
    160 159 }
    161 160 }
    162 161 }
  • trunk/src/at/bluelife/blueengine/core/ProtocolContext.java

     
    1 /**
    2 * Copyright (c) 2005, 2008 Bernhard Fröhlich <decke@bluelife.at>
    3 * All rights reserved.
    4 *
    5 * Redistribution and use in source and binary forms, with or without
    6 * modification, are permitted provided that the following conditions
    7 * are met:
    8 *
    9 * 1. Redistributions of source code must retain the above copyright
    10 * notice, this list of conditions and the following disclaimer
    11 * in this position and unchanged.
    12 * 2. Redistributions in binary form must reproduce the above copyright
    13 * notice, this list of conditions and the following disclaimer in the
    14 * documentation and/or other materials provided with the distribution.
    15 *
    16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
    17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    26 */
    27
    28 package at.bluelife.blueengine.core;
    29
    30 import at.bluelife.blueengine.interfaces.ICommand;
    31
    32
    33 public class ProtocolContext
    34 {
    35 public ProtocolContext()
    36 {
    37 }
    38
    39 public ICommand parseMessage(String message, RequestContext context)
    40 {
    41 return null;
    42 }
    43 }
  • trunk/src/at/bluelife/blueengine/core/RequestContext.java

     
    49 49 public RequestContext(CoreContext core)
    50 50 {
    51 51 this.core = core;
    52 this.properties = new Properties();
    52 53 }
    53 54
    54 55 public String getProperty(String key)
  • trunk/src/at/bluelife/blueengine/core/user/AbstractUser.java

     
    30 30 import java.awt.Color;
    31 31 import java.util.Date;
    32 32
    33 import at.bluelife.blueengine.core.ProtocolContext;
    34 33 import at.bluelife.blueengine.interfaces.IMessage;
    35 34 import at.bluelife.blueengine.interfaces.IUser;
    36 35 import at.bluelife.blueengine.interfaces.IUserBackend;
    36 import at.bluelife.blueengine.interfaces.IProtocolContext;
    37 37
    38 38
    39 39 abstract public class AbstractUser implements IUser
     
    42 42 protected String password;
    43 43 protected Color color;
    44 44 protected Date lastLogin;
    45 protected IProtocolContext protocol;
    45 46
    46 47 public AbstractUser(String username)
    47 48 {
     
    129 130 return false;
    130 131 }
    131 132
    132 public ProtocolContext getProtocol()
    133 public IProtocolContext getProtocol()
    133 134 {
    134 return null;
    135 return protocol;
    135 136 }
    136 137
    137 138 public String getRemoteAddress()
     
    143 144 {
    144 145 return false;
    145 146 }
    147
    148 public boolean setProtocol(IProtocolContext protocol)
    149 {
    150 if(this.protocol == null)
    151 {
    152 this.protocol = protocol;
    153 return true;
    154 }
    155 return false;
    156 }
    146 157 }
  • trunk/src/at/bluelife/blueengine/core/user/User.java

     
    31 31 import java.util.Date;
    32 32 import java.util.Properties;
    33 33
    34 import at.bluelife.blueengine.core.ProtocolContext;
    35 34 import at.bluelife.blueengine.interfaces.IMessage;
    36 35 import at.bluelife.blueengine.interfaces.IUserBackend;
    36 import at.bluelife.blueengine.interfaces.IProtocolContext;
    37 37
    38 38
    39 39 public class User extends AbstractUser
     
    41 41 protected Properties props;
    42 42 protected Date lastMessage;
    43 43 protected IUserBackend backend;
    44 protected IProtocolContext protocol;
    44 45
    45 46 public User(String username, String password, Color color, Date lastLogin)
    46 47 {
     
    59 60 return false;
    60 61 }
    61 62
    63 public boolean setProtocol(IProtocolContext proto)
    64 {
    65 if(this.protocol == null)
    66 {
    67 this.protocol = proto;
    68 return true;
    69 }
    70 return false;
    71 }
    72
    62 73 protected boolean save()
    63 74 {
    64 75 if(backend == null)
     
    102 113 return props.containsKey(key);
    103 114 }
    104 115
    105 public ProtocolContext getProtocol()
    116 public IProtocolContext getProtocol()
    106 117 {
    107 118 return null;
    108 119 }
  • trunk/src/at/bluelife/blueengine/interfaces/IProtocolContext.java

     
    1 /**
    2 * Copyright (c) 2005, 2008 Bernhard Fröhlich <decke@bluelife.at>
    3 * All rights reserved.
    4 *
    5 * Redistribution and use in source and binary forms, with or without
    6 * modification, are permitted provided that the following conditions
    7 * are met:
    8 *
    9 * 1. Redistributions of source code must retain the above copyright
    10 * notice, this list of conditions and the following disclaimer
    11 * in this position and unchanged.
    12 * 2. Redistributions in binary form must reproduce the above copyright
    13 * notice, this list of conditions and the following disclaimer in the
    14 * documentation and/or other materials provided with the distribution.
    15 *
    16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
    17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    26 */
    27
    28 package at.bluelife.blueengine.interfaces;
    29
    30 import at.bluelife.blueengine.core.RequestContext;
    31
    32
    33 public interface IProtocolContext
    34 {
    35 public ICommand parseMessage(String message, RequestContext context);
    36 public IListener getListener();
    37 }
  • trunk/src/at/bluelife/blueengine/interfaces/IUser.java

     
    30 30 import java.awt.Color;
    31 31 import java.util.Date;
    32 32
    33 import at.bluelife.blueengine.core.ProtocolContext;
    34 33
    35 34
    36 35 public interface IUser
     
    54 53 public boolean isPropertySet(String key);
    55 54
    56 55 public String getUniqueId();
    57 public ProtocolContext getProtocol();
    56 public IProtocolContext getProtocol();
    57 public boolean setProtocol(IProtocolContext protocol);
    58 58 public boolean setBackend(IUserBackend backend);
    59 59 public boolean sendMessage(IMessage message);
    60 60 }
  • trunk/src/at/bluelife/blueengine/Kernel.java

     
    30 30 import org.apache.log4j.Logger;
    31 31
    32 32 import at.bluelife.blueengine.core.CoreContext;
    33 import at.bluelife.blueengine.interfaces.IListener;
    34 import at.bluelife.blueengine.protocol.www.core.HttpListener;
    33 import at.bluelife.blueengine.interfaces.IProtocolContext;
    34 import at.bluelife.blueengine.protocol.www.core.HttpProtocolContext;
    35 35
    36 36 public class Kernel extends Thread
    37 37 {
     
    43 43
    44 44 protected Config config;
    45 45 protected CoreContext core;
    46 protected IListener httpListener;
    46 protected IProtocolContext http;
    47 47
    48 48 public Kernel() throws Exception
    49 49 {
     
    52 52
    53 53 core = new CoreContext(config);
    54 54
    55 httpListener = new HttpListener(core);
    55 http = new HttpProtocolContext(core);
    56 56
    57 57 Runtime.getRuntime().addShutdownHook(new Thread()
    58 58 {
     
    71 71 log.info("");
    72 72 log.info("Kernel Thread waiting for requests ...");
    73 73
    74 httpListener.startup();
    74 http.getListener().startup();
    75 75
    76 76 while(!isInterrupted())
    77 77 {
     
    92 92 protected void close()
    93 93 {
    94 94 log.info("SHUTDOWN INITIALIZED ...");
    95 httpListener.close();
    95 http.getListener().close();
    96 96 core.close();
    97 97 log.info("SHUTDOWN END.");
    98 98 }
  • trunk/src/at/bluelife/blueengine/protocol/www/core/HttpListener.java

     
    33 33
    34 34 import org.apache.log4j.Logger;
    35 35
    36 import at.bluelife.blueengine.Kernel;
    37 36 import at.bluelife.blueengine.core.CoreContext;
    38 import at.bluelife.blueengine.core.pools.CommandParser;
    39 37 import at.bluelife.blueengine.interfaces.IListener;
    40 import at.bluelife.blueengine.protocol.www.commands.*;
    41 import at.bluelife.blueengine.protocol.www.requests.*;
    42 38
    43 39
    44 40 public class HttpListener extends Thread implements IListener
    45 41 {
    46 private RequestHandlerCollector collector;
    47 private CommandParser parser;
    48 private HttpSessionManager sessions;
    42 private HttpProtocolContext protocol;
    49 43 private ServerSocket ss;
    50 44
    51 private boolean running = false;
    45 private volatile boolean running = false;
    52 46 protected int port = 6667;
    53 47
    54 48 protected static Logger log = Logger.getLogger(HttpListener.class);
    55 49
    56 public HttpListener(CoreContext core)
    50 public HttpListener(CoreContext core, HttpProtocolContext protocol)
    57 51 {
    52 this.protocol = protocol;
    53
    58 54 try
    59 55 {
    60 56 port = Integer.parseInt(core.getProperty("PORT"));
     
    63 59 {
    64 60 // using default then
    65 61 }
    66
    67 sessions = new HttpSessionManager(core);
    68
    69 parser = new CommandParser();
    70 parser.addCommand(new UserListCommand());
    71 parser.addCommand(new WhisperCommand());
    72 parser.addCommand(new LogoutCommand());
    73 parser.addCommand(new StatusCommand());
    74 parser.addCommand(new VersionCommand());
    75
    76 collector = new RequestHandlerCollector(new DefaultRequestHandler(core));
    77 collector.addHandler("/", new StandardRequestHandler(core));
    78 collector.addHandler("/static/*", new StaticRequestHandler(Kernel.BASE_PATH + "static/"));
    79 collector.addHandler("/STREAM", new ChatStreamRequestHandler(core, sessions));
    80 collector.addHandler("/MSG", new MessageRequestHandler(core, sessions));
    81 collector.addHandler("/CHAT", new ChatRequestHandler(core));
    82 collector.addHandler("/INPUT", new InputRequestHandler(core));
    83 62 }
    84 63
    85 64 public boolean startup()
     
    114 93 try
    115 94 {
    116 95 Socket s = ss.accept();
    117 new HttpRequestThread(new HttpRequest(s), new HttpResponse(s), collector).start();
    96 new HttpRequestThread(new HttpRequest(s), new HttpResponse(s),
    97 protocol.getHandler()).start();
    118 98 }
    119 99 catch(IOException e)
    120 100 {
  • trunk/src/at/bluelife/blueengine/protocol/www/core/HttpProtocolContext.java

     
    1 /**
    2 * Copyright (c) 2005, 2008 Bernhard Fröhlich <decke@bluelife.at>
    3 * All rights reserved.
    4 *
    5 * Redistribution and use in source and binary forms, with or without
    6 * modification, are permitted provided that the following conditions
    7 * are met:
    8 *
    9 * 1. Redistributions of source code must retain the above copyright
    10 * notice, this list of conditions and the following disclaimer
    11 * in this position and unchanged.
    12 * 2. Redistributions in binary form must reproduce the above copyright
    13 * notice, this list of conditions and the following disclaimer in the
    14 * documentation and/or other materials provided with the distribution.
    15 *
    16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
    17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    26 */
    27
    28 package at.bluelife.blueengine.protocol.www.core;
    29
    30 import at.bluelife.blueengine.Kernel;
    31 import at.bluelife.blueengine.core.CoreContext;
    32 import at.bluelife.blueengine.core.RequestContext;
    33 import at.bluelife.blueengine.core.pools.CommandParser;
    34 import at.bluelife.blueengine.interfaces.ICommand;
    35 import at.bluelife.blueengine.interfaces.IListener;
    36 import at.bluelife.blueengine.interfaces.IProtocolContext;
    37 import at.bluelife.blueengine.protocol.www.commands.*;
    38 import at.bluelife.blueengine.protocol.www.requests.*;
    39
    40
    41 public class HttpProtocolContext implements IProtocolContext
    42 {
    43 private RequestHandlerCollector handler;
    44 private CommandParser parser;
    45 private HttpSessionManager sessions;
    46 private HttpListener listener;
    47
    48 public HttpProtocolContext(CoreContext core)
    49 {
    50 listener = new HttpListener(core, this);
    51
    52 sessions = new HttpSessionManager(core, this);
    53
    54 parser = new CommandParser();
    55 parser.addCommand(new UserListCommand());
    56 parser.addCommand(new WhisperCommand());
    57 parser.addCommand(new LogoutCommand());
    58 parser.addCommand(new StatusCommand());
    59 parser.addCommand(new VersionCommand());
    60
    61 handler = new RequestHandlerCollector(new DefaultRequestHandler(core));
    62 handler.addHandler("/", new StandardRequestHandler(core));
    63 handler.addHandler("/static/*", new StaticRequestHandler(Kernel.BASE_PATH + "static/"));
    64 handler.addHandler("/STREAM", new ChatStreamRequestHandler(core, sessions));
    65 handler.addHandler("/MSG", new MessageRequestHandler(core, sessions));
    66 handler.addHandler("/CHAT", new ChatRequestHandler(core, sessions));
    67 handler.addHandler("/INPUT", new InputRequestHandler(core, sessions));
    68 }
    69
    70 public RequestHandlerCollector getHandler()
    71 {
    72 return handler;
    73 }
    74
    75 public IListener getListener()
    76 {
    77 return listener;
    78 }
    79
    80 public ICommand parseMessage(String message, RequestContext context)
    81 {
    82 return null;
    83 }
    84 }
  • trunk/src/at/bluelife/blueengine/protocol/www/core/HttpSessionManager.java

     
    32 32 import java.util.Iterator;
    33 33 import java.util.Map;
    34 34
    35 import org.apache.log4j.Logger;
    36
    35 37 import at.bluelife.blueengine.core.CoreContext;
    36 38 import at.bluelife.blueengine.interfaces.IUser;
    39 import at.bluelife.blueengine.interfaces.IProtocolContext;
    37 40
    38 41
    39 42 public class HttpSessionManager
    40 43 {
    41 Map<String,HttpSession> sessions;
    42 CoreContext core;
    43
    44 public HttpSessionManager(CoreContext core)
    44 protected static Logger log = Logger.getLogger(HttpSessionManager.class);
    45 protected Map<String,HttpSession> sessions;
    46 protected CoreContext core;
    47 protected IProtocolContext protocol;
    48
    49 public HttpSessionManager(CoreContext core, IProtocolContext protocol)
    45 50 {
    46 51 this.core = core;
    52 this.protocol = protocol;
    47 53 this.sessions = Collections.synchronizedMap(new HashMap<String,HttpSession>());
    48 54 }
    49 55
     
    65 71 {
    66 72 HttpSession session = sessions.get(sessionid);
    67 73
    74 if(session == null)
    75 return null;
    76
    68 77 if(session.isValid())
    69 78 return session;
    70 79
  • trunk/src/at/bluelife/blueengine/protocol/www/requests/ChatRequestHandler.java

     
    33 33 import at.bluelife.blueengine.interfaces.IRequest;
    34 34 import at.bluelife.blueengine.interfaces.IResponse;
    35 35 import at.bluelife.blueengine.protocol.www.core.HttpSession;
    36 import at.bluelife.blueengine.protocol.www.core.HttpSessionManager;
    36 37
    37 38
    38 39 public class ChatRequestHandler extends AbstractRequestHandler
    39 40 {
    40 public ChatRequestHandler(CoreContext core)
    41 public ChatRequestHandler(CoreContext core, HttpSessionManager sessions)
    41 42 {
    42 super(core);
    43 super(core, sessions);
    43 44 }
    44 45
    45 46 public boolean handle(IRequest request, IResponse response)
  • trunk/src/at/bluelife/blueengine/protocol/www/requests/ChatStreamRequestHandler.java

     
    81 81 out.write("<stype type=\"text/css\"><!-- A:link {text-decoration: none }A:visited{text-decoration:none}A:active{text-decoration:none}--></style>\n");
    82 82 out.write("<font face=\"Verdana\" size=\"-1\">\n");
    83 83
    84 out.write("<font size=\"2\"><b>" + Kernel.VERSION_STRING + "</b></font> <font size=\"1\">&nbsp;&nbsp;&copy; 2005 by <a href=\"http://www.bluelife.at/\" target=_blank><u>Bernhard Fr&ouml;hlich</u></a> &nbsp;</font>\n");
    84 out.write("<font size=\"2\"><b>" + Kernel.VERSION_STRING + "</b></font> <font size=\"1\">&nbsp;&nbsp;&copy; 2005, 2008 by <a href=\"http://www.bluelife.at/\" target=_blank><u>Bernhard Fr&ouml;hlich</u></a> &nbsp;</font>\n");
    85 85 out.write("<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Willkommen im Chat!</b><br /><br />\n");
    86 86 out.flush();
    87 87
  • trunk/src/at/bluelife/blueengine/protocol/www/requests/InputRequestHandler.java

     
    32 32 import at.bluelife.blueengine.core.CoreContext;
    33 33 import at.bluelife.blueengine.interfaces.IRequest;
    34 34 import at.bluelife.blueengine.interfaces.IResponse;
    35 import at.bluelife.blueengine.protocol.www.core.HttpSessionManager;
    35 36
    36 37
    37 38 public class InputRequestHandler extends AbstractRequestHandler
    38 39 {
    39 public InputRequestHandler(CoreContext core)
    40 public InputRequestHandler(CoreContext core, HttpSessionManager sessions)
    40 41 {
    41 super(core);
    42 super(core, sessions);
    42 43 }
    43 44
    44 45 public boolean handle(IRequest request, IResponse response)
     
    51 52 response.close();
    52 53 throw new Exception("Username or Session missing");
    53 54 }
    55
    56 if(sessions.getSession(request.getVariable("session")) == null)
    57 {
    58 response.sendError(200, "OK", "Session invalid");
    59 response.close();
    60 throw new Exception("Session invalid");
    61 }
    54 62
    55 63 response.setStatus(200);
    56 64 response.setContentType("text/html");