lipog-commit Mailing List for Little Portal Gizmo (Page 10)
Status: Beta
Brought to you by:
jbu
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(94) |
Jun
(14) |
Jul
(168) |
Aug
(39) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(6) |
Dec
|
From: Joerg B. <jb...@us...> - 2009-06-03 20:50:18
|
Update of /cvsroot/lipog/net.heilancoo.portal.examples/src/net/heilancoo/portal/examples/json In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17734/src/net/heilancoo/portal/examples/json Added Files: JsonApplication.java JsonSession.java Log Message: added JSON responder usage example --- NEW FILE: JsonSession.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.portal.examples.json; import java.util.Date; import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.freemarker.FreeMarkerModel; import net.heilancoo.portal.htmlforms.FormFieldContainer; import net.heilancoo.portal.responses.ResponseTemplateFolder; import net.heilancoo.portal.session.Session; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.protocol.HttpContext; import org.json.JSONException; import org.json.JSONObject; /** * @author joerg * */ @ResponseTemplateFolder("templates.json") public class JsonSession implements Session { private String user; private String password; private int counter; public JsonSession(String user, String password) { this.user = user; this.password = password; this.counter = 0; } @Request public void main(HttpRequest request, FormFieldContainer fields, HttpResponse response, HttpContext context, FreeMarkerModel model) { } @Request public void doCounter(HttpRequest request, FormFieldContainer fields, HttpResponse response, HttpContext context, JSONObject model) throws JSONException { counter += 1; model.put("counter", counter); model.put("user", user); model.put("password", password); model.put("time", new Date().toString()); String [] array = new String[3]; array[0] = "element 0"; array[1] = "element 1"; array[2] = "element II"; model.put("arrayOf3", array); } } --- NEW FILE: JsonApplication.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.portal.examples.json; import net.heilancoo.portal.application.Application; import net.heilancoo.portal.application.ApplicationParameters; import net.heilancoo.portal.application.ValidSessions; import net.heilancoo.portal.htmlforms.FormFieldAccessException; import net.heilancoo.portal.htmlforms.FormFieldContainer; import net.heilancoo.portal.session.Session; /** * @author joerg * */ @ValidSessions({ JsonSession.class }) public class JsonApplication implements Application { /* (non-Javadoc) * @see net.heilancoo.portal.application.Application#getVersion() */ @Override public String getVersion() { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see net.heilancoo.portal.application.Application#initialise(net.heilancoo.portal.application.ApplicationParameters) */ @Override public void initialise(ApplicationParameters parameters) { // TODO Auto-generated method stub } /* (non-Javadoc) * @see net.heilancoo.portal.application.Application#validateCredentialsAndMakeNewSession(net.heilancoo.portal.htmlforms.FormFieldContainer) */ @Override public Session validateCredentialsAndMakeNewSession( FormFieldContainer fields) throws FormFieldAccessException { String u = fields.getStringValue("user"); String p = fields.getStringValue("password"); if(!u.equals(p)) return null; return new JsonSession(u, p); } } |
From: Joerg B. <jb...@us...> - 2009-06-03 20:50:15
|
Update of /cvsroot/lipog/net.heilancoo.portal.examples/src/net/heilancoo/portal/examples/json In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17721/src/net/heilancoo/portal/examples/json Log Message: Directory /cvsroot/lipog/net.heilancoo.portal.examples/src/net/heilancoo/portal/examples/json added to the repository |
From: Joerg B. <jb...@us...> - 2009-05-29 18:27:15
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22571/doc Modified Files: change-log.html Log Message: static file serving through session URIs Index: change-log.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/change-log.html,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** change-log.html 28 May 2009 18:43:35 -0000 1.21 --- change-log.html 29 May 2009 18:27:01 -0000 1.22 *************** *** 11,14 **** --- 11,16 ---- <h2>Release 4 (upcoming)</h2> <ul> + <li>Static files can now be served through paths relative to the application or any other controller via + the @StaticFiles annotation.</li> <li>Introduced session sub-controllers. Identified by a sub-controller key in the URI (between session key and request method name) there can now be more than one active controllers.</li> |
From: Joerg B. <jb...@us...> - 2009-05-29 18:27:10
|
Update of /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/responders In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22543/src/net/heilancoo/portal/responders Modified Files: FileResponder.java Log Message: static file serving through session URIs Index: FileResponder.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/responders/FileResponder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FileResponder.java 12 May 2009 16:15:13 -0000 1.3 --- FileResponder.java 29 May 2009 18:26:58 -0000 1.4 *************** *** 32,39 **** private File file; private MimeTypeMapper mimeMapper; ! public FileResponder(File file, MimeTypeMapper mimeMapper) { this.file = file; this.mimeMapper = mimeMapper; } --- 32,41 ---- private File file; private MimeTypeMapper mimeMapper; + private boolean mapExtension; ! public FileResponder(File file, MimeTypeMapper mimeMapper, boolean mapExtension) { this.file = file; this.mimeMapper = mimeMapper; + this.mapExtension = mapExtension; } *************** *** 47,51 **** IllegalAccessException, InvocationTargetException { ! FileRequestHandler.serveFile(file, request, response, context, mimeMapper, false); return true; --- 49,55 ---- IllegalAccessException, InvocationTargetException { ! File f = mapExtension ? new File(file.getAbsolutePath() + "." + format) : file; ! ! FileRequestHandler.serveFile(f, request, response, context, mimeMapper, false); return true; |
From: Joerg B. <jb...@us...> - 2009-05-29 18:27:05
|
Update of /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/responses In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22543/src/net/heilancoo/portal/responses Modified Files: ResponseHelper.java Log Message: static file serving through session URIs Index: ResponseHelper.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/responses/ResponseHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ResponseHelper.java 11 May 2009 16:43:11 -0000 1.1 --- ResponseHelper.java 29 May 2009 18:26:58 -0000 1.2 *************** *** 58,60 **** --- 58,65 ---- } + public static String getTemplateFolder(Class<?> controllerClass) { + ResponseTemplateFolder rtf = controllerClass.getAnnotation(ResponseTemplateFolder.class); + + return rtf != null ? rtf.value() : "templates"; + } } |
From: Joerg B. <jb...@us...> - 2009-05-29 18:27:05
|
Update of /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/controller In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22543/src/net/heilancoo/portal/controller Modified Files: ControllerManager.java Added Files: AnnotationHelper.java StaticFiles.java Log Message: static file serving through session URIs Index: ControllerManager.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/controller/ControllerManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ControllerManager.java 28 May 2009 18:34:49 -0000 1.2 --- ControllerManager.java 29 May 2009 18:26:58 -0000 1.3 *************** *** 12,15 **** --- 12,16 ---- package net.heilancoo.portal.controller; + import java.io.File; import java.lang.reflect.Method; import java.util.HashMap; *************** *** 18,22 **** --- 19,26 ---- import net.heilancoo.portal.MimeTypeMapper; import net.heilancoo.portal.PortalPlugin; + import net.heilancoo.portal.responders.FileResponder; import net.heilancoo.portal.responders.Responder; + import net.heilancoo.portal.responses.ResponseHelper; + import net.heilancoo.utils.Utils; import org.apache.log4j.Logger; *************** *** 35,43 **** private final String exitPoint; private final Map<String, Responder> responders; private boolean stateOk; private boolean initialised; ! public ControllerManager(Class<?> targetClass, String defaultEntryPoint, String defaultExitPoint) { EntryPoint enp = targetClass.getAnnotation(EntryPoint.class); ExitPoint exp = targetClass.getAnnotation(ExitPoint.class); --- 39,51 ---- private final String exitPoint; private final Map<String, Responder> responders; + private final MimeTypeMapper mimeMapper; + private final Bundle bundle; + private final String logTag; private boolean stateOk; private boolean initialised; ! public ControllerManager(Class<?> targetClass, String logTag, String defaultEntryPoint, String defaultExitPoint, ! MimeTypeMapper mimeMapper, Bundle bundle) { EntryPoint enp = targetClass.getAnnotation(EntryPoint.class); ExitPoint exp = targetClass.getAnnotation(ExitPoint.class); *************** *** 49,55 **** this.initialised = false; this.stateOk = true; } ! public void initialiseMethods(Bundle bundle, String logTag, MimeTypeMapper mimeMapper) { if(initialised) { logger.error("Attempt at multiple initialisation of " + logTag + " class " + targetClass.getCanonicalName() + "."); --- 57,66 ---- this.initialised = false; this.stateOk = true; + this.mimeMapper = mimeMapper; + this.logTag = logTag; + this.bundle = bundle; } ! public void initialise() { if(initialised) { logger.error("Attempt at multiple initialisation of " + logTag + " class " + targetClass.getCanonicalName() + "."); *************** *** 57,60 **** --- 68,101 ---- } + initialiseMethods(); + initialiseStaticFiles(); + } + + private void initialiseStaticFiles() { + String templates = ResponseHelper.getTemplateFolder(targetClass); + StaticFiles stf = targetClass.getAnnotation(StaticFiles.class); + + if(stf == null) + return; + + logger.info("Initialising static files for " + logTag + " class " + targetClass.getCanonicalName() + "."); + + for(String f : stf.value()) { + String stem = f.substring(0, f.lastIndexOf('.')); + + if(responders.containsKey(stem)) { + logger.error("Static file " + f + " conflicts with other static file or responder method."); + stateOk = false; + } + + File file = new File(Utils.makePathFor(bundle, templates) + "/" + stem); + FileResponder fr = new FileResponder(file, mimeMapper, true); + responders.put(stem, fr); + } + + logger.info("Done initialising static files for " + logTag + " class " + targetClass.getCanonicalName() + "."); + } + + private void initialiseMethods() { logger.info("Initialising methods for " + logTag + " class " + targetClass.getCanonicalName() + "."); *************** *** 72,150 **** addResponder(methodName, g); } - // else if(m.getAnnotation(SubController.class) != null) { - // ControllerMaker c = new ControllerMaker(m); - // changers.put(methodName, c); - // logger.info("Controller change method " + c.getName() + " creates " + c.getNewControllerClassName() + "."); - // } } logger.info("Done initialising methods for " + logTag + " class " + targetClass.getCanonicalName() + "."); } ! ! // public void initialiseChangers(String logTag, Class<?> sessionClass, Map<Class<?>, ControllerManager> targetManagerMap) { ! // ChangeControllers vc = targetClass.getAnnotation(ChangeControllers.class); ! // ! // if(vc == null) ! // return; ! // ! // logger.info("Initialising target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! // ! // Class<?> [] changeTargets = vc.value(); ! // ! // for(Class<?> newTarget : changeTargets) { ! // ControllerManager newManager = targetManagerMap.get(newTarget); ! // ! // if(newManager == null) { ! // logger.error("Unknown target manager class " + newTarget.getCanonicalName() + "."); ! // stateOk = false; ! // continue; ! // } ! // ! // String entry = newManager.getEntryPoint(); ! // ! // if(responders.containsKey(entry)) { ! // logger.error("Responder method " + entry + " hides target changer in " + targetClass.getCanonicalName() + "."); ! // stateOk = false; ! // } ! // else if(!changers.containsKey(entry)) { ! // ControllerMaker c = new ControllerMaker(sessionClass, targetClass, newManager); ! // changers.put(newManager.getEntryPoint(), c); ! // logger.info("Controller change method " + c.getName() + " creates " + c.getNewControllerClassName() + "."); ! // } ! // else { ! // ControllerMaker c = changers.get(entry); ! // ! // if(!c.getNewControllerClassName().equals(newTarget.getCanonicalName())) { ! // logger.error("Controller change method " + c.getName() ! // + " in " + targetClass.getCanonicalName() ! // + " cannot create both " + c.getNewControllerClassName() ! // + " and " + newTarget.getCanonicalName() + "."); ! // stateOk = false; ! // } ! // } ! // } ! // ! // logger.info("Done initialising target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! // } ! ! // public void checkChangers(String logTag, Map<Class<?>, ControllerManager> targetManagerMap) { ! // logger.info("Checking target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! // ! // for(Map.Entry<String, ControllerMaker> e : changers.entrySet()) { ! // String req = e.getKey(); ! // ControllerMaker chng = e.getValue(); ! // Class<?> newClass = chng.getNewControllerClass(); ! // ControllerManager mgr = targetManagerMap.get(newClass); ! // ! // if(!mgr.handlesRequest(req)) { ! // logger.error("Target changer " + req + " has no corresponding response method in " ! // + newClass.getCanonicalName() + "."); ! // stateOk = false; ! // } ! // } ! // ! // logger.info("Done checking target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! // } ! public boolean wrapUpInitialisations(String logTag) { logger.info("Summarize initialisation for " + logTag + " class " + targetClass.getCanonicalName() + "."); --- 113,121 ---- addResponder(methodName, g); } } logger.info("Done initialising methods for " + logTag + " class " + targetClass.getCanonicalName() + "."); } ! public boolean wrapUpInitialisations(String logTag) { logger.info("Summarize initialisation for " + logTag + " class " + targetClass.getCanonicalName() + "."); *************** *** 152,158 **** logger.info("Found " + responders.size() + " response method(s)."); - // if(changers.size() > 0) - // logger.info("Found " + changers.size() + " controller change method(s)."); - // logger.info("Entry point " + entryPoint + "."); --- 123,126 ---- --- NEW FILE: AnnotationHelper.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.portal.controller; import java.util.ArrayList; import java.util.List; /** * @author joerg * */ public class AnnotationHelper { public static List<Class<?>> getControllersFor(Class<?> sessionClass) { List<Class<?>> ctrls = new ArrayList<Class<?>>(); SubController sub = sessionClass.getAnnotation(SubController.class); if(sub != null) ctrls.add(sub.controller()); SubControllers subs = sessionClass.getAnnotation(SubControllers.class); if(subs != null) for(SubController s : subs.value()) ctrls.add(s.controller()); if(ctrls.size() == 0) ctrls.add(sessionClass); return ctrls; } } --- NEW FILE: StaticFiles.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.portal.controller; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @author joerg * */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface StaticFiles { String[] value(); } |
From: Joerg B. <jb...@us...> - 2009-05-29 18:27:02
|
Update of /cvsroot/lipog/net.heilancoo.bingo/src/net/heilancoo/bingo In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22519/src/net/heilancoo/bingo Modified Files: BingoSession.java Log Message: static file serving through session URIs Index: BingoSession.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.bingo/src/net/heilancoo/bingo/BingoSession.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BingoSession.java 28 May 2009 18:34:39 -0000 1.10 --- BingoSession.java 29 May 2009 18:26:52 -0000 1.11 *************** *** 13,16 **** --- 13,17 ---- import net.heilancoo.portal.controller.Request; + import net.heilancoo.portal.controller.StaticFiles; import net.heilancoo.portal.freemarker.FreeMarkerModel; import net.heilancoo.portal.htmlforms.FormFieldContainer; *************** *** 26,29 **** --- 27,31 ---- * */ + @StaticFiles({ "a-static-file.txt" }) public class BingoSession implements Session { |
From: Joerg B. <jb...@us...> - 2009-05-29 18:27:02
|
Update of /cvsroot/lipog/net.heilancoo.portal.freemarker/src/net/heilancoo/portal/freemarker In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22534/src/net/heilancoo/portal/freemarker Modified Files: FreeMarkerResponder.java Log Message: static file serving through session URIs Index: FreeMarkerResponder.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.freemarker/src/net/heilancoo/portal/freemarker/FreeMarkerResponder.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FreeMarkerResponder.java 12 May 2009 16:15:19 -0000 1.11 --- FreeMarkerResponder.java 29 May 2009 18:26:55 -0000 1.12 *************** *** 24,28 **** import net.heilancoo.portal.responders.ResponderCreationException; import net.heilancoo.portal.responses.DefaultResponseFormat; ! import net.heilancoo.portal.responses.ResponseTemplateFolder; import net.heilancoo.portal.responses.ValidResponseFormats; import net.heilancoo.utils.Utils; --- 24,28 ---- import net.heilancoo.portal.responders.ResponderCreationException; import net.heilancoo.portal.responses.DefaultResponseFormat; ! import net.heilancoo.portal.responses.ResponseHelper; import net.heilancoo.portal.responses.ValidResponseFormats; import net.heilancoo.utils.Utils; *************** *** 94,100 **** logger.info("Default response format is " + defaultResponseFormat + "."); ! ResponseTemplateFolder rtf = method.getDeclaringClass().getAnnotation(ResponseTemplateFolder.class); ! ! templateFolder = rtf != null ? rtf.value() : "templates"; boolean stateOk = true; --- 94,98 ---- logger.info("Default response format is " + defaultResponseFormat + "."); ! templateFolder = ResponseHelper.getTemplateFolder(method.getDeclaringClass()); boolean stateOk = true; |
From: Joerg B. <jb...@us...> - 2009-05-29 18:27:01
|
Update of /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/application In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22543/src/net/heilancoo/portal/application Modified Files: ApplicationRequestHandler.java Log Message: static file serving through session URIs Index: ApplicationRequestHandler.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/application/ApplicationRequestHandler.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ApplicationRequestHandler.java 28 May 2009 18:34:49 -0000 1.18 --- ApplicationRequestHandler.java 29 May 2009 18:26:58 -0000 1.19 *************** *** 18,22 **** import java.io.Reader; import java.lang.reflect.InvocationTargetException; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; --- 18,21 ---- *************** *** 27,34 **** import net.heilancoo.portal.MimeTypeMapper; import net.heilancoo.portal.PortalPlugin; import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.ControllerManager; - import net.heilancoo.portal.controller.SubController; - import net.heilancoo.portal.controller.SubControllers; import net.heilancoo.portal.htmlforms.FormFieldAccessException; import net.heilancoo.portal.htmlforms.FormFieldContainer; --- 26,32 ---- import net.heilancoo.portal.MimeTypeMapper; import net.heilancoo.portal.PortalPlugin; + import net.heilancoo.portal.controller.AnnotationHelper; import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.ControllerManager; import net.heilancoo.portal.htmlforms.FormFieldAccessException; import net.heilancoo.portal.htmlforms.FormFieldContainer; *************** *** 151,174 **** } - private List<Class<?>> getControllersFor(Class<?> sessionClass) { - List<Class<?>> ctrls = new ArrayList<Class<?>>(); - - SubController sub = sessionClass.getAnnotation(SubController.class); - - if(sub != null) - ctrls.add(sub.controller()); - - SubControllers subs = sessionClass.getAnnotation(SubControllers.class); - - if(subs != null) - for(SubController s : subs.value()) - ctrls.add(s.controller()); - - if(ctrls.size() == 0) - ctrls.add(sessionClass); - - return ctrls; - } - public boolean initialise(Bundle bundle, Application application, String uriPrefix, String name, String description, String mimeConfig, String configFile) { --- 149,152 ---- *************** *** 207,211 **** for(Class<?> sessionClass : sessionClasses) { ! List<Class<?>> ctrls = getControllersFor(sessionClass); for(Class<?> controllerClass : ctrls) --- 185,189 ---- for(Class<?> sessionClass : sessionClasses) { ! List<Class<?>> ctrls = AnnotationHelper.getControllersFor(sessionClass); for(Class<?> controllerClass : ctrls) *************** *** 225,233 **** private boolean initialiseApplication(Bundle bundle) { ! ControllerManager tm = new ControllerManager(application.getClass(), "login", null); ! controllerManagerMap.put(application.getClass(), tm); ! tm.addResponder(tm.getEntryPoint(), new FileResponder(getLoginPage(), mimeMapper)); tm.addResponder("login-validate", new Responder() { @Override --- 203,212 ---- private boolean initialiseApplication(Bundle bundle) { ! Class<?> appClass = application.getClass(); ! ControllerManager tm = new ControllerManager(appClass, "application", "login", null, mimeMapper, bundle); ! controllerManagerMap.put(appClass, tm); ! tm.addResponder(tm.getEntryPoint(), new FileResponder(getLoginPage(), mimeMapper, false)); tm.addResponder("login-validate", new Responder() { @Override *************** *** 239,262 **** }); ! tm.initialiseMethods(bundle, "application", mimeMapper); return tm.wrapUpInitialisations("application"); } private void initialiseController(Class<?> sessionClass, String logTag, Bundle bundle) { ! ControllerManager tm = new ControllerManager(sessionClass, "main", "logout"); controllerManagerMap.put(sessionClass, tm); ! tm.addResponder(tm.getExitPoint(), new Responder() { ! @Override ! public boolean execute(Controller target, String format, ! HttpRequest request, FormFieldContainer fields, ! HttpResponse response, HttpContext context) throws Exception { ! FileRequestHandler.serveFile(getLogoutPage(), request, response, context, mimeMapper, false); ! return true; ! } ! }); ! tm.initialiseMethods(bundle, logTag, mimeMapper); } --- 218,234 ---- }); ! tm.initialise(); ! return tm.wrapUpInitialisations("application"); } private void initialiseController(Class<?> sessionClass, String logTag, Bundle bundle) { ! ControllerManager tm = new ControllerManager(sessionClass, "controller", "main", "logout", mimeMapper, bundle); controllerManagerMap.put(sessionClass, tm); ! tm.addResponder(tm.getExitPoint(), new FileResponder(getLogoutPage(), mimeMapper, false)); ! tm.initialise(); } |
From: Joerg B. <jb...@us...> - 2009-05-29 18:27:00
|
Update of /cvsroot/lipog/net.heilancoo.bingo/templates In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22519/templates Modified Files: main.html Added Files: a-static-file.txt Log Message: static file serving through session URIs --- NEW FILE: a-static-file.txt --- Some static file content, accessible through URI's directly inside the session. Index: main.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.bingo/templates/main.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.html 23 Apr 2009 22:13:42 -0000 1.2 --- main.html 29 May 2009 18:26:52 -0000 1.3 *************** *** 14,17 **** --- 14,18 ---- <p>Try the other page as <a href="other">plain text</a>.</p> <p>Or: <a href="logout">Log out</a>.</p> + <p>Or better yet: look at some <a href="a-static-file.txt">static file</a> content.</p> </body> </html> \ No newline at end of file |
From: Joerg B. <jb...@us...> - 2009-05-28 18:43:48
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15696/doc Modified Files: change-log.html Log Message: sub-controllers Index: change-log.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/change-log.html,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** change-log.html 11 May 2009 20:37:32 -0000 1.20 --- change-log.html 28 May 2009 18:43:35 -0000 1.21 *************** *** 11,22 **** <h2>Release 4 (upcoming)</h2> <ul> <li>Better form field access error handling.</li> <li>Command line option "--log=<i>FILE</i>" to log to (rolling) log file(s) instead of the console.</li> - <li>Request target (controller) changing improved and simplified (@ChangeControllers annotation).</li> <li>Form field decoding is now done much later, just before the form fields are actually needed; as a consequence in cases of malformed URIs or bad session keys form fields will not be decoded at all which saves resources.</li> <li>The Gizmo now identifies itself as 'Little-Portal-Gizmo/1.1'</li> ! <li>Delegate request processing to controllers. Be able to switch controllers by means of controller change requests (marked up with the @ChangeController annotation)</li> </ul> --- 11,24 ---- <h2>Release 4 (upcoming)</h2> <ul> + <li>Introduced session sub-controllers. Identified by a sub-controller key in the URI (between session + key and request method name) there can now be more than one active controllers.</li> <li>Better form field access error handling.</li> <li>Command line option "--log=<i>FILE</i>" to log to (rolling) log file(s) instead of the console.</li> <li>Form field decoding is now done much later, just before the form fields are actually needed; as a consequence in cases of malformed URIs or bad session keys form fields will not be decoded at all which saves resources.</li> <li>The Gizmo now identifies itself as 'Little-Portal-Gizmo/1.1'</li> ! <li>**REPLACED BY SUB-CONTROLLERS** Request target (controller) changing improved and simplified (@ChangeControllers annotation).</li> ! <li>**REPLACED BY SUB-CONTROLLERS** Delegate request processing to controllers. Be able to switch controllers by means of controller change requests (marked up with the @ChangeController annotation)</li> </ul> |
From: Joerg B. <jb...@us...> - 2009-05-28 18:35:06
|
Update of /cvsroot/lipog/net.heilancoo.portal.examples/templates In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14714/templates Modified Files: export.html main.html prefs.html Log Message: dropped the concept of controller changers; introduced subcontrollers instead Index: prefs.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.examples/templates/prefs.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** prefs.html 1 May 2009 13:42:47 -0000 1.1 --- prefs.html 28 May 2009 18:34:43 -0000 1.2 *************** *** 11,15 **** <p>access count = ${s.access}</p> <p>Try this page again in <a href="prefs">HTML</a>.</p> ! <p>Or: go back to <a href="main">normal operation</a>.</p> </body> </html> \ No newline at end of file --- 11,15 ---- <p>access count = ${s.access}</p> <p>Try this page again in <a href="prefs">HTML</a>.</p> ! <p>Or: go back to <a href="../main">normal operation</a>.</p> </body> </html> \ No newline at end of file Index: export.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.examples/templates/export.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** export.html 10 May 2009 19:51:40 -0000 1.1 --- export.html 28 May 2009 18:34:43 -0000 1.2 *************** *** 10,15 **** <p>serial = ${s.getSerial()}</p> <p>access count = ${s.getAccess()}</p> ! <p>Go back to <a href="main">main</a>.</p> ! <p>Or: change your <a href="prefs">preferences</a>.</p> <p>Or: <a href="logout">Log out</a>.</p> </body> --- 10,15 ---- <p>serial = ${s.getSerial()}</p> <p>access count = ${s.getAccess()}</p> ! <p>Go back to <a href="../main">main</a>.</p> ! <p>Or: change your <a href="../p/prefs">preferences</a>.</p> <p>Or: <a href="logout">Log out</a>.</p> </body> Index: main.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.examples/templates/main.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.html 10 May 2009 19:51:40 -0000 1.2 --- main.html 28 May 2009 18:34:43 -0000 1.3 *************** *** 13,18 **** <p>Try the other page in <a href="other.html">HTML</a>.</p> <p>Try the other page as <a href="other">plain text</a>.</p> ! <p>Or: visit your <a href="export">export</a>.</p> ! <p>Or: change your <a href="prefs">preferences</a>.</p> <p>Or: <a href="logout">Log out</a>.</p> </body> --- 13,18 ---- <p>Try the other page in <a href="other.html">HTML</a>.</p> <p>Try the other page as <a href="other">plain text</a>.</p> ! <p>Or: visit your <a href="e/export">export</a>.</p> ! <p>Or: change your <a href="p/prefs">preferences</a>.</p> <p>Or: <a href="logout">Log out</a>.</p> </body> |
From: Joerg B. <jb...@us...> - 2009-05-28 18:35:01
|
Update of /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/session In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14752/src/net/heilancoo/portal/session Modified Files: Session.java SessionCompound.java Added Files: SessionManager.java Log Message: dropped the concept of controller changers; introduced subcontrollers instead Index: SessionCompound.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/session/SessionCompound.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SessionCompound.java 12 May 2009 16:15:13 -0000 1.4 --- SessionCompound.java 28 May 2009 18:34:49 -0000 1.5 *************** *** 12,22 **** package net.heilancoo.portal.session; import net.heilancoo.portal.controller.Controller; /** * A SessionCompound is a bit more than a Session. It is a Session plus ! * the currently active Controller of that Session. The active ! * controller of a session is the active RequestTarget, the object ! * HTTP requests will be run against. * <p> * The SessionCompound is not normally visible to Gizmo web --- 12,24 ---- package net.heilancoo.portal.session; + import java.lang.reflect.InvocationTargetException; + + import org.apache.log4j.Logger; + import net.heilancoo.portal.controller.Controller; /** * A SessionCompound is a bit more than a Session. It is a Session plus ! * the Controllers of that Session. * <p> * The SessionCompound is not normally visible to Gizmo web *************** *** 28,53 **** public class SessionCompound { private final Session session; ! private Controller controller; ! public SessionCompound(Session session) { this.session = session; ! this.controller = session.getInitialController(); ! ! if(controller == null) ! this.controller = session; } ! public Session getSession() { ! return session; } ! ! public void setController(Controller controller) { ! this.controller = controller; } ! public Controller getController() { ! return controller; } --- 30,72 ---- public class SessionCompound { + private static final Logger logger = Logger.getLogger(SessionCompound.class); + private final Session session; ! private SessionManager sessionManager; ! private Controller [] controllers; ! public SessionCompound(Session session, SessionManager sessionManager) { this.session = session; + this.sessionManager = sessionManager; + this.controllers = new Controller[sessionManager.size()]; ! if(sessionManager.getManager("").getTargetClass().equals(session.getClass())) ! this.controllers[0] = session; } ! public SessionManager getManager() { ! return sessionManager; } ! ! public Controller getController(String key) { ! int i = sessionManager.getIndexForKey(key); ! ! if(controllers[i] == null) { ! try { ! controllers[i] = sessionManager.makeController(i, session); ! } ! catch (InvocationTargetException e) { ! logger.error("Problem when making controller.", e.getTargetException()); ! } ! catch (Exception e) { ! logger.error("Problem when making controller.", e); ! } ! } ! ! return controllers[i]; } ! public Session getSession() { ! return session; } Index: Session.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/session/Session.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Session.java 15 May 2009 19:20:58 -0000 1.7 --- Session.java 28 May 2009 18:34:49 -0000 1.8 *************** *** 20,24 **** public interface Session extends Controller { - public Controller getInitialController(); - } --- 20,22 ---- --- NEW FILE: SessionManager.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.portal.session; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.ControllerMaker; import net.heilancoo.portal.controller.ControllerManager; import net.heilancoo.portal.controller.SubController; import net.heilancoo.portal.controller.SubControllers; /** * @author joerg * */ public class SessionManager { private Map<String, Integer> controllerIndices; private List<ControllerMaker> controllerMakers; private List<ControllerManager> controllerManagers; public SessionManager(Class<?> sessionClass, Map<Class<?>, ControllerManager> controllerManagerMap) { this.controllerIndices = new HashMap<String, Integer>(); this.controllerMakers = new ArrayList<ControllerMaker>(); this.controllerManagers = new ArrayList<ControllerManager>(); addControllerForKey("", sessionClass, sessionClass, controllerManagerMap); SubController sub = sessionClass.getAnnotation(SubController.class); if(sub != null) addControllerForKey(sub.key(), sub.controller(), sessionClass, controllerManagerMap); SubControllers subs = sessionClass.getAnnotation(SubControllers.class); if(subs != null) for(SubController s : subs.value()) addControllerForKey(s.key(), s.controller(), sessionClass, controllerManagerMap); } private void addControllerForKey(String key, Class<?> controllerClass, Class<?> sessionClass, Map<Class<?>, ControllerManager> controllerManagerMap) { int index; ControllerMaker mkr = new ControllerMaker(sessionClass, controllerClass); ControllerManager mgr = controllerManagerMap.get(controllerClass); if(controllerIndices.containsKey(key)) { index = controllerIndices.get(key); controllerMakers.set(index, mkr); controllerManagers.set(index, mgr); } else { index = controllerMakers.size(); controllerIndices.put(key, index); controllerMakers.add(mkr); controllerManagers.add(mgr); } } public int size() { return controllerManagers.size(); } public int getIndexForKey(String key) { return controllerIndices.get(key); } public ControllerManager getManager(int i) { return controllerManagers.get(i); } public ControllerManager getManager(String key) { return controllerManagers.get(getIndexForKey(key)); } public Controller makeController(int i, Session s) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { return controllerMakers.get(i).createNew(s); } } |
From: Joerg B. <jb...@us...> - 2009-05-28 18:35:00
|
Update of /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/controller In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14752/src/net/heilancoo/portal/controller Modified Files: ControllerManager.java Added Files: ControllerMaker.java SubControllers.java SubController.java Removed Files: ChangeControllers.java ValidControllers.java ChangeController.java ControllerChanger.java Log Message: dropped the concept of controller changers; introduced subcontrollers instead --- ChangeControllers.java DELETED --- --- NEW FILE: SubControllers.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.portal.controller; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @author joerg * */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface SubControllers { SubController[] value(); } Index: ControllerManager.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/controller/ControllerManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ControllerManager.java 12 May 2009 16:15:13 -0000 1.1 --- ControllerManager.java 28 May 2009 18:34:49 -0000 1.2 *************** *** 35,39 **** private final String exitPoint; private final Map<String, Responder> responders; - private final Map<String, ControllerChanger> changers; private boolean stateOk; --- 35,38 ---- *************** *** 46,50 **** this.targetClass = targetClass; this.responders = new HashMap<String, Responder>(); - this.changers = new HashMap<String, ControllerChanger>(); this.entryPoint = enp != null ? enp.value() : defaultEntryPoint; this.exitPoint = defaultEntryPoint == null ? null : (exp != null ? exp.value() : defaultExitPoint); --- 45,48 ---- *************** *** 74,82 **** addResponder(methodName, g); } ! else if(m.getAnnotation(ChangeController.class) != null) { ! ControllerChanger c = new ControllerChanger(m); ! changers.put(methodName, c); ! logger.info("Controller change method " + c.getName() + " creates " + c.getNewControllerClassName() + "."); ! } } --- 72,80 ---- addResponder(methodName, g); } ! // else if(m.getAnnotation(SubController.class) != null) { ! // ControllerMaker c = new ControllerMaker(m); ! // changers.put(methodName, c); ! // logger.info("Controller change method " + c.getName() + " creates " + c.getNewControllerClassName() + "."); ! // } } *************** *** 84,151 **** } ! public void initialiseChangers(String logTag, Class<?> sessionClass, Map<Class<?>, ControllerManager> targetManagerMap) { ! ChangeControllers vc = targetClass.getAnnotation(ChangeControllers.class); ! ! if(vc == null) ! return; ! ! logger.info("Initialising target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! ! Class<?> [] changeTargets = vc.value(); ! ! for(Class<?> newTarget : changeTargets) { ! ControllerManager newManager = targetManagerMap.get(newTarget); ! ! if(newManager == null) { ! logger.error("Unknown target manager class " + newTarget.getCanonicalName() + "."); ! stateOk = false; ! continue; ! } ! ! String entry = newManager.getEntryPoint(); ! ! if(responders.containsKey(entry)) { ! logger.error("Responder method " + entry + " hides target changer in " + targetClass.getCanonicalName() + "."); ! stateOk = false; ! } ! else if(!changers.containsKey(entry)) { ! ControllerChanger c = new ControllerChanger(sessionClass, targetClass, newManager); ! changers.put(newManager.getEntryPoint(), c); ! logger.info("Controller change method " + c.getName() + " creates " + c.getNewControllerClassName() + "."); ! } ! else { ! ControllerChanger c = changers.get(entry); ! ! if(!c.getNewControllerClassName().equals(newTarget.getCanonicalName())) { ! logger.error("Controller change method " + c.getName() ! + " in " + targetClass.getCanonicalName() ! + " cannot create both " + c.getNewControllerClassName() ! + " and " + newTarget.getCanonicalName() + "."); ! stateOk = false; ! } ! } ! } ! ! logger.info("Done initialising target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! } ! public void checkChangers(String logTag, Map<Class<?>, ControllerManager> targetManagerMap) { ! logger.info("Checking target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! ! for(Map.Entry<String, ControllerChanger> e : changers.entrySet()) { ! String req = e.getKey(); ! ControllerChanger chng = e.getValue(); ! Class<?> newClass = chng.getNewControllerClass(); ! ControllerManager mgr = targetManagerMap.get(newClass); ! ! if(!mgr.handlesRequest(req)) { ! logger.error("Target changer " + req + " has no corresponding response method in " ! + newClass.getCanonicalName() + "."); ! stateOk = false; ! } ! } ! ! logger.info("Done checking target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! } public boolean wrapUpInitialisations(String logTag) { --- 82,149 ---- } ! // public void initialiseChangers(String logTag, Class<?> sessionClass, Map<Class<?>, ControllerManager> targetManagerMap) { ! // ChangeControllers vc = targetClass.getAnnotation(ChangeControllers.class); ! // ! // if(vc == null) ! // return; ! // ! // logger.info("Initialising target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! // ! // Class<?> [] changeTargets = vc.value(); ! // ! // for(Class<?> newTarget : changeTargets) { ! // ControllerManager newManager = targetManagerMap.get(newTarget); ! // ! // if(newManager == null) { ! // logger.error("Unknown target manager class " + newTarget.getCanonicalName() + "."); ! // stateOk = false; ! // continue; ! // } ! // ! // String entry = newManager.getEntryPoint(); ! // ! // if(responders.containsKey(entry)) { ! // logger.error("Responder method " + entry + " hides target changer in " + targetClass.getCanonicalName() + "."); ! // stateOk = false; ! // } ! // else if(!changers.containsKey(entry)) { ! // ControllerMaker c = new ControllerMaker(sessionClass, targetClass, newManager); ! // changers.put(newManager.getEntryPoint(), c); ! // logger.info("Controller change method " + c.getName() + " creates " + c.getNewControllerClassName() + "."); ! // } ! // else { ! // ControllerMaker c = changers.get(entry); ! // ! // if(!c.getNewControllerClassName().equals(newTarget.getCanonicalName())) { ! // logger.error("Controller change method " + c.getName() ! // + " in " + targetClass.getCanonicalName() ! // + " cannot create both " + c.getNewControllerClassName() ! // + " and " + newTarget.getCanonicalName() + "."); ! // stateOk = false; ! // } ! // } ! // } ! // ! // logger.info("Done initialising target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! // } ! // public void checkChangers(String logTag, Map<Class<?>, ControllerManager> targetManagerMap) { ! // logger.info("Checking target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! // ! // for(Map.Entry<String, ControllerMaker> e : changers.entrySet()) { ! // String req = e.getKey(); ! // ControllerMaker chng = e.getValue(); ! // Class<?> newClass = chng.getNewControllerClass(); ! // ControllerManager mgr = targetManagerMap.get(newClass); ! // ! // if(!mgr.handlesRequest(req)) { ! // logger.error("Target changer " + req + " has no corresponding response method in " ! // + newClass.getCanonicalName() + "."); ! // stateOk = false; ! // } ! // } ! // ! // logger.info("Done checking target changers for " + logTag + " class " + targetClass.getCanonicalName() + "."); ! // } public boolean wrapUpInitialisations(String logTag) { *************** *** 154,160 **** logger.info("Found " + responders.size() + " response method(s)."); ! if(changers.size() > 0) ! logger.info("Found " + changers.size() + " controller change method(s)."); ! logger.info("Entry point " + entryPoint + "."); --- 152,158 ---- logger.info("Found " + responders.size() + " response method(s)."); ! // if(changers.size() > 0) ! // logger.info("Found " + changers.size() + " controller change method(s)."); ! // logger.info("Entry point " + entryPoint + "."); *************** *** 201,208 **** } - public ControllerChanger getChanger(String request) { - return changers.get(request); - } - public Responder getResponder(String request) { return responders.get(request); --- 199,202 ---- --- NEW FILE: ControllerMaker.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.portal.controller; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import net.heilancoo.portal.session.Session; /** * @author joerg * */ public class ControllerMaker { private final Class<?> controllerClass; private Method initialiser; private Constructor<?> constructor; public ControllerMaker(Class<?> sessionClass, Class<?> controllerClass) { this.controllerClass = controllerClass; for(Constructor<?> c : controllerClass.getConstructors()) { Class<?> p[] = c.getParameterTypes(); if(p.length == 1 && p[0].equals(sessionClass)) { this.constructor = c; break; } } if(this.constructor == null) for(Method m : controllerClass.getMethods()) if(m.getName().equals("initialise")) { Class<?> p[] = m.getParameterTypes(); if(p.length == 1 && p[0].equals(sessionClass)) { this.initialiser = m; break; } } } public Controller createNew(Session s) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Controller o; if(constructor != null) o = (Controller) constructor.newInstance(s); else { o = (Controller) controllerClass.newInstance(); if(initialiser != null) initialiser.invoke(o, s); } return o; } } --- ChangeController.java DELETED --- --- ControllerChanger.java DELETED --- --- ValidControllers.java DELETED --- --- NEW FILE: SubController.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.portal.controller; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @author joerg * */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface SubController { String key(); Class<?> controller(); } |
From: Joerg B. <jb...@us...> - 2009-05-28 18:34:59
|
Update of /cvsroot/lipog/net.heilancoo.portal.test/src/net/heilancoo/portal/webapps/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14733/src/net/heilancoo/portal/webapps/test Modified Files: SessionWithCustomDefaultResponseFormat.java SessionWithMultipleResponseFormats.java SimpleSession.java SessionWithMultipleResponseFormatsTemplateMissing.java SimpleSessionMainEntryMissing.java SessionWithCustomTemplateFolder.java SessionWithCustomEntry.java Log Message: dropped the concept of controller changers; introduced subcontrollers instead Index: SimpleSession.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.test/src/net/heilancoo/portal/webapps/test/SimpleSession.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SimpleSession.java 15 May 2009 19:21:05 -0000 1.6 --- SimpleSession.java 28 May 2009 18:34:46 -0000 1.7 *************** *** 12,16 **** package net.heilancoo.portal.webapps.test; - import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.freemarker.FreeMarkerModel; --- 12,15 ---- *************** *** 37,44 **** HttpResponse response, HttpContext context, FreeMarkerModel model) { } - - @Override - public Controller getInitialController() { - return null; - } } --- 36,38 ---- Index: SessionWithCustomDefaultResponseFormat.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.test/src/net/heilancoo/portal/webapps/test/SessionWithCustomDefaultResponseFormat.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SessionWithCustomDefaultResponseFormat.java 15 May 2009 19:21:05 -0000 1.7 --- SessionWithCustomDefaultResponseFormat.java 28 May 2009 18:34:46 -0000 1.8 *************** *** 12,16 **** package net.heilancoo.portal.webapps.test; - import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.freemarker.FreeMarkerModel; --- 12,15 ---- *************** *** 42,49 **** } - @Override - public Controller getInitialController() { - return null; - } - } --- 41,43 ---- Index: SessionWithCustomEntry.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.test/src/net/heilancoo/portal/webapps/test/SessionWithCustomEntry.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SessionWithCustomEntry.java 15 May 2009 19:21:05 -0000 1.5 --- SessionWithCustomEntry.java 28 May 2009 18:34:46 -0000 1.6 *************** *** 12,16 **** package net.heilancoo.portal.webapps.test; - import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.EntryPoint; import net.heilancoo.portal.controller.Request; --- 12,15 ---- *************** *** 39,46 **** HttpResponse response, HttpContext context, FreeMarkerModel model) { } - - @Override - public Controller getInitialController() { - return null; - } } --- 38,40 ---- Index: SessionWithMultipleResponseFormats.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.test/src/net/heilancoo/portal/webapps/test/SessionWithMultipleResponseFormats.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SessionWithMultipleResponseFormats.java 15 May 2009 19:21:05 -0000 1.6 --- SessionWithMultipleResponseFormats.java 28 May 2009 18:34:46 -0000 1.7 *************** *** 12,16 **** package net.heilancoo.portal.webapps.test; - import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.freemarker.FreeMarkerModel; --- 12,15 ---- *************** *** 36,43 **** HttpResponse response, HttpContext context, FreeMarkerModel model) { } - - @Override - public Controller getInitialController() { - return null; - } } --- 35,37 ---- Index: SessionWithCustomTemplateFolder.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.test/src/net/heilancoo/portal/webapps/test/SessionWithCustomTemplateFolder.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SessionWithCustomTemplateFolder.java 15 May 2009 19:21:05 -0000 1.6 --- SessionWithCustomTemplateFolder.java 28 May 2009 18:34:46 -0000 1.7 *************** *** 12,16 **** package net.heilancoo.portal.webapps.test; - import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.freemarker.FreeMarkerModel; --- 12,15 ---- *************** *** 35,42 **** } - @Override - public Controller getInitialController() { - return null; - } - } --- 34,36 ---- Index: SessionWithMultipleResponseFormatsTemplateMissing.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.test/src/net/heilancoo/portal/webapps/test/SessionWithMultipleResponseFormatsTemplateMissing.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SessionWithMultipleResponseFormatsTemplateMissing.java 15 May 2009 19:21:05 -0000 1.6 --- SessionWithMultipleResponseFormatsTemplateMissing.java 28 May 2009 18:34:46 -0000 1.7 *************** *** 12,16 **** package net.heilancoo.portal.webapps.test; - import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.freemarker.FreeMarkerModel; --- 12,15 ---- *************** *** 36,43 **** HttpResponse response, HttpContext context, FreeMarkerModel model) { } - - @Override - public Controller getInitialController() { - return null; - } } --- 35,37 ---- Index: SimpleSessionMainEntryMissing.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.test/src/net/heilancoo/portal/webapps/test/SimpleSessionMainEntryMissing.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SimpleSessionMainEntryMissing.java 15 May 2009 19:21:05 -0000 1.6 --- SimpleSessionMainEntryMissing.java 28 May 2009 18:34:46 -0000 1.7 *************** *** 12,16 **** package net.heilancoo.portal.webapps.test; - import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.session.Session; --- 12,15 ---- *************** *** 21,28 **** public class SimpleSessionMainEntryMissing implements Session { - @Override - public Controller getInitialController() { - return null; - } - } --- 20,22 ---- |
From: Joerg B. <jb...@us...> - 2009-05-28 18:34:52
|
Update of /cvsroot/lipog/net.heilancoo.bingo/src/net/heilancoo/bingo In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14696/src/net/heilancoo/bingo Modified Files: BingoSession.java Log Message: dropped the concept of controller changers; introduced subcontrollers instead Index: BingoSession.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.bingo/src/net/heilancoo/bingo/BingoSession.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BingoSession.java 15 May 2009 19:21:11 -0000 1.9 --- BingoSession.java 28 May 2009 18:34:39 -0000 1.10 *************** *** 12,16 **** package net.heilancoo.bingo; - import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.freemarker.FreeMarkerModel; --- 12,15 ---- *************** *** 43,55 **** } - /* - * (non-Javadoc) - * @see net.heilancoo.portal.session.Session#getInitialController() - */ - @Override - public Controller getInitialController() { - return null; - } - @Request public void main(HttpRequest request, FormFieldContainer fields, --- 42,45 ---- |
From: Joerg B. <jb...@us...> - 2009-05-28 18:34:52
|
Update of /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/application In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14752/src/net/heilancoo/portal/application Modified Files: ApplicationRequestHandler.java Log Message: dropped the concept of controller changers; introduced subcontrollers instead Index: ApplicationRequestHandler.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/application/ApplicationRequestHandler.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ApplicationRequestHandler.java 24 May 2009 16:17:58 -0000 1.17 --- ApplicationRequestHandler.java 28 May 2009 18:34:49 -0000 1.18 *************** *** 18,22 **** --- 18,24 ---- import java.io.Reader; import java.lang.reflect.InvocationTargetException; + import java.util.ArrayList; import java.util.HashMap; + import java.util.List; import java.util.Map; import java.util.Properties; *************** *** 26,32 **** import net.heilancoo.portal.PortalPlugin; import net.heilancoo.portal.controller.Controller; - import net.heilancoo.portal.controller.ControllerChanger; import net.heilancoo.portal.controller.ControllerManager; ! import net.heilancoo.portal.controller.ValidControllers; import net.heilancoo.portal.htmlforms.FormFieldAccessException; import net.heilancoo.portal.htmlforms.FormFieldContainer; --- 28,34 ---- import net.heilancoo.portal.PortalPlugin; import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.ControllerManager; ! import net.heilancoo.portal.controller.SubController; ! import net.heilancoo.portal.controller.SubControllers; import net.heilancoo.portal.htmlforms.FormFieldAccessException; import net.heilancoo.portal.htmlforms.FormFieldContainer; *************** *** 39,42 **** --- 41,45 ---- import net.heilancoo.portal.session.Session; import net.heilancoo.portal.session.SessionCompound; + import net.heilancoo.portal.session.SessionManager; import net.heilancoo.utils.Utils; *************** *** 58,62 **** private final Map<String, SessionCompound> sessionMap; ! private final Map<Class<?>, ControllerManager> targetManagerMap; private final MimeTypeMapper mimeMapper; --- 61,66 ---- private final Map<String, SessionCompound> sessionMap; ! private final Map<Class<?>, ControllerManager> controllerManagerMap; ! private final Map<Class<?>, SessionManager> sessionManagerMap; private final MimeTypeMapper mimeMapper; *************** *** 86,93 **** public ApplicationRequestHandler() { ! this.randy = new KeyGenerator(new Random().nextLong()); ! this.sessionMap = new HashMap<String, SessionCompound>(); ! this.targetManagerMap = new HashMap<Class<?>, ControllerManager>(); ! this.mimeMapper = new MimeTypeMapper(); } --- 90,98 ---- public ApplicationRequestHandler() { ! this.randy = new KeyGenerator(new Random().nextLong()); ! this.sessionMap = new HashMap<String, SessionCompound>(); ! this.controllerManagerMap = new HashMap<Class<?>, ControllerManager>(); ! this.sessionManagerMap = new HashMap<Class<?>, SessionManager>(); ! this.mimeMapper = new MimeTypeMapper(); } *************** *** 146,149 **** --- 151,174 ---- } + private List<Class<?>> getControllersFor(Class<?> sessionClass) { + List<Class<?>> ctrls = new ArrayList<Class<?>>(); + + SubController sub = sessionClass.getAnnotation(SubController.class); + + if(sub != null) + ctrls.add(sub.controller()); + + SubControllers subs = sessionClass.getAnnotation(SubControllers.class); + + if(subs != null) + for(SubController s : subs.value()) + ctrls.add(s.controller()); + + if(ctrls.size() == 0) + ctrls.add(sessionClass); + + return ctrls; + } + public boolean initialise(Bundle bundle, Application application, String uriPrefix, String name, String description, String mimeConfig, String configFile) { *************** *** 182,202 **** for(Class<?> sessionClass : sessionClasses) { ! ValidControllers vc = sessionClass.getAnnotation(ValidControllers.class); ! ! if(vc == null) ! initialiseController(sessionClass, "session", bundle); ! else ! for(Class<?> controllerClass : vc.value()) ! initialiseController(controllerClass, "controller", bundle); ! ! for(ControllerManager tm : targetManagerMap.values()) ! tm.initialiseChangers("controller", sessionClass, targetManagerMap); ! for(ControllerManager tm : targetManagerMap.values()) ! tm.checkChangers("controller", targetManagerMap); ! for(ControllerManager tm : targetManagerMap.values()) if(!tm.wrapUpInitialisations("controller")) stateOk = false; } } --- 207,221 ---- for(Class<?> sessionClass : sessionClasses) { ! List<Class<?>> ctrls = getControllersFor(sessionClass); ! for(Class<?> controllerClass : ctrls) ! initialiseController(controllerClass, "controller", bundle); ! for(ControllerManager tm : controllerManagerMap.values()) if(!tm.wrapUpInitialisations("controller")) stateOk = false; + + SessionManager m = new SessionManager(sessionClass, controllerManagerMap); + sessionManagerMap.put(sessionClass, m); } } *************** *** 208,212 **** ControllerManager tm = new ControllerManager(application.getClass(), "login", null); ! targetManagerMap.put(application.getClass(), tm); tm.addResponder(tm.getEntryPoint(), new FileResponder(getLoginPage(), mimeMapper)); --- 227,231 ---- ControllerManager tm = new ControllerManager(application.getClass(), "login", null); ! controllerManagerMap.put(application.getClass(), tm); tm.addResponder(tm.getEntryPoint(), new FileResponder(getLoginPage(), mimeMapper)); *************** *** 227,231 **** ControllerManager tm = new ControllerManager(sessionClass, "main", "logout"); ! targetManagerMap.put(sessionClass, tm); tm.addResponder(tm.getExitPoint(), new Responder() { --- 246,250 ---- ControllerManager tm = new ControllerManager(sessionClass, "main", "logout"); ! controllerManagerMap.put(sessionClass, tm); tm.addResponder(tm.getExitPoint(), new Responder() { *************** *** 255,259 **** doStartPage(uri, request, response, context); } ! else if(components.length == 2 || components.length == 3) { String [] methodComps = components[components.length - 1].split("\\."); String method = methodComps[0]; --- 274,278 ---- doStartPage(uri, request, response, context); } ! else if(components.length >= 2 && components.length <= 4) { String [] methodComps = components[components.length - 1].split("\\."); String method = methodComps[0]; *************** *** 264,279 **** if(components.length == 2) dispatchApplicationMethod(method, presentation, request, response, context); ! else if(components.length == 3) { ! String key = components[1]; ! SessionCompound sc = getSessionFor(key); if(sc == null) ResponseHelper.error(HttpStatus.SC_NOT_FOUND, response, "No Session", "No session " + key + "."); else ! dispatchSessionMethod(method, presentation, key, request, null, response, context); } - else - ResponseHelper.error(HttpStatus.SC_NOT_FOUND, response, "Bad URI", "Bad URI " + uri + "."); } } catch (InvocationTargetException ite) { --- 283,299 ---- if(components.length == 2) dispatchApplicationMethod(method, presentation, request, response, context); ! else { ! String key = components[1]; ! String controllerKey = components.length == 4 ? components[2] : ""; ! SessionCompound sc = getSessionFor(key); if(sc == null) ResponseHelper.error(HttpStatus.SC_NOT_FOUND, response, "No Session", "No session " + key + "."); else ! dispatchSessionMethod(method, presentation, key, controllerKey, request, null, response, context); } } + else + ResponseHelper.error(HttpStatus.SC_NOT_FOUND, response, "Bad URI", "Bad URI " + uri + "."); } catch (InvocationTargetException ite) { *************** *** 314,324 **** } ! private void dispatchSessionMethod(String method, String presentation, String targetKey, HttpRequest request, FormFieldContainer fields, HttpResponse response, HttpContext context) throws Exception { response.addHeader("Cache-Control", "no-cache"); ! Controller target = getSessionFor(targetKey).getController(); ! ! ControllerManager tm = getTargetManager(target, response); if(tm == null) --- 334,345 ---- } ! private void dispatchSessionMethod(String method, String presentation, ! String targetKey, String controllerKey, HttpRequest request, FormFieldContainer fields, HttpResponse response, HttpContext context) throws Exception { response.addHeader("Cache-Control", "no-cache"); ! SessionCompound sc = sessionMap.get(targetKey); ! Controller target = sc.getController(controllerKey); ! ControllerManager tm = sc.getManager().getManager(controllerKey); if(tm == null) *************** *** 330,350 **** Responder g = tm.getResponder(method); ! if(g == null) { ! ControllerChanger c = tm.getChanger(method); ! ! if(c != null) { ! if(c.change(getSessionFor(targetKey), fields, response)) { ! logger.info("Controller change " + method + ", application " + getUriPrefix() ! + ", session " + targetKey + ", " + c.getNewControllerClassName()); ! dispatchSessionMethod(method, presentation, targetKey, request, fields, response, context); ! } ! } ! else ! ResponseHelper.error(HttpStatus.SC_INTERNAL_SERVER_ERROR, response, ! "Method Dispatch Failure", "Failed to dispatch method " + method + ".", ! "No method " + method + " in target class " + target.getClass().getCanonicalName() + "."); ! } else { ! logger.info("Method " + method + ", application " + getUriPrefix() + ", session " + targetKey); if(!g.execute(target, presentation, request, fields, response, context)) --- 351,362 ---- Responder g = tm.getResponder(method); ! if(g == null) ! ResponseHelper.error(HttpStatus.SC_INTERNAL_SERVER_ERROR, response, ! "Method Dispatch Failure", "Failed to dispatch method " + method + ".", ! "No method " + method + " in target class " + target.getClass().getCanonicalName() + "."); else { ! logger.info("Method " + method + ", application " + getUriPrefix() ! + ", controller " + (controllerKey.equals("") ? "<>" : controllerKey) ! + ", session " + targetKey); if(!g.execute(target, presentation, request, fields, response, context)) *************** *** 397,402 **** private ControllerManager getTargetManager(Controller target, HttpResponse response) { ! Class<?> tgtClass = target.getClass(); ! ControllerManager tm = targetManagerMap.get(tgtClass); if(tm == null) { --- 409,414 ---- private ControllerManager getTargetManager(Controller target, HttpResponse response) { ! Class<?> tgtClass = target.getClass(); ! ControllerManager tm = controllerManagerMap.get(tgtClass); if(tm == null) { *************** *** 425,430 **** FileRequestHandler.serveFile(getLoginFailedPage(), request, response, context, mimeMapper, false); else { ! SessionCompound sc = new SessionCompound(session); ! ControllerManager tm = getTargetManager(sc.getController(), response); if(tm == null) --- 437,443 ---- FileRequestHandler.serveFile(getLoginFailedPage(), request, response, context, mimeMapper, false); else { ! SessionManager sm = sessionManagerMap.get(session.getClass()); ! SessionCompound sc = new SessionCompound(session, sm); ! ControllerManager tm = sc.getManager().getManager(""); if(tm == null) |
From: Joerg B. <jb...@us...> - 2009-05-28 18:34:52
|
Update of /cvsroot/lipog/net.heilancoo.portal.examples/src/net/heilancoo/portal/examples/controllerchange In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14714/src/net/heilancoo/portal/examples/controllerchange Modified Files: ThePreferences.java TheMain.java TheExport.java TheSession.java Log Message: dropped the concept of controller changers; introduced subcontrollers instead Index: TheMain.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.examples/src/net/heilancoo/portal/examples/controllerchange/TheMain.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TheMain.java 12 May 2009 16:15:16 -0000 1.4 --- TheMain.java 28 May 2009 18:34:43 -0000 1.5 *************** *** 12,18 **** package net.heilancoo.portal.examples.controllerchange; - import net.heilancoo.portal.controller.ChangeControllers; - import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.freemarker.FreeMarkerModel; import net.heilancoo.portal.htmlforms.FormFieldContainer; --- 12,17 ---- package net.heilancoo.portal.examples.controllerchange; import net.heilancoo.portal.controller.Controller; + import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.freemarker.FreeMarkerModel; import net.heilancoo.portal.htmlforms.FormFieldContainer; *************** *** 27,31 **** * */ - @ChangeControllers({ TheExport.class, ThePreferences.class }) public class TheMain implements Controller { --- 26,29 ---- Index: TheExport.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.examples/src/net/heilancoo/portal/examples/controllerchange/TheExport.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TheExport.java 12 May 2009 16:15:16 -0000 1.3 --- TheExport.java 28 May 2009 18:34:43 -0000 1.4 *************** *** 12,27 **** package net.heilancoo.portal.examples.controllerchange; ! import org.apache.http.HttpRequest; ! import org.apache.http.HttpResponse; ! import org.apache.http.protocol.HttpContext; ! ! import net.heilancoo.portal.controller.ChangeController; ! import net.heilancoo.portal.controller.ChangeControllers; import net.heilancoo.portal.controller.EntryPoint; import net.heilancoo.portal.controller.Request; - import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.freemarker.FreeMarkerModel; import net.heilancoo.portal.htmlforms.FormFieldContainer; /** * @author joerg --- 12,25 ---- package net.heilancoo.portal.examples.controllerchange; ! import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.EntryPoint; import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.freemarker.FreeMarkerModel; import net.heilancoo.portal.htmlforms.FormFieldContainer; + import org.apache.http.HttpRequest; + import org.apache.http.HttpResponse; + import org.apache.http.protocol.HttpContext; + /** * @author joerg *************** *** 29,33 **** */ @EntryPoint("export") - @ChangeControllers({ TheMain.class, ThePreferences.class }) public class TheExport implements Controller { --- 27,30 ---- *************** *** 46,50 **** } ! @ChangeController public TheMain main(TheSession s, FormFieldContainer fields) { return new TheMain(s); --- 43,47 ---- } ! //@SubController public TheMain main(TheSession s, FormFieldContainer fields) { return new TheMain(s); Index: ThePreferences.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.examples/src/net/heilancoo/portal/examples/controllerchange/ThePreferences.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ThePreferences.java 12 May 2009 16:15:16 -0000 1.4 --- ThePreferences.java 28 May 2009 18:34:43 -0000 1.5 *************** *** 12,26 **** package net.heilancoo.portal.examples.controllerchange; ! import org.apache.http.HttpRequest; ! import org.apache.http.HttpResponse; ! import org.apache.http.protocol.HttpContext; ! ! import net.heilancoo.portal.controller.ChangeController; import net.heilancoo.portal.controller.EntryPoint; import net.heilancoo.portal.controller.Request; - import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.freemarker.FreeMarkerModel; import net.heilancoo.portal.htmlforms.FormFieldContainer; /** * @author joerg --- 12,25 ---- package net.heilancoo.portal.examples.controllerchange; ! import net.heilancoo.portal.controller.Controller; import net.heilancoo.portal.controller.EntryPoint; import net.heilancoo.portal.controller.Request; import net.heilancoo.portal.freemarker.FreeMarkerModel; import net.heilancoo.portal.htmlforms.FormFieldContainer; + import org.apache.http.HttpRequest; + import org.apache.http.HttpResponse; + import org.apache.http.protocol.HttpContext; + /** * @author joerg *************** *** 44,53 **** } ! @ChangeController public TheMain main(TheSession s, FormFieldContainer fields) { return null; } ! @ChangeController public TheExport export(TheSession s, FormFieldContainer fields) { return null; --- 43,52 ---- } ! //@SubController public TheMain main(TheSession s, FormFieldContainer fields) { return null; } ! //@SubController public TheExport export(TheSession s, FormFieldContainer fields) { return null; Index: TheSession.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.examples/src/net/heilancoo/portal/examples/controllerchange/TheSession.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TheSession.java 15 May 2009 19:21:01 -0000 1.5 --- TheSession.java 28 May 2009 18:34:43 -0000 1.6 *************** *** 12,17 **** package net.heilancoo.portal.examples.controllerchange; ! import net.heilancoo.portal.controller.Controller; ! import net.heilancoo.portal.controller.ValidControllers; import net.heilancoo.portal.session.Session; --- 12,17 ---- package net.heilancoo.portal.examples.controllerchange; ! import net.heilancoo.portal.controller.SubController; ! import net.heilancoo.portal.controller.SubControllers; import net.heilancoo.portal.session.Session; *************** *** 20,24 **** * */ ! @ValidControllers({ TheMain.class, ThePreferences.class, TheExport.class }) public class TheSession implements Session { --- 20,28 ---- * */ ! @SubControllers({ ! @SubController(key = "", controller = TheMain.class), ! @SubController(key = "p", controller = ThePreferences.class), ! @SubController(key = "e", controller = TheExport.class) ! }) public class TheSession implements Session { *************** *** 37,49 **** } - /* - * (non-Javadoc) - * @see net.heilancoo.portal.session.Session#getInitialController() - */ - @Override - public Controller getInitialController() { - return new TheMain(this); - } - void access() { accessCounter += 1; --- 41,44 ---- |
From: Joerg B. <jb...@us...> - 2009-05-28 18:34:48
|
Update of /cvsroot/lipog/net.heilancoo.bingo/resources In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14696/resources Added Files: bingo-mac.product Log Message: dropped the concept of controller changers; introduced subcontrollers instead --- NEW FILE: bingo-mac.product --- <?xml version="1.0" encoding="UTF-8"?> <?pde version="3.4"?> <product name="Little Portal Gizmo" id="net.heilancoo.portal.gizmo" application="net.heilancoo.portal.service" version="1.0" useFeatures="false"> <configIni use="default"> </configIni> <launcherArgs> <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> </launcherArgs> <launcher> <solaris/> <win useIco="false"> <bmp/> </win> </launcher> <vm> <macos>org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6</macos> </vm> <plugins> <plugin id="net.heilancoo.bingo"/> <plugin id="net.heilancoo.portal"/> <plugin id="net.heilancoo.portal.admin"/> <plugin id="net.heilancoo.portal.documentation"/> <plugin id="net.heilancoo.portal.freemarker"/> <plugin id="net.heilancoo.portal.json"/> <plugin id="net.heilancoo.utils"/> <plugin id="org.apache.httpcore"/> <plugin id="org.apache.log4j"/> <plugin id="org.eclipse.core.contenttype"/> <plugin id="org.eclipse.core.jobs"/> <plugin id="org.eclipse.core.runtime"/> <plugin id="org.eclipse.core.runtime.compatibility.auth"/> <plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/> <plugin id="org.eclipse.equinox.app"/> <plugin id="org.eclipse.equinox.common"/> <plugin id="org.eclipse.equinox.preferences"/> <plugin id="org.eclipse.equinox.registry"/> <plugin id="org.eclipse.osgi"/> <plugin id="org.eclipse.osgi.services"/> <plugin id="org.freemarker"/> <plugin id="org.json"/> </plugins> </product> |
From: Joerg B. <jb...@us...> - 2009-05-25 19:23:00
|
Update of /cvsroot/lipog/net.heilancoo.portal.test/src/net/heilancoo/portal/webapps/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10664/src/net/heilancoo/portal/webapps/test Modified Files: InitialisationTests.java Added Files: TestWebAppProps.java Log Message: fixed property initialisation test Index: InitialisationTests.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.test/src/net/heilancoo/portal/webapps/test/InitialisationTests.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** InitialisationTests.java 15 May 2009 19:21:05 -0000 1.9 --- InitialisationTests.java 25 May 2009 19:22:42 -0000 1.10 *************** *** 123,129 **** @Test public void webAppWithGoodProperties() { ! assertTrue(h.initialise(bundle, new TestWebApp(), "uri-prefix", "Test Web Application", "Some text", null, "data/good-file.properties")); p = h.getParameters().getProperties(); assertEquals("1", p.getProperty("a.b.c")); assertEquals("hello Gizmo!", p.getProperty("a.b.d")); assertEquals("at the end of it all", p.getProperty("x.y.z")); --- 123,132 ---- @Test public void webAppWithGoodProperties() { ! TestWebAppProps a = new TestWebAppProps(); ! assertTrue(h.initialise(bundle, a, "uri-prefix", "Test Web Application", "Some text", null, "data/good-file.properties")); p = h.getParameters().getProperties(); + assertEquals("1", a.getProp("a.b.c")); assertEquals("1", p.getProperty("a.b.c")); + assertEquals("hello Gizmo!", a.getProp("a.b.d")); assertEquals("hello Gizmo!", p.getProperty("a.b.d")); assertEquals("at the end of it all", p.getProperty("x.y.z")); --- NEW FILE: TestWebAppProps.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.portal.webapps.test; import java.util.Properties; import net.heilancoo.portal.application.Application; import net.heilancoo.portal.application.ApplicationParameters; import net.heilancoo.portal.htmlforms.FormFieldContainer; import net.heilancoo.portal.session.Session; /** * @author joerg * */ public class TestWebAppProps implements Application { private Properties props; /* * (non-Javadoc) * @see net.heilancoo.portal.requests.SessionRequestHandler#getVersion() */ @Override public String getVersion() { // TODO Auto-generated method stub return null; } /* * (non-Javadoc) * @see net.heilancoo.portal.application.Application#initialise(net.heilancoo.portal.application.ApplicationParameters) */ @Override public void initialise(ApplicationParameters parameters) { props = parameters.getProperties(); } public String getProp(String key) { return props != null ? props.getProperty(key) : null; } /* * (non-Javadoc) * @see net.heilancoo.portal.application.Application#validateCredentialsAndMakeNewSession(net.heilancoo.portal.htmlforms.FormFieldContainer) */ @Override public Session validateCredentialsAndMakeNewSession( FormFieldContainer fields) { // TODO Auto-generated method stub return null; } } |
From: Nuno M. <nun...@us...> - 2009-05-24 16:18:09
|
Update of /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/application In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15471/src/net/heilancoo/portal/application Modified Files: ApplicationRequestHandler.java Log Message: initialise() should be called after initialiseConfigFile() Index: ApplicationRequestHandler.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/application/ApplicationRequestHandler.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ApplicationRequestHandler.java 15 May 2009 19:20:58 -0000 1.16 --- ApplicationRequestHandler.java 24 May 2009 16:17:58 -0000 1.17 *************** *** 157,165 **** this.application = application; - application.initialise(parameters); - if(configFile != null) stateOk = initialiseConfigFile(bundle, configFile); if(mimeConfig == null) mimeConfig = Utils.makePathFor(PortalPlugin.getDefault(), "config/mimetypes.txt"); --- 157,165 ---- this.application = application; if(configFile != null) stateOk = initialiseConfigFile(bundle, configFile); + application.initialise(parameters); + if(mimeConfig == null) mimeConfig = Utils.makePathFor(PortalPlugin.getDefault(), "config/mimetypes.txt"); |
From: Nuno M. <nun...@us...> - 2009-05-24 15:28:46
|
Update of /cvsroot/lipog/net.heilancoo.portal/config In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7093/config Modified Files: mimetypes.txt Log Message: Added swf file type. Index: mimetypes.txt =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/config/mimetypes.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mimetypes.txt 10 Apr 2009 20:24:24 -0000 1.3 --- mimetypes.txt 24 May 2009 15:28:39 -0000 1.4 *************** *** 24,26 **** image/gif gif application/x-javascript js ! application/x-stuffit sit \ No newline at end of file --- 24,27 ---- image/gif gif application/x-javascript js ! application/x-stuffit sit ! application/swf swf \ No newline at end of file |
From: Joerg B. <jb...@us...> - 2009-05-17 15:17:21
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31616/doc Modified Files: getting-ready.html Log Message: intro paragraph and a little clarification on CVS compression preferences Index: getting-ready.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/getting-ready.html,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** getting-ready.html 4 May 2009 19:51:32 -0000 1.7 --- getting-ready.html 17 May 2009 15:17:13 -0000 1.8 *************** *** 9,12 **** --- 9,16 ---- <p><a href="index.html">Home of Little Portal Gizmo</a></p> <h1>Getting Ready for Development with the Gizmo</h1> + <p>This page is go give you a bit of an overview of what the different modules the Little + Portal Gizmo consists of do and why they are there. Some of them you absolutely need for + the Gizmo to work. Others are optional, and offer either example code or features the basic + Gizmo can work without.</p> <p>Developing web apps with the Gizmo means developing one or more Eclipse plug-ins, based on the Gizmo base plug-ins. You need to set up *************** *** 101,105 **** <img src="snaps/cvs-checkout-3.png" alt=""> <p>Click the "configure connection preferences..." link to enable ! connection compression. Don't forget to click OK.</p> <img src="snaps/cvs-checkout-4.png" alt=""> <p>In the "Select Module" dialog, click the "User existing module" --- 105,109 ---- <img src="snaps/cvs-checkout-3.png" alt=""> <p>Click the "configure connection preferences..." link to enable ! connection compression. After changing the necessary settings, leave this preferences dialog by clicking OK.</p> <img src="snaps/cvs-checkout-4.png" alt=""> <p>In the "Select Module" dialog, click the "User existing module" |
From: Joerg B. <jb...@us...> - 2009-05-17 15:16:35
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31532/doc Modified Files: index.html Log Message: Tracker links now filter for open tickets Index: index.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/index.html,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** index.html 4 May 2009 22:17:46 -0000 1.15 --- index.html 17 May 2009 15:16:28 -0000 1.16 *************** *** 113,118 **** <li><a href="getting-ready.html">Getting Ready</a></li> <li><a href="change-log.html">Change Log</a></li> ! <li><a href="http://sourceforge.net/tracker/?group_id=257822&atid=1127428">Tracker: To Do</a></li> ! <li><a href="http://sourceforge.net/tracker/?group_id=257822&atid=1127427">Tracker: Bugs</a></li> </ul> --- 113,118 ---- <li><a href="getting-ready.html">Getting Ready</a></li> <li><a href="change-log.html">Change Log</a></li> ! <li><a href="http://sourceforge.net/tracker/?func=&group_id=257822&atid=1127428&status=1">Tracker: To Do</a></li> ! <li><a href="http://sourceforge.net/tracker/?func=&group_id=257822&atid=1127427&status=1">Tracker: Bugs</a></li> </ul> |
From: Joerg B. <jb...@us...> - 2009-05-15 19:21:21
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28567/doc Modified Files: webapp-123.html Log Message: session and application initialisation rationalisation Index: webapp-123.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/webapp-123.html,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** webapp-123.html 12 May 2009 16:17:02 -0000 1.14 --- webapp-123.html 15 May 2009 19:21:08 -0000 1.15 *************** *** 131,140 **** return null; } - - @Override - public void initialise(ApplicationRequestHandler handler, - Application application, String sessionKey) { - // TODO Auto-generated method stub - } } --- 131,134 ---- *************** *** 170,179 **** } - @Override - public void initialise(ApplicationRequestHandler handler, - Application application, String sessionKey) { - // TODO Auto-generated method stub - } - @Request public void main(HttpRequest request, FormFieldContainer fields, --- 164,167 ---- *************** *** 211,214 **** --- 199,207 ---- @Override + public void initialise(ApplicationParameters parameters) { + // TODO Auto-generated method stub + } + + @Override public Session validateCredentialsAndMakeNewSession( FormFieldContainer fields) throws FormFieldAccessException { *************** *** 238,241 **** --- 231,239 ---- @Override + public void initialise(ApplicationParameters parameters) { + // TODO Auto-generated method stub + } + + @Override public Session validateCredentialsAndMakeNewSession( FormFieldContainer fields) throws FormFieldAccessException { *************** *** 306,315 **** } - @Override - public void initialise(ApplicationRequestHandler handler, - Application application, String sessionKey) { - // TODO Auto-generated method stub - } - @Request public void main(HttpRequest request, FormFieldContainer fields, --- 304,307 ---- |