Strabon
changeset 518:a915117ecad3
shit on your grave JSTL/EL/JavaBean/Spring MVC/J2EE. Back to scriptlets again. We support Tomcat 6 and Tomcat 7 again
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Sat Jul 28 00:06:32 2012 +0300 (2012-07-28) |
parents | 7ac79e2d67c9 |
children | 81346ef0ee23 |
files | endpoint/WebContent/WEB-INF/beans.xml endpoint/WebContent/WEB-INF/web.xml endpoint/WebContent/describe.jsp endpoint/WebContent/store.jsp endpoint/pom.xml endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/ConfigureCommon.java endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/DescribeBean.java |
line diff
1.1 --- a/endpoint/WebContent/WEB-INF/beans.xml Fri Jul 27 20:49:11 2012 +0300 1.2 +++ b/endpoint/WebContent/WEB-INF/beans.xml Sat Jul 28 00:06:32 2012 +0300 1.3 @@ -6,15 +6,10 @@ 1.4 xmlns:jaxws="http://cxf.apache.org/jaxws" 1.5 jaxws:schemaLocation="http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> 1.6 1.7 -<!-- 1.8 - <import resource="classpath:META-INF/cxf/cxf.xml" /> 1.9 - <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> 1.10 - <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> 1.11 ---> 1.12 <bean 1.13 id="strabonBean" 1.14 class="eu.earthobservatory.org.StrabonEndpoint.StrabonBeanWrapper" 1.15 - destroy-method="destroy" > 1.16 + destroy-method="destroy"> 1.17 1.18 <constructor-arg type="java.lang.String" > 1.19 <!-- Database name --> 1.20 @@ -362,6 +357,4 @@ 1.21 </list> 1.22 </constructor-arg> 1.23 </bean> 1.24 - 1.25 - <bean id="commonBean" class="eu.earthobservatory.org.StrabonEndpoint.Common" scope="singleton"/> 1.26 </beans>
2.1 --- a/endpoint/WebContent/WEB-INF/web.xml Fri Jul 27 20:49:11 2012 +0300 2.2 +++ b/endpoint/WebContent/WEB-INF/web.xml Sat Jul 28 00:06:32 2012 +0300 2.3 @@ -12,8 +12,8 @@ 2.4 </context-param> 2.5 <listener> 2.6 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 2.7 - </listener> 2.8 - 2.9 + </listener> 2.10 + 2.11 <servlet> 2.12 <display-name>Query</display-name> 2.13 <servlet-name>Query</servlet-name> 2.14 @@ -85,15 +85,11 @@ 2.15 <session-config> 2.16 <session-timeout>60</session-timeout> 2.17 </session-config> 2.18 + 2.19 <welcome-file-list> 2.20 <welcome-file>query.jsp</welcome-file> 2.21 </welcome-file-list> 2.22 - 2.23 - <!-- Listener for instantiating the Common bean that is used in .jsp files --> 2.24 - <listener> 2.25 - <listener-class>eu.earthobservatory.org.StrabonEndpoint.ConfigureCommon</listener-class> 2.26 - </listener> 2.27 - 2.28 + 2.29 <!-- <servlet> --> 2.30 <!-- <display-name>QueryServlet</display-name> --> 2.31 <!-- <servlet-name>QueryServlet</servlet-name> -->
3.1 --- a/endpoint/WebContent/describe.jsp Fri Jul 27 20:49:11 2012 +0300 3.2 +++ b/endpoint/WebContent/describe.jsp Sat Jul 28 00:06:32 2012 +0300 3.3 @@ -1,5 +1,5 @@ 3.4 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 3.5 -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 3.6 +<jsp:directive.page import="eu.earthobservatory.org.StrabonEndpoint.Common"/> 3.7 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 3.8 <html> 3.9 <head> 3.10 @@ -29,7 +29,7 @@ 3.11 <!-- include TELEIOS header and description --> 3.12 3.13 <FORM enctype="UTF-8" accept-charset="UTF-8" method="post" action="Describe"> 3.14 -<INPUT type=hidden name="${commonBean.view}" value="${commonBean.viewType}"/> 3.15 +<INPUT type=hidden name="view" value="HTML"/> 3.16 3.17 <table border="0" width="100%"><tr> 3.18 <td width="90" valign="top" class="style4"> 3.19 @@ -42,14 +42,15 @@ 3.20 <table cellspacing="5"> 3.21 <tr> 3.22 <td id="output">stSPARQL Query:</td> 3.23 -<td id="output"><textarea name="query" title="pose your DESCRIBE query here" rows="15" cols="100">${query}</textarea></td> 3.24 +<td id="output"><textarea name="query" title="pose your DESCRIBE query here" rows="15" cols="100"> 3.25 +<%=request.getParameter("query") != null ? request.getParameter("query"):""%></textarea></td> 3.26 </tr> 3.27 <tr> 3.28 <td id="output"><center>Output Format:<br/> 3.29 <SELECT name="format" title="select one of the following RDF graph format types"> 3.30 - <c:forEach var="format" items="${commonBean.registeredFormats}"> 3.31 - <OPTION value="${format}">${format}</OPTION> 3.32 - </c:forEach> 3.33 + <% for (String format : Common.registeredFormats) {%> 3.34 + <OPTION value="<%=format%>"><%=format%></OPTION> 3.35 + <%}%> 3.36 </SELECT></center></td> 3.37 <td colspan=2><br/> 3.38 <center> 3.39 @@ -57,21 +58,23 @@ 3.40 </center><br/></td> 3.41 </tr> 3.42 3.43 -<!-- Error Message --> 3.44 -<c:if test="${error != null}"> 3.45 -<TR> 3.46 - <TD id="output">Result: </TD><TD id="output">${error}</TD> 3.47 -</TR> 3.48 -</c:if> 3.49 -<!-- Error Message --> 3.50 + 3.51 +<% if (request.getAttribute("error") != null) {%> 3.52 + <!-- Error Message --> 3.53 + <TR> 3.54 + <TD id="output">Result: </TD><TD id="output"><%=request.getAttribute("error") %></TD> 3.55 + </TR> 3.56 + <!-- Error Message --> 3.57 +<%}%> 3.58 + 3.59 3.60 </table></td></tr></table><br/><br/> 3.61 3.62 -<!-- Response --> 3.63 -<c:if test="${response != null}"> 3.64 -<PRE>${response}</PRE> 3.65 -</c:if> 3.66 -<!-- Response --> 3.67 +<% if (request.getAttribute("response") != null) {%> 3.68 + <!-- Response --> 3.69 + <PRE><%=request.getAttribute("response") %></PRE> 3.70 + <!-- Response --> 3.71 +<%}%> 3.72 </form> 3.73 </body> 3.74 </html> 3.75 \ No newline at end of file
4.1 --- a/endpoint/WebContent/store.jsp Fri Jul 27 20:49:11 2012 +0300 4.2 +++ b/endpoint/WebContent/store.jsp Sat Jul 28 00:06:32 2012 +0300 4.3 @@ -1,5 +1,5 @@ 4.4 <jsp:directive.page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"/> 4.5 -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4.6 +<jsp:directive.page import="eu.earthobservatory.org.StrabonEndpoint.Common"/> 4.7 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4.8 <html> 4.9 <head> 4.10 @@ -29,7 +29,7 @@ 4.11 <!-- include TELEIOS header and description --> 4.12 4.13 <FORM method=POST enctype="UTF-8" accept-charset="UTF-8" action="Store"> 4.14 -<INPUT type=hidden name="${commonBean.view}" value="${commonBean.viewType}"/> 4.15 +<INPUT type=hidden name="view" value="HTML"/> 4.16 4.17 <TABLE border="0" width="100%"> 4.18 <TR> 4.19 @@ -42,33 +42,31 @@ 4.20 <td width="*" valign="top" class="style4"> 4.21 <TABLE cellspacing="5"> 4.22 4.23 -<!-- Error Message --> 4.24 -<c:if test="${error != null}"> 4.25 +<% if (request.getAttribute("error") != null) {%> 4.26 + <!-- Error Message --> 4.27 <TR><TD colspan=3> 4.28 - <CENTER><P style="color: red;">${error}</P></CENTER> 4.29 + <CENTER><P style="color: red;"><%=request.getAttribute("error") %></P></CENTER> 4.30 </TD></TR> 4.31 -</c:if> 4.32 -<!-- Error Message --> 4.33 + <!-- Error Message --> 4.34 +<%}%> 4.35 4.36 -<!-- Info Message --> 4.37 -<c:if test="${info != null}"> 4.38 +<%if (request.getAttribute("info") != null) { %> 4.39 + <!-- Info Message --> 4.40 <TR><TD colspan=3> 4.41 - <CENTER><P>${info}</P></CENTER> 4.42 + <CENTER><P><%=request.getAttribute("info") %></P></CENTER> 4.43 </TD></TR> 4.44 -</c:if> 4.45 -<!-- Info Message --> 4.46 - 4.47 + <!-- Info Message --> 4.48 +<%}%> 4.49 <tr> 4.50 <!-- direct input form --> 4.51 <td id="output">Direct Input:</td> 4.52 - <td id="output"> 4.53 - <textarea name="${commonBean.paramData}" rows="15" cols="100"></textarea></td> 4.54 + <td id="output"><textarea name="data" rows="15" cols="100"></textarea></td> 4.55 <td rowspan=4 id="output"> 4.56 <CENTER>RDF Format:<br/> 4.57 <SELECT name="format" title="select one of the following RDF graph format types"> 4.58 - <c:forEach var="format" items="${commonBean.registeredFormats}"> 4.59 - <OPTION value="${format}">${format}</OPTION> 4.60 - </c:forEach> 4.61 + <% for (String format : Common.registeredFormats) {%> 4.62 + <OPTION value="<%=format%>"><%=format%></OPTION> 4.63 + <%}%> 4.64 </SELECT> 4.65 </CENTER> 4.66 </td> 4.67 @@ -76,7 +74,7 @@ 4.68 <tr> 4.69 <td colspan=2 id="output"><br/> 4.70 <CENTER> 4.71 - <input type="submit" value="Store Input" name="${commonBean.submitInput}" style="width: 400px"/> 4.72 + <input type="submit" value="Store Input" name="dsubmit" style="width: 400px"/> 4.73 </CENTER><br/> 4.74 </td> 4.75 </tr> 4.76 @@ -84,14 +82,14 @@ 4.77 <tr> 4.78 <td id="output" >URI Input:</td> 4.79 <td id="output"> 4.80 - <textarea name="${commonBean.paramDataURL}" rows="1" cols="100"></textarea> 4.81 + <textarea name="url" rows="1" cols="100"></textarea> 4.82 </td> 4.83 </tr> 4.84 4.85 <tr> 4.86 <td colspan=2 id="output"><br/> 4.87 <CENTER> 4.88 - <INPUT type="submit" value="Store from URI" name="${commonBean.submitURL}" style="width: 400px"/> 4.89 + <INPUT type="submit" value="Store from URI" name="fromurl" style="width: 400px"/> 4.90 </CENTER><br/> 4.91 </td> 4.92 </tr>
5.1 --- a/endpoint/pom.xml Fri Jul 27 20:49:11 2012 +0300 5.2 +++ b/endpoint/pom.xml Sat Jul 28 00:06:32 2012 +0300 5.3 @@ -40,34 +40,7 @@ 5.4 </exclusion> 5.5 </exclusions> 5.6 </dependency> 5.7 - 5.8 - <!-- JSTL 1.2 API and Glassfish Implementation --> 5.9 - <dependency> 5.10 - <groupId>javax.servlet</groupId> 5.11 - <artifactId>jstl</artifactId> 5.12 - <version>1.2</version> 5.13 - </dependency> 5.14 - <dependency> 5.15 - <groupId>org.glassfish.web</groupId> 5.16 - <artifactId>jstl-impl</artifactId> 5.17 - <version>1.2</version> 5.18 - <exclusions> 5.19 - <exclusion> 5.20 - <artifactId>servlet-api</artifactId> 5.21 - <groupId>javax.servlet</groupId> 5.22 - </exclusion> 5.23 - <exclusion> 5.24 - <artifactId>jsp-api</artifactId> 5.25 - <groupId>javax.servlet.jsp</groupId> 5.26 - </exclusion> 5.27 - <exclusion> 5.28 - <artifactId>jstl-api</artifactId> 5.29 - <groupId>javax.servlet.jsp.jstl</groupId> 5.30 - </exclusion> 5.31 - </exclusions> 5.32 - </dependency> 5.33 - <!-- JSTL 1.2 API and Glassfish Implementation --> 5.34 - 5.35 + 5.36 <!-- GeoTools --> 5.37 <dependency> 5.38 <groupId>org.geotools.xsd</groupId>
6.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java Fri Jul 27 20:49:11 2012 +0300 6.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java Sat Jul 28 00:06:32 2012 +0300 6.3 @@ -13,16 +13,14 @@ 6.4 * 6.5 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 6.6 */ 6.7 -public class Common implements Serializable { 6.8 +public class Common { 6.9 6.10 - private static final long serialVersionUID = 8592857158139659669L; 6.11 - 6.12 /** 6.13 * Parameter used in JSP files to denote the usage 6.14 * of the HTML interface 6.15 */ 6.16 - public static final String VIEW = "view"; 6.17 - public static final String VIEW_TYPE = "HTML"; 6.18 + public static final String VIEW = "view"; 6.19 + public static final String VIEW_TYPE = "HTML"; 6.20 6.21 /** 6.22 * Parameters used in the store.jsp file 6.23 @@ -75,43 +73,4 @@ 6.24 6.25 return null; 6.26 } 6.27 - 6.28 - /* The following getters exist only because we need access to this class 6.29 - * through JSP pages. To do so, the class need to be a Bean, thus even 6.30 - * though we have static fields, we need to have getters for the respective 6.31 - * static fields that are not static themselves. */ 6.32 - 6.33 - public List<String> getRegisteredFormats() { 6.34 - return Common.registeredFormats; 6.35 - } 6.36 - 6.37 - public String getView() { 6.38 - return Common.VIEW; 6.39 - } 6.40 - 6.41 - public String getViewType() { 6.42 - return Common.VIEW_TYPE; 6.43 - } 6.44 - 6.45 - public String getParamData() { 6.46 - return Common.PARAM_DATA; 6.47 - } 6.48 - 6.49 - public String getSubmitInput() { 6.50 - return Common.SUBMIT_INPUT; 6.51 - } 6.52 - 6.53 - public String getSubmitURL() { 6.54 - return Common.SUBMIT_URL; 6.55 - } 6.56 - 6.57 - public String getParamDataURL() { 6.58 - return Common.PARAM_DATA_URL; 6.59 - } 6.60 - 6.61 - public String toString() { 6.62 - return "Fucking Common bean and FUCKING JSTL/EL."; 6.63 - } 6.64 - 6.65 - public Common() { } 6.66 }
7.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/ConfigureCommon.java Fri Jul 27 20:49:11 2012 +0300 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,34 +0,0 @@ 7.4 -/** 7.5 - * 7.6 - */ 7.7 -package eu.earthobservatory.org.StrabonEndpoint; 7.8 - 7.9 -import javax.servlet.ServletContextEvent; 7.10 -import javax.servlet.ServletContextListener; 7.11 - 7.12 -import org.springframework.web.context.WebApplicationContext; 7.13 -import org.springframework.web.context.support.WebApplicationContextUtils; 7.14 - 7.15 -/** 7.16 - * @author Charalampos Nikolaou <charnik@di.uoa.gr> 7.17 - * 7.18 - */ 7.19 -public class ConfigureCommon implements ServletContextListener { 7.20 - 7.21 - private Common commonBean; 7.22 - 7.23 - @Override 7.24 - public void contextDestroyed(ServletContextEvent event) { 7.25 - } 7.26 - 7.27 - @Override 7.28 - public void contextInitialized(ServletContextEvent event) { 7.29 - WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext()); 7.30 - //event.getServletContext().setAttribute("commonBean", (Common) applicationContext.getBean("commonBean")); 7.31 - commonBean = (Common) applicationContext.getBean("commonBean"); 7.32 - event.getServletContext().setAttribute("commonBean", this.commonBean); 7.33 - 7.34 - System.out.println("HOOLA HOOLA HOOLA HOOLA HOOLA HOOLA HOOLA HOOLA"); 7.35 - System.out.println(commonBean); 7.36 - } 7.37 -}
8.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/DescribeBean.java Fri Jul 27 20:49:11 2012 +0300 8.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/DescribeBean.java Sat Jul 28 00:06:32 2012 +0300 8.3 @@ -109,7 +109,7 @@ 8.4 8.5 } else { 8.6 // set the query and format to be selected in the rendered page 8.7 - request.setAttribute("query", URLDecoder.decode(query, "UTF-8")); 8.8 + //request.setAttribute("query", URLDecoder.decode(query, "UTF-8")); 8.9 //request.setAttribute("format", URLDecoder.decode(reqFormat, "UTF-8")); 8.10 8.11 try {