[[TracNav]] [[PageOutline]] = HTML pages and servlets in gnowsis = You can server HTML user interfaces and servlets using a normal web-application container. Gnowsis supports '''Servlet 2.3 specification''' using a Jetty server 4.2.22. This is equivalent to a Tomcat 4.1 server. Note: '''a service will only have an associated webspace, if the web.xml file exists'''. If you look into the GnowsisProjectStructure you will notice where the web-pages and the other web-container related information lies: in the {{{service/projectname/}}} folder. You find there the typical elements of a web-application: * WEB-INF - metadata * lib - libraries * classes - the compiled servlets and the compiled gnowsis code * web.xml - config To add new HTML pages, put them into these folders or create a new project with similar folders: * yourproject/services/yourproject/ To add new servlets, program the servlet code in the application source packages. Then add the servlet-mapping definitions as usual to the web.xml file. == Embedding images in webpages == The local gnowsis server runs at 127.0.0.1:9993, for a web-browser this looks like any webserver. So the webbrowser will allow you to embed images in your web-applications if they have URLs that point to web images, not to file images on your harddisk. {{{ this is not allowed due to security restrictions in the web browser: }}} As a workaround we provided a servlet that loads local images and returns them, it works like this: {{{ }}} As kaukolu currently does not support HTML, use this markup {{{ [picture|http://127.0.0.1:9993/gnowsis-server/showimage?uri=file:///C:/1/pic.jpg] }}} = JSP Java Server Pages in Gnowsis = how to program java server pages and why stuff doesn't work as usual. '''Why is JSP such a thing in gnowsis?''' Because we use special classloaders that kickstart the system. Our classloader lets all classes from all services see each other. Some expected default behaviour is not supported now. == How to make JSP and Taglibs run in my Service? == Look at gnowis-server, in the services/gnowsis-server/WEB-INF path you will see how the hack works: * you extract the taglib-descriptors (for example, in standard jar's, they are in the jar/MANIFEST directory). copy the needed .tld into the web-inf * you write the tld's into your web.xml file. see again in gnowsis-server how this is done * you insert the taglib-include into your jsp as normal. '''How we did it in web.xml''' {{{ ... http://java.sun.com/jsp/jstl/core /WEB-INF/c.tld http://java.sun.com/jsp/jstl/fmt /WEB-INF/fmt.tld http://java.sun.com/jsp/jstl/xml /WEB-INF/x.tld }}} If you know a better way to do it in gnowsis, please tell us via the mailinglist. == How does gnowsis get JSP to run? == * The java compiler (javacc) in tools.jar is part of the '''gnowsis''' project * The jsp compiler (jasper) and runtime are in the gnowsis-server/service/gnowsis-server/WEB-INF/lib path * all classloaders inside the services (gnowsis-server, kaukolu, enquire2006, etc) share the same classloader - the '''EPOSWorkspaceClassloader''', so they can load each other. Additionally they have access to the 'gnowsis' classloader, which is the standard java classloader. How can I break this? * if you move the javacc into the gnowsis-server, it breaks it doesn't find javacc (unknonw why) * if you move jasper-compiler to gnowsis, it breaks because the compiler is then loaded with the default classloader and not our EPOSWorkspaceClassloader. so leave it inside gnowsis-server * somehow our classloader doesn't interpret the MANIFEST things correctly, so the JSP taglibs in standard.jar are not found and cannot be used with above hack. So don't delete the taglib information from gnowsis-server/WEB-INF.