Revision 29076
Added by Katerina Iatropoulou over 10 years ago
modules/dnet-functionality-services/trunk/src/main/webapp/search.jsp | ||
---|---|---|
1 |
<%@page import="java.util.List"%> |
|
2 |
<%@page import="eu.dnetlib.domain.EPR"%> |
|
3 |
<%@page import="gr.uoa.di.driver.enabling.resultset.ResultSet"%> |
|
4 |
<%@page import="org.apache.commons.lang.StringEscapeUtils"%> |
|
5 |
|
|
6 |
<jsp:useBean id="query" class="eu.dnetlib.data.search.web.Query" scope="request"> |
|
7 |
<jsp:setProperty name="query" property="*"/> |
|
8 |
</jsp:useBean> |
|
9 |
|
|
10 |
<% |
|
11 |
if (query == null) { |
|
12 |
%> |
|
13 |
<jsp:forward page="/"/> |
|
14 |
<% |
|
15 |
} |
|
16 |
%> |
|
17 |
|
|
18 |
|
|
19 |
<%@page import="eu.dnetlib.api.data.SearchService"%> |
|
20 |
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%> |
|
21 |
<%@page import="org.springframework.context.ApplicationContext"%> |
|
22 |
<%@page import="eu.dnetlib.data.search.web.SearchServiceContextUtils"%> |
|
23 |
<%@page import="gr.uoa.di.driver.enabling.resultset.ResultSetFactory"%> |
|
24 |
<html> |
|
25 |
<head> |
|
26 |
<title>Index Lookup</title> |
|
27 |
</head> |
|
28 |
<body> |
|
29 |
<h1>Index Lookup</h1> |
|
30 |
Search for <b> |
|
31 |
<% |
|
32 |
if (query.getQuery() == null || query.getQuery().length() == 0 ) { |
|
33 |
%> |
|
34 |
(empty query) |
|
35 |
<% |
|
36 |
} else { |
|
37 |
%> |
|
38 |
<%=query.getQuery()%> |
|
39 |
<% |
|
40 |
} |
|
41 |
%> |
|
42 |
</b> in <a href="services/searchWebService">local search service</a>...<br> |
|
43 |
|
|
44 |
<% |
|
45 |
long time = System.currentTimeMillis(); |
|
46 |
SearchService searchService = SearchServiceContextUtils.getSearchService(request); |
|
47 |
%> |
|
48 |
Created index endpoint in <%=System.currentTimeMillis()-time%> ms.<br> |
|
49 |
|
|
50 |
<% |
|
51 |
time = System.currentTimeMillis(); |
|
52 |
EPR epr = searchService.search(query.getQuery()); |
|
53 |
%> |
|
54 |
Index lookup lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
55 |
Returned EPR: <pre><%=StringEscapeUtils.escapeHtml(epr.toString())%></pre><br> |
|
56 |
<% |
|
57 |
time = System.currentTimeMillis(); |
|
58 |
ResultSet<String> rs = SearchServiceContextUtils.getResultSetFactory(request).createResultSet(epr); |
|
59 |
int count = rs.size(); |
|
60 |
%> |
|
61 |
Total documents in result set: <%=count%><br> |
|
62 |
Query Numof Documents lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
63 |
|
|
64 |
<% |
|
65 |
time = System.currentTimeMillis(); |
|
66 |
List<String> list = null; |
|
67 |
int MAX = 50; |
|
68 |
if (count > 0) { |
|
69 |
list = rs.getElements(1, Math.min(MAX, count)); |
|
70 |
} |
|
71 |
%> |
|
72 |
Retrieve top-<%=MAX%> docs lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
73 |
|
|
74 |
Top-<%=MAX%> results: |
|
75 |
<table> |
|
76 |
<tr><th>Count</th><th>Record</th></tr> |
|
77 |
<% for (int i = 0 ; i < MAX && i < count; i++ ) { %> |
|
78 |
<tr> |
|
79 |
<td><%=i+1%></td> |
|
80 |
<!-- |
|
81 |
<td><pre><%=StringEscapeUtils.escapeHtml(list.get(i))%></pre></td> |
|
82 |
--> |
|
83 |
<td><pre><%=StringEscapeUtils.escapeHtml( |
|
84 |
SearchServiceContextUtils.prettyPrint(list.get(i)))%> |
|
85 |
</pre></td> |
|
86 |
</tr> |
|
87 |
<% } %> |
|
88 |
</table> |
|
89 |
|
|
90 |
</body> |
|
91 |
</html> |
|
92 |
|
modules/dnet-functionality-services/trunk/src/main/webapp/error.jsp | ||
---|---|---|
1 |
<%@ page contentType="text/html; charset=utf-8" %> |
|
2 |
|
|
3 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
4 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
5 |
|
|
6 |
|
|
7 |
<head> |
|
8 |
<title>Error Page</title> |
|
9 |
|
|
10 |
<% |
|
11 |
Throwable exception = (Throwable) |
|
12 |
request.getAttribute("javax.servlet.error.exception"); |
|
13 |
String message = (String) |
|
14 |
request.getAttribute("javax.servlet.error.message"); |
|
15 |
Integer statusCode = (Integer) |
|
16 |
request.getAttribute("javax.servlet.error.status_code"); |
|
17 |
%> |
|
18 |
<b>Status Code : </b> <%=statusCode%> <br/> |
|
19 |
<b>Message : </b> <%=message%> <br/> |
|
20 |
|
|
21 |
<% while (exception != null) { %> |
|
22 |
<!-- Caught Exception --> |
|
23 |
<b>Exception : <%=exception.getMessage() %></b> <br/> |
|
24 |
<% |
|
25 |
StackTraceElement[] trace = exception.getStackTrace(); |
|
26 |
for (int i = 0; i < trace.length; i++) { |
|
27 |
%> |
|
28 |
<i> <%=trace[i]%></i><br/> |
|
29 |
<% |
|
30 |
} |
|
31 |
exception = exception.getCause(); |
|
32 |
} |
|
33 |
%> |
|
34 |
|
|
35 |
</body> |
|
36 |
</html> |
modules/dnet-functionality-services/trunk/src/main/webapp/browse.jsp | ||
---|---|---|
1 |
<%@page import="java.util.List"%> |
|
2 |
<%@page import="eu.dnetlib.domain.EPR"%> |
|
3 |
<%@page import="gr.uoa.di.driver.enabling.resultset.ResultSet"%> |
|
4 |
<%@page import="eu.dnetlib.api.data.SearchService"%> |
|
5 |
|
|
6 |
<jsp:useBean id="query" class="eu.dnetlib.data.search.web.Query" scope="request"> |
|
7 |
<jsp:setProperty name="query" property="*"/> |
|
8 |
</jsp:useBean> |
|
9 |
|
|
10 |
<% if (query == null) { %> |
|
11 |
<jsp:forward page="/"/> |
|
12 |
<% } %> |
|
13 |
|
|
14 |
<%@page import="org.apache.commons.lang.StringEscapeUtils"%> |
|
15 |
<%@page import="eu.dnetlib.data.search.web.SearchServiceContextUtils"%> |
|
16 |
<%@page import="eu.dnetlib.domain.data.BrowseData"%> |
|
17 |
<%@page import="eu.dnetlib.api.data.BrowseDataNotAvailableException"%> |
|
18 |
<html> |
|
19 |
<head> |
|
20 |
<title>Index Browse</title> |
|
21 |
</head> |
|
22 |
<body> |
|
23 |
<h1>Index Browse</h1> |
|
24 |
Browse for <b> |
|
25 |
<% if (query.getQuery() == null || query.getQuery().length() == 0 ) { %> |
|
26 |
(empty query) |
|
27 |
<% } else { %> |
|
28 |
<%=query.getQuery()%> |
|
29 |
<% } %> |
|
30 |
</b> |
|
31 |
<% List<String> fields = query.parseFields(); %> |
|
32 |
<% String field = (fields==null)?null:fields.get(0); %> |
|
33 |
<% if (field == null) { %> |
|
34 |
<b>using no field</b> |
|
35 |
<% } else { %> |
|
36 |
<b>using field: <%=field %></b> |
|
37 |
<% } %> |
|
38 |
in <a href="services/searchWebService">local search service</a>...<br> |
|
39 |
|
|
40 |
|
|
41 |
<% |
|
42 |
long time = System.currentTimeMillis(); |
|
43 |
SearchService search = SearchServiceContextUtils.getSearchService(request); |
|
44 |
%> |
|
45 |
Created index endpoint in <%=System.currentTimeMillis()-time%> ms.<br> |
|
46 |
|
|
47 |
<% |
|
48 |
time = System.currentTimeMillis(); |
|
49 |
BrowseData data = null; |
|
50 |
try { |
|
51 |
data = search.browse(query.getQuery(), field); |
|
52 |
} catch (BrowseDataNotAvailableException bdna) { |
|
53 |
data = null; |
|
54 |
} |
|
55 |
%> |
|
56 |
Index lookup lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
57 |
|
|
58 |
<% if (data == null) { %> |
|
59 |
<i>Browse results are currently being updated...</i> |
|
60 |
<% } else { %> |
|
61 |
Browse results: |
|
62 |
<table> |
|
63 |
<tr><th>Field</th><th>Value</th><th>Count</th></tr> |
|
64 |
<% |
|
65 |
for (String f : data.getFields()) { |
|
66 |
List<Integer> counts = data.getFieldCounts(f); |
|
67 |
List<String> values = data.getFieldValues(f); |
|
68 |
for (int i=0; i<counts.size(); i++) { |
|
69 |
%> |
|
70 |
<tr> |
|
71 |
<td><%=f%></td> |
|
72 |
<td><%=values.get(i)%></td> |
|
73 |
<td><%=counts.get(i)%></td> |
|
74 |
</tr> |
|
75 |
<% }} %> |
|
76 |
</table> |
|
77 |
<% } %> |
|
78 |
</body> |
|
79 |
</html> |
modules/dnet-functionality-services/trunk/src/main/webapp/index.jsp | ||
---|---|---|
1 |
<html> |
|
2 |
<head> |
|
3 |
<title>XFire</title> |
|
4 |
</head> |
|
5 |
<body> |
|
6 |
<h1>Ubuntu Rockz!!!</h1> |
|
7 |
<p/> |
|
8 |
|
|
9 |
<H2> |
|
10 |
<a href="services/">Search Service</a> |
|
11 |
[<a href="services/searchWebService?wsdl">WSDL</a>] |
|
12 |
</H2> |
|
13 |
|
|
14 |
<p> |
|
15 |
<hr> |
|
16 |
<p> |
|
17 |
|
|
18 |
<H2>Index Lookup</H2> |
|
19 |
<form action="search.jsp" method="post"> |
|
20 |
<table border="0" cellpadding="0" cellspacing="0"> |
|
21 |
<tr><td> |
|
22 |
<center> |
|
23 |
<input type="text" name="query" size="40"/> |
|
24 |
</center> |
|
25 |
</td></tr> |
|
26 |
<tr><td> |
|
27 |
<center> |
|
28 |
<input type="submit" name="submit"/> |
|
29 |
<input type="reset" name="reset"/> |
|
30 |
</center> |
|
31 |
</td></tr> |
|
32 |
</table> |
|
33 |
</form> |
|
34 |
|
|
35 |
<p> |
|
36 |
<hr> |
|
37 |
<p> |
|
38 |
|
|
39 |
<H2>Index Refine</H2> |
|
40 |
<form action="refine.jsp" method="post"> |
|
41 |
<table border="0" cellpadding="0" cellspacing="0"> |
|
42 |
<tr><td>query</td><td> |
|
43 |
<input type="text" name="query" size="40"/> |
|
44 |
</td></tr> |
|
45 |
<tr><td>fields</td><td> |
|
46 |
<input type="text" name="fields" size="30"/><br> |
|
47 |
<small>(comma or white space separated)</small> |
|
48 |
</td></tr> |
|
49 |
<tr><td> |
|
50 |
<center> |
|
51 |
<input type="submit" name="submit"/> |
|
52 |
<input type="reset" name="reset"/> |
|
53 |
</center> |
|
54 |
</td></tr> |
|
55 |
</table> |
|
56 |
</form> |
|
57 |
|
|
58 |
<p> |
|
59 |
<hr> |
|
60 |
<p> |
|
61 |
|
|
62 |
<H2>Index Browse</H2> |
|
63 |
<form action="browse.jsp" method="post"> |
|
64 |
<table border="0" cellpadding="0" cellspacing="0"> |
|
65 |
<tr><td>prefix</td><td> |
|
66 |
<input type="text" name="query" size="30"/><br> |
|
67 |
<small>(prefix query)</small> |
|
68 |
</td></tr> |
|
69 |
<tr><td>fields</td><td> |
|
70 |
<input type="text" name="fields" size="30"/><br> |
|
71 |
<small>(only first is used)</small> |
|
72 |
</td></tr> |
|
73 |
<tr><td> |
|
74 |
<center> |
|
75 |
<input type="submit" name="submit"/> |
|
76 |
<input type="reset" name="reset"/> |
|
77 |
</center> |
|
78 |
</td></tr> |
|
79 |
</table> |
|
80 |
</form> |
|
81 |
|
|
82 |
</body> |
|
83 |
</html> |
modules/dnet-functionality-services/trunk/src/main/webapp/refine.jsp | ||
---|---|---|
1 |
<%@page import="java.util.List"%> |
|
2 |
<%@page import="eu.dnetlib.domain.EPR"%> |
|
3 |
<%@page import="gr.uoa.di.driver.enabling.resultset.ResultSet"%> |
|
4 |
<%@page import="eu.dnetlib.api.data.SearchService"%> |
|
5 |
|
|
6 |
<jsp:useBean id="query" class="eu.dnetlib.data.search.web.Query" scope="request"> |
|
7 |
<jsp:setProperty name="query" property="*"/> |
|
8 |
</jsp:useBean> |
|
9 |
|
|
10 |
<% if (query == null) { %> |
|
11 |
<jsp:forward page="/"/> |
|
12 |
<% } %> |
|
13 |
|
|
14 |
|
|
15 |
<%@page import="org.apache.commons.lang.StringEscapeUtils"%> |
|
16 |
<%@page import="eu.dnetlib.data.search.web.SearchServiceContextUtils"%> |
|
17 |
<%@page import="gr.uoa.di.driver.enabling.resultset.ResultSetFactory"%> |
|
18 |
<html> |
|
19 |
<head> |
|
20 |
<title>Index Refine</title> |
|
21 |
</head> |
|
22 |
<body> |
|
23 |
<h1>Index Refine</h1> |
|
24 |
Refine for <b> |
|
25 |
<% if (query.getQuery() == null || query.getQuery().length() == 0 ) { %> |
|
26 |
(empty query) |
|
27 |
<% } else { %> |
|
28 |
<%=query.getQuery()%> |
|
29 |
<% } %> |
|
30 |
</b> |
|
31 |
<% List<String> fields = query.parseFields(); %> |
|
32 |
using <%=(fields==null)?0:fields.size()%>fields: <b><%=fields%></b> |
|
33 |
in <a href="services/searchWebService">local search service</a>...<br> |
|
34 |
|
|
35 |
<% |
|
36 |
long time = System.currentTimeMillis(); |
|
37 |
SearchService search = SearchServiceContextUtils.getSearchService(request); |
|
38 |
%> |
|
39 |
Created index endpoint in <%=System.currentTimeMillis()-time%> ms.<br> |
|
40 |
|
|
41 |
<% |
|
42 |
time = System.currentTimeMillis(); |
|
43 |
EPR epr = search.refine(query.getQuery(), fields); |
|
44 |
%> |
|
45 |
Index lookup lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
46 |
Returned EPR: <pre><%=StringEscapeUtils.escapeHtml(epr.toString())%></pre><br> |
|
47 |
|
|
48 |
<% |
|
49 |
time = System.currentTimeMillis(); |
|
50 |
ResultSet<String> rs = SearchServiceContextUtils.getResultSetFactory(request).createResultSet(epr); |
|
51 |
int count = rs.size(); |
|
52 |
%> |
|
53 |
Total records in result set: <%=count%><br> |
|
54 |
Query Numof records lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
55 |
|
|
56 |
<% |
|
57 |
time = System.currentTimeMillis(); |
|
58 |
List<String> list = null; |
|
59 |
int MAX = 50; |
|
60 |
if (count > 0) { |
|
61 |
list = rs.getElements(1, Math.min(MAX, count)); |
|
62 |
} |
|
63 |
%> |
|
64 |
Retrieve top-<%=MAX%> records lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
65 |
|
|
66 |
Top-<%=MAX%> results: |
|
67 |
<table> |
|
68 |
<tr><th>Count</th><th>Record</th></tr> |
|
69 |
<% for (int i = 0 ; i < MAX && i < count; i++ ) { %> |
|
70 |
<tr> |
|
71 |
<td><%=i+1%></td> |
|
72 |
<td><pre><%=StringEscapeUtils.escapeHtml(list.get(i))%></pre></td> |
|
73 |
</tr> |
|
74 |
<% } %> |
|
75 |
</table> |
|
76 |
|
|
77 |
</body> |
|
78 |
</html> |
|
79 |
|
modules/uoa-search/trunk/src/main/java/eu/dnetlib/data/search/web/servlet/SearchServlet.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.search.web.servlet; |
2 | 2 |
|
3 |
import java.io.PrintWriter; |
|
4 |
import java.util.ArrayList; |
|
5 |
import java.util.Collection; |
|
3 |
import eu.dnetlib.api.data.SearchService; |
|
4 |
import eu.dnetlib.data.search.app.SearchServiceImpl; |
|
5 |
import eu.dnetlib.domain.data.FormattedSearchResult; |
|
6 |
import org.apache.commons.lang.IncompleteArgumentException; |
|
7 |
import org.apache.commons.lang.StringEscapeUtils; |
|
8 |
import org.apache.log4j.Logger; |
|
9 |
import org.springframework.context.ApplicationContext; |
|
10 |
import org.springframework.web.context.support.WebApplicationContextUtils; |
|
6 | 11 |
|
7 | 12 |
import javax.servlet.ServletConfig; |
8 | 13 |
import javax.servlet.ServletException; |
9 | 14 |
import javax.servlet.http.HttpServlet; |
10 | 15 |
import javax.servlet.http.HttpServletRequest; |
11 | 16 |
import javax.servlet.http.HttpServletResponse; |
17 |
import java.io.PrintWriter; |
|
18 |
import java.util.ArrayList; |
|
19 |
import java.util.Collection; |
|
12 | 20 |
|
13 |
import org.apache.commons.lang.IncompleteArgumentException; |
|
14 |
import org.apache.commons.lang.StringEscapeUtils; |
|
15 |
import org.apache.log4j.Logger; |
|
16 |
import org.springframework.context.ApplicationContext; |
|
17 |
import org.springframework.web.context.support.WebApplicationContextUtils; |
|
18 |
|
|
19 |
import eu.dnetlib.api.data.SearchService; |
|
20 |
import eu.dnetlib.data.search.app.SearchServiceImpl; |
|
21 |
import eu.dnetlib.domain.data.FormattedSearchResult; |
|
22 |
|
|
23 | 21 |
@SuppressWarnings("serial") |
24 | 22 |
public class SearchServlet extends HttpServlet{ |
25 | 23 |
|
modules/uoa-search/trunk/src/main/java/eu/dnetlib/data/search/web/api/SearchRequestController.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.search.web.api; |
2 | 2 |
|
3 |
import com.google.common.collect.Maps; |
|
4 | 3 |
import eu.dnetlib.data.search.app.SearchServiceImpl; |
5 | 4 |
import eu.dnetlib.data.search.utils.vocabulary.VocabularyManager; |
6 | 5 |
import eu.dnetlib.domain.data.FormattedSearchResult; |
... | ... | |
16 | 15 |
import javax.annotation.Resource; |
17 | 16 |
import javax.servlet.http.HttpServletRequest; |
18 | 17 |
import javax.servlet.http.HttpServletResponse; |
19 |
import java.io.IOException; |
|
20 |
import java.io.InputStream; |
|
21 | 18 |
import java.io.PrintWriter; |
22 | 19 |
import java.util.*; |
23 | 20 |
|
... | ... | |
393 | 390 |
|
394 | 391 |
} |
395 | 392 |
|
396 |
private void initializeParameterTrackMap(HttpServletRequest request) { |
|
397 |
Map<String, String[]> parametersMap = request.getParameterMap(); |
|
398 |
Map<String, Boolean> newMap = null; |
|
399 |
|
|
400 |
if (parametersMap!= null) { |
|
401 |
newMap = Maps.newHashMapWithExpectedSize(parametersMap.size()); |
|
402 |
for (String key : parametersMap.keySet()) { |
|
403 |
newMap.put(key, new Boolean(false)); |
|
404 |
} |
|
405 |
} |
|
406 |
|
|
407 |
} |
|
408 |
|
|
409 | 393 |
private void checkParameters(List<String> allowedParameters, Map<String, String[]> currentParameters){ |
410 | 394 |
if(currentParameters != null) { |
411 | 395 |
for (String parameter : currentParameters.keySet()) { |
... | ... | |
427 | 411 |
throw new IllegalArgumentException("The requested model \'"+ allowedModels +"\' is not supported. The supported formats are: " + allowedModels); |
428 | 412 |
} |
429 | 413 |
} |
430 |
|
|
431 |
@RequestMapping(value = "openSearchDescriptor", method = RequestMethod.GET) |
|
432 |
public void loadOpenSearchDescriptor(HttpServletRequest request, HttpServletResponse response) { |
|
433 |
|
|
434 |
PrintWriter writer = null; |
|
435 |
InputStream inputStream = null; |
|
436 |
|
|
437 |
response.setContentType("text/xml"); |
|
438 |
|
|
439 |
try { |
|
440 |
writer = response.getWriter(); |
|
441 |
inputStream = this.getClass().getResourceAsStream("pages/openSearchDescriptor.jsp"); |
|
442 |
logger.debug(inputStream); |
|
443 |
IOUtils.copy(inputStream, writer); |
|
444 |
|
|
445 |
} catch (IOException e) { |
|
446 |
logger.error("Fail to load descriptor.", e); |
|
447 |
|
|
448 |
} finally { |
|
449 |
IOUtils.closeQuietly(writer); |
|
450 |
IOUtils.closeQuietly(inputStream); |
|
451 |
} |
|
452 |
|
|
453 |
} |
|
454 | 414 |
} |
modules/dnet-functionality-services/trunk/src/main/webapp/WEB-INF/pages/search.jsp | ||
---|---|---|
1 |
<%@page import="java.util.List"%> |
|
2 |
<%@page import="eu.dnetlib.domain.EPR"%> |
|
3 |
<%@page import="gr.uoa.di.driver.enabling.resultset.ResultSet"%> |
|
4 |
<%@page import="org.apache.commons.lang.StringEscapeUtils"%> |
|
5 |
|
|
6 |
<jsp:useBean id="query" class="eu.dnetlib.data.search.web.Query" scope="request"> |
|
7 |
<jsp:setProperty name="query" property="*"/> |
|
8 |
</jsp:useBean> |
|
9 |
|
|
10 |
<% |
|
11 |
if (query == null) { |
|
12 |
%> |
|
13 |
<jsp:forward page="/"/> |
|
14 |
<% |
|
15 |
} |
|
16 |
%> |
|
17 |
|
|
18 |
|
|
19 |
<%@page import="eu.dnetlib.api.data.SearchService"%> |
|
20 |
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%> |
|
21 |
<%@page import="org.springframework.context.ApplicationContext"%> |
|
22 |
<%@page import="eu.dnetlib.data.search.web.SearchServiceContextUtils"%> |
|
23 |
<%@page import="gr.uoa.di.driver.enabling.resultset.ResultSetFactory"%> |
|
24 |
<html> |
|
25 |
<head> |
|
26 |
<title>Index Lookup</title> |
|
27 |
</head> |
|
28 |
<body> |
|
29 |
<h1>Index Lookup</h1> |
|
30 |
Search for <b> |
|
31 |
<% |
|
32 |
if (query.getQuery() == null || query.getQuery().length() == 0 ) { |
|
33 |
%> |
|
34 |
(empty query) |
|
35 |
<% |
|
36 |
} else { |
|
37 |
%> |
|
38 |
<%=query.getQuery()%> |
|
39 |
<% |
|
40 |
} |
|
41 |
%> |
|
42 |
</b> in <a href="services/searchWebService">local search service</a>...<br> |
|
43 |
|
|
44 |
<% |
|
45 |
long time = System.currentTimeMillis(); |
|
46 |
SearchService searchService = SearchServiceContextUtils.getSearchService(request); |
|
47 |
%> |
|
48 |
Created index endpoint in <%=System.currentTimeMillis()-time%> ms.<br> |
|
49 |
|
|
50 |
<% |
|
51 |
time = System.currentTimeMillis(); |
|
52 |
EPR epr = searchService.search(query.getQuery()); |
|
53 |
%> |
|
54 |
Index lookup lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
55 |
Returned EPR: <pre><%=StringEscapeUtils.escapeHtml(epr.toString())%></pre><br> |
|
56 |
<% |
|
57 |
time = System.currentTimeMillis(); |
|
58 |
ResultSet<String> rs = SearchServiceContextUtils.getResultSetFactory(request).createResultSet(epr); |
|
59 |
int count = rs.size(); |
|
60 |
%> |
|
61 |
Total documents in result set: <%=count%><br> |
|
62 |
Query Numof Documents lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
63 |
|
|
64 |
<% |
|
65 |
time = System.currentTimeMillis(); |
|
66 |
List<String> list = null; |
|
67 |
int MAX = 50; |
|
68 |
if (count > 0) { |
|
69 |
list = rs.getElements(1, Math.min(MAX, count)); |
|
70 |
} |
|
71 |
%> |
|
72 |
Retrieve top-<%=MAX%> docs lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
73 |
|
|
74 |
Top-<%=MAX%> results: |
|
75 |
<table> |
|
76 |
<tr><th>Count</th><th>Record</th></tr> |
|
77 |
<% for (int i = 0 ; i < MAX && i < count; i++ ) { %> |
|
78 |
<tr> |
|
79 |
<td><%=i+1%></td> |
|
80 |
<!-- |
|
81 |
<td><pre><%=StringEscapeUtils.escapeHtml(list.get(i))%></pre></td> |
|
82 |
--> |
|
83 |
<td><pre><%=StringEscapeUtils.escapeHtml( |
|
84 |
SearchServiceContextUtils.prettyPrint(list.get(i)))%> |
|
85 |
</pre></td> |
|
86 |
</tr> |
|
87 |
<% } %> |
|
88 |
</table> |
|
89 |
|
|
90 |
</body> |
|
91 |
</html> |
|
92 |
|
modules/dnet-functionality-services/trunk/src/main/webapp/WEB-INF/pages/openSearchDescriptor.jsp | ||
---|---|---|
1 |
<%@page contentType="application/xml" %><%@ page isELIgnored="false" %><?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> |
|
3 |
<ShortName>OpenAIRE Search</ShortName> |
|
4 |
<Description>Use OpenAIRE to search for research results</Description> |
|
5 |
<Tags>OpenAIRE</Tags> |
|
6 |
<Contact>https://www.openaire.eu/support/helpdesk</Contact> |
|
7 |
<Url type="application/rss+xml" |
|
8 |
template="${baseUrl}/api/publications?keywords={searchTerms}&page={startPage}&size={count}&format=rss"/> |
|
9 |
</OpenSearchDescription> |
modules/dnet-functionality-services/trunk/src/main/webapp/WEB-INF/pages/index.jsp | ||
---|---|---|
1 |
<html> |
|
2 |
<head> |
|
3 |
<title>XFire</title> |
|
4 |
</head> |
|
5 |
<body> |
|
6 |
<h1>Ubuntu Rockz!!!</h1> |
|
7 |
<p/> |
|
8 |
|
|
9 |
<H2> |
|
10 |
<a href="services/">Search Service</a> |
|
11 |
[<a href="services/searchWebService?wsdl">WSDL</a>] |
|
12 |
</H2> |
|
13 |
|
|
14 |
<p> |
|
15 |
<hr> |
|
16 |
<p> |
|
17 |
|
|
18 |
<H2>Index Lookup</H2> |
|
19 |
<form action="search.jsp" method="post"> |
|
20 |
<table border="0" cellpadding="0" cellspacing="0"> |
|
21 |
<tr><td> |
|
22 |
<center> |
|
23 |
<input type="text" name="query" size="40"/> |
|
24 |
</center> |
|
25 |
</td></tr> |
|
26 |
<tr><td> |
|
27 |
<center> |
|
28 |
<input type="submit" name="submit"/> |
|
29 |
<input type="reset" name="reset"/> |
|
30 |
</center> |
|
31 |
</td></tr> |
|
32 |
</table> |
|
33 |
</form> |
|
34 |
|
|
35 |
<p> |
|
36 |
<hr> |
|
37 |
<p> |
|
38 |
|
|
39 |
<H2>Index Refine</H2> |
|
40 |
<form action="refine.jsp" method="post"> |
|
41 |
<table border="0" cellpadding="0" cellspacing="0"> |
|
42 |
<tr><td>query</td><td> |
|
43 |
<input type="text" name="query" size="40"/> |
|
44 |
</td></tr> |
|
45 |
<tr><td>fields</td><td> |
|
46 |
<input type="text" name="fields" size="30"/><br> |
|
47 |
<small>(comma or white space separated)</small> |
|
48 |
</td></tr> |
|
49 |
<tr><td> |
|
50 |
<center> |
|
51 |
<input type="submit" name="submit"/> |
|
52 |
<input type="reset" name="reset"/> |
|
53 |
</center> |
|
54 |
</td></tr> |
|
55 |
</table> |
|
56 |
</form> |
|
57 |
|
|
58 |
<p> |
|
59 |
<hr> |
|
60 |
<p> |
|
61 |
|
|
62 |
<H2>Index Browse</H2> |
|
63 |
<form action="browse.jsp" method="post"> |
|
64 |
<table border="0" cellpadding="0" cellspacing="0"> |
|
65 |
<tr><td>prefix</td><td> |
|
66 |
<input type="text" name="query" size="30"/><br> |
|
67 |
<small>(prefix query)</small> |
|
68 |
</td></tr> |
|
69 |
<tr><td>fields</td><td> |
|
70 |
<input type="text" name="fields" size="30"/><br> |
|
71 |
<small>(only first is used)</small> |
|
72 |
</td></tr> |
|
73 |
<tr><td> |
|
74 |
<center> |
|
75 |
<input type="submit" name="submit"/> |
|
76 |
<input type="reset" name="reset"/> |
|
77 |
</center> |
|
78 |
</td></tr> |
|
79 |
</table> |
|
80 |
</form> |
|
81 |
|
|
82 |
</body> |
|
83 |
</html> |
modules/dnet-functionality-services/trunk/src/main/webapp/WEB-INF/pages/refine.jsp | ||
---|---|---|
1 |
<%@page import="java.util.List"%> |
|
2 |
<%@page import="eu.dnetlib.domain.EPR"%> |
|
3 |
<%@page import="gr.uoa.di.driver.enabling.resultset.ResultSet"%> |
|
4 |
<%@page import="eu.dnetlib.api.data.SearchService"%> |
|
5 |
|
|
6 |
<jsp:useBean id="query" class="eu.dnetlib.data.search.web.Query" scope="request"> |
|
7 |
<jsp:setProperty name="query" property="*"/> |
|
8 |
</jsp:useBean> |
|
9 |
|
|
10 |
<% if (query == null) { %> |
|
11 |
<jsp:forward page="/"/> |
|
12 |
<% } %> |
|
13 |
|
|
14 |
|
|
15 |
<%@page import="org.apache.commons.lang.StringEscapeUtils"%> |
|
16 |
<%@page import="eu.dnetlib.data.search.web.SearchServiceContextUtils"%> |
|
17 |
<%@page import="gr.uoa.di.driver.enabling.resultset.ResultSetFactory"%> |
|
18 |
<html> |
|
19 |
<head> |
|
20 |
<title>Index Refine</title> |
|
21 |
</head> |
|
22 |
<body> |
|
23 |
<h1>Index Refine</h1> |
|
24 |
Refine for <b> |
|
25 |
<% if (query.getQuery() == null || query.getQuery().length() == 0 ) { %> |
|
26 |
(empty query) |
|
27 |
<% } else { %> |
|
28 |
<%=query.getQuery()%> |
|
29 |
<% } %> |
|
30 |
</b> |
|
31 |
<% List<String> fields = query.parseFields(); %> |
|
32 |
using <%=(fields==null)?0:fields.size()%>fields: <b><%=fields%></b> |
|
33 |
in <a href="services/searchWebService">local search service</a>...<br> |
|
34 |
|
|
35 |
<% |
|
36 |
long time = System.currentTimeMillis(); |
|
37 |
SearchService search = SearchServiceContextUtils.getSearchService(request); |
|
38 |
%> |
|
39 |
Created index endpoint in <%=System.currentTimeMillis()-time%> ms.<br> |
|
40 |
|
|
41 |
<% |
|
42 |
time = System.currentTimeMillis(); |
|
43 |
EPR epr = search.refine(query.getQuery(), fields); |
|
44 |
%> |
|
45 |
Index lookup lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
46 |
Returned EPR: <pre><%=StringEscapeUtils.escapeHtml(epr.toString())%></pre><br> |
|
47 |
|
|
48 |
<% |
|
49 |
time = System.currentTimeMillis(); |
|
50 |
ResultSet<String> rs = SearchServiceContextUtils.getResultSetFactory(request).createResultSet(epr); |
|
51 |
int count = rs.size(); |
|
52 |
%> |
|
53 |
Total records in result set: <%=count%><br> |
|
54 |
Query Numof records lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
55 |
|
|
56 |
<% |
|
57 |
time = System.currentTimeMillis(); |
|
58 |
List<String> list = null; |
|
59 |
int MAX = 50; |
|
60 |
if (count > 0) { |
|
61 |
list = rs.getElements(1, Math.min(MAX, count)); |
|
62 |
} |
|
63 |
%> |
|
64 |
Retrieve top-<%=MAX%> records lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
65 |
|
|
66 |
Top-<%=MAX%> results: |
|
67 |
<table> |
|
68 |
<tr><th>Count</th><th>Record</th></tr> |
|
69 |
<% for (int i = 0 ; i < MAX && i < count; i++ ) { %> |
|
70 |
<tr> |
|
71 |
<td><%=i+1%></td> |
|
72 |
<td><pre><%=StringEscapeUtils.escapeHtml(list.get(i))%></pre></td> |
|
73 |
</tr> |
|
74 |
<% } %> |
|
75 |
</table> |
|
76 |
|
|
77 |
</body> |
|
78 |
</html> |
|
79 |
|
modules/dnet-functionality-services/trunk/src/main/webapp/WEB-INF/pages/error.jsp | ||
---|---|---|
1 |
<%@ page contentType="text/html; charset=utf-8" %> |
|
2 |
|
|
3 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
4 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
5 |
|
|
6 |
|
|
7 |
<head> |
|
8 |
<title>Error Page</title> |
|
9 |
|
|
10 |
<% |
|
11 |
Throwable exception = (Throwable) |
|
12 |
request.getAttribute("javax.servlet.error.exception"); |
|
13 |
String message = (String) |
|
14 |
request.getAttribute("javax.servlet.error.message"); |
|
15 |
Integer statusCode = (Integer) |
|
16 |
request.getAttribute("javax.servlet.error.status_code"); |
|
17 |
%> |
|
18 |
<b>Status Code : </b> <%=statusCode%> <br/> |
|
19 |
<b>Message : </b> <%=message%> <br/> |
|
20 |
|
|
21 |
<% while (exception != null) { %> |
|
22 |
<!-- Caught Exception --> |
|
23 |
<b>Exception : <%=exception.getMessage() %></b> <br/> |
|
24 |
<% |
|
25 |
StackTraceElement[] trace = exception.getStackTrace(); |
|
26 |
for (int i = 0; i < trace.length; i++) { |
|
27 |
%> |
|
28 |
<i> <%=trace[i]%></i><br/> |
|
29 |
<% |
|
30 |
} |
|
31 |
exception = exception.getCause(); |
|
32 |
} |
|
33 |
%> |
|
34 |
|
|
35 |
</body> |
|
36 |
</html> |
modules/dnet-functionality-services/trunk/src/main/webapp/WEB-INF/pages/browse.jsp | ||
---|---|---|
1 |
<%@page import="java.util.List"%> |
|
2 |
<%@page import="eu.dnetlib.domain.EPR"%> |
|
3 |
<%@page import="gr.uoa.di.driver.enabling.resultset.ResultSet"%> |
|
4 |
<%@page import="eu.dnetlib.api.data.SearchService"%> |
|
5 |
|
|
6 |
<jsp:useBean id="query" class="eu.dnetlib.data.search.web.Query" scope="request"> |
|
7 |
<jsp:setProperty name="query" property="*"/> |
|
8 |
</jsp:useBean> |
|
9 |
|
|
10 |
<% if (query == null) { %> |
|
11 |
<jsp:forward page="/"/> |
|
12 |
<% } %> |
|
13 |
|
|
14 |
<%@page import="org.apache.commons.lang.StringEscapeUtils"%> |
|
15 |
<%@page import="eu.dnetlib.data.search.web.SearchServiceContextUtils"%> |
|
16 |
<%@page import="eu.dnetlib.domain.data.BrowseData"%> |
|
17 |
<%@page import="eu.dnetlib.api.data.BrowseDataNotAvailableException"%> |
|
18 |
<html> |
|
19 |
<head> |
|
20 |
<title>Index Browse</title> |
|
21 |
</head> |
|
22 |
<body> |
|
23 |
<h1>Index Browse</h1> |
|
24 |
Browse for <b> |
|
25 |
<% if (query.getQuery() == null || query.getQuery().length() == 0 ) { %> |
|
26 |
(empty query) |
|
27 |
<% } else { %> |
|
28 |
<%=query.getQuery()%> |
|
29 |
<% } %> |
|
30 |
</b> |
|
31 |
<% List<String> fields = query.parseFields(); %> |
|
32 |
<% String field = (fields==null)?null:fields.get(0); %> |
|
33 |
<% if (field == null) { %> |
|
34 |
<b>using no field</b> |
|
35 |
<% } else { %> |
|
36 |
<b>using field: <%=field %></b> |
|
37 |
<% } %> |
|
38 |
in <a href="services/searchWebService">local search service</a>...<br> |
|
39 |
|
|
40 |
|
|
41 |
<% |
|
42 |
long time = System.currentTimeMillis(); |
|
43 |
SearchService search = SearchServiceContextUtils.getSearchService(request); |
|
44 |
%> |
|
45 |
Created index endpoint in <%=System.currentTimeMillis()-time%> ms.<br> |
|
46 |
|
|
47 |
<% |
|
48 |
time = System.currentTimeMillis(); |
|
49 |
BrowseData data = null; |
|
50 |
try { |
|
51 |
data = search.browse(query.getQuery(), field); |
|
52 |
} catch (BrowseDataNotAvailableException bdna) { |
|
53 |
data = null; |
|
54 |
} |
|
55 |
%> |
|
56 |
Index lookup lasted <%=System.currentTimeMillis()-time%> ms.<br> |
|
57 |
|
|
58 |
<% if (data == null) { %> |
|
59 |
<i>Browse results are currently being updated...</i> |
|
60 |
<% } else { %> |
|
61 |
Browse results: |
|
62 |
<table> |
|
63 |
<tr><th>Field</th><th>Value</th><th>Count</th></tr> |
|
64 |
<% |
|
65 |
for (String f : data.getFields()) { |
|
66 |
List<Integer> counts = data.getFieldCounts(f); |
|
67 |
List<String> values = data.getFieldValues(f); |
|
68 |
for (int i=0; i<counts.size(); i++) { |
|
69 |
%> |
|
70 |
<tr> |
|
71 |
<td><%=f%></td> |
|
72 |
<td><%=values.get(i)%></td> |
|
73 |
<td><%=counts.get(i)%></td> |
|
74 |
</tr> |
|
75 |
<% }} %> |
|
76 |
</table> |
|
77 |
<% } %> |
|
78 |
</body> |
|
79 |
</html> |
modules/dnet-functionality-services/trunk/src/main/webapp/WEB-INF/dispatcher-servlet.xml | ||
---|---|---|
1 | 1 |
<beans xmlns="http://www.springframework.org/schema/beans" |
2 | 2 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
3 | 3 |
xmlns:context="http://www.springframework.org/schema/context" |
4 |
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
4 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
5 | 5 |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
6 | 6 |
http://www.springframework.org/schema/context |
7 | 7 |
http://www.springframework.org/schema/context/spring-context-2.5.xsd"> |
8 | 8 |
|
9 | 9 |
<import resource="classpath*:/eu/dnetlib/data/search/web/api/dispatcher-servlet.xml"/> |
10 |
|
|
10 |
|
|
11 |
<bean id="viewResolver" |
|
12 |
class="org.springframework.web.servlet.view.UrlBasedViewResolver"> |
|
13 |
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> |
|
14 |
<property name="prefix" value="/WEB-INF/pages/"/> |
|
15 |
<property name="suffix" value=".jsp"/> |
|
16 |
</bean> |
|
11 | 17 |
</beans> |
modules/dnet-functionality-services/trunk/src/main/webapp/WEB-INF/web.xml | ||
---|---|---|
42 | 42 |
|
43 | 43 |
<servlet-mapping> |
44 | 44 |
<servlet-name>dispatcher</servlet-name> |
45 |
<url-pattern>/*</url-pattern>
|
|
45 |
<url-pattern>/</url-pattern> |
|
46 | 46 |
</servlet-mapping> |
47 |
|
|
48 | 47 |
</web-app> |
modules/dnet-functionality-services/trunk/pom.xml | ||
---|---|---|
71 | 71 |
<groupId>org.apache.cxf</groupId> |
72 | 72 |
<artifactId>cxf-rt-transports-http</artifactId> |
73 | 73 |
<version>${cxf.version}</version> |
74 |
</dependency> |
|
75 |
</dependencies> |
|
74 |
</dependency> |
|
75 |
<dependency> |
|
76 |
<groupId>jstl</groupId> |
|
77 |
<artifactId>jstl</artifactId> |
|
78 |
<version>1.2</version> |
|
79 |
</dependency> |
|
80 |
</dependencies> |
|
76 | 81 |
</project> |
Also available in: Unified diff
adding openSearch descriptor