From: <hl...@us...> - 2010-03-17 14:39:44
|
Revision: 617 http://treebase.svn.sourceforge.net/treebase/?rev=617&view=rev Author: hlapp Date: 2010-03-17 14:39:38 +0000 (Wed, 17 Mar 2010) Log Message: ----------- Move to standard INSTALL name and removed hints to cruft. Added Paths: ----------- trunk/treebase-web/INSTALL.txt Removed Paths: ------------- trunk/treebase-web/read.txt Copied: trunk/treebase-web/INSTALL.txt (from rev 614, trunk/treebase-web/read.txt) =================================================================== --- trunk/treebase-web/INSTALL.txt (rev 0) +++ trunk/treebase-web/INSTALL.txt 2010-03-17 14:39:38 UTC (rev 617) @@ -0,0 +1,6 @@ +For information on configuring, building, and deploying TreeBASE +consult the TreeBASE wiki: + +http://sourceforge.net/apps/mediawiki/treebase/ + +Of particular relevance are sections 'Building' and 'Deploying'. Deleted: trunk/treebase-web/read.txt =================================================================== --- trunk/treebase-web/read.txt 2010-03-17 14:35:21 UTC (rev 616) +++ trunk/treebase-web/read.txt 2010-03-17 14:39:38 UTC (rev 617) @@ -1,5 +0,0 @@ -The information contained in this file was no longer up-to-date -and no longer being maintained. For information on configuring, -building and deploying TreeBASE, consult the wiki: - -http://sourceforge.net/apps/mediawiki/treebase/ \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-03-31 18:46:36
|
Revision: 663 http://treebase.svn.sourceforge.net/treebase/?rev=663&view=rev Author: youjun Date: 2010-03-31 18:46:29 +0000 (Wed, 31 Mar 2010) Log Message: ----------- bring in urlrewrite tool, re-direct "view tree" to phylowidget.org Modified Paths: -------------- trunk/treebase-web/pom.xml trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/treeList.jsp trunk/treebase-web/src/main/webapp/WEB-INF/web.xml Added Paths: ----------- trunk/treebase-web/src/main/webapp/WEB-INF/urlrewrite.xml Modified: trunk/treebase-web/pom.xml =================================================================== --- trunk/treebase-web/pom.xml 2010-03-31 14:49:01 UTC (rev 662) +++ trunk/treebase-web/pom.xml 2010-03-31 18:46:29 UTC (rev 663) @@ -77,6 +77,10 @@ <name>NeXML Remote Repository</name> <url>http://nexml-dev.nescent.org/.m2/repository/</url> </repository> + <repository> + <id>org.tuckey.urlrewritefilter</id> + <url>http://repository.jboss.org/maven2/org/tuckey/urlrewritefilter/</url> + </repository> </repositories> @@ -316,6 +320,11 @@ <version>1.0</version> </dependency> + <dependency> + <groupId>org.tuckey</groupId> + <artifactId>urlrewritefilter</artifactId> + <version>3.0.4</version> + </dependency> </dependencies> </project> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp 2010-03-31 14:49:01 UTC (rev 662) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/study/trees.jsp 2010-03-31 18:46:29 UTC (rev 663) @@ -19,11 +19,11 @@ export="false"> <display:column sortable="false" title="ID"> - <c:url var="treeURL" value="tree.html"> - <c:param name="id" value="${study.id}" /> - <c:param name="treeid" value="${tree.id}" /> - </c:url> - <a href="javascript:popupWithSizes('${treeURL}',1000,900,'1')">Tr${tree.id}</a> + <c:url var="url" value="/tree_for_phylowidget/"> + <!--c:param name="treeid" value="${tree.id}" /--> + <!--c:param name="id" value="${tree.study.id}" /--> + </c:url> + <a href="http://www.phylowidget.org/full/?tree='http://<%=request.getServerName()%>:<%=request.getServerPort()%>${url}TB2:Tr${tree.id}'" target="myplwidget">Tr${tree.id}</a> </display:column> <display:column @@ -119,11 +119,11 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="treeURL" value="tree.html"> - <c:param name="id" value="${study.id}" /> - <c:param name="treeid" value="${tree.id}" /> - </c:url> - <a href="javascript:popupWithSizes('${treeURL}',1000,900,'1')"> + <c:url var="url" value="/tree_for_phylowidget/"> + <!--c:param name="treeid" value="${tree.id}" /--> + <!--c:param name="id" value="${tree.study.id}" /--> + </c:url> + <a href="http://www.phylowidget.org/full/?tree='http://<%=request.getServerName()%>:<%=request.getServerPort()%>${url}TB2:Tr${tree.id}'" target="myplwidget"> <img class="iconButton" src="<fmt:message key="icons.list"/>" Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/treeList.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/treeList.jsp 2010-03-31 14:49:01 UTC (rev 662) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/treeList.jsp 2010-03-31 18:46:29 UTC (rev 663) @@ -14,12 +14,12 @@ export = "false"> <display:column title="" sortable="true" class="checkBoxColumn"> - <c:url var="url" value="study/tree.html"> - <c:param name="treeid" value="${tree.id}" /> - <c:param name="id" value="${tree.study.id}" /> + <c:url var="url" value="/tree_for_phylowidget/"> + <!--c:param name="treeid" value="${tree.id}" /--> + <!--c:param name="id" value="${tree.study.id}" /--> </c:url> <input type="checkbox" id="s-${tree.id }" name="selection" value="${tree.id }" /> - <a href="${url}" target="myplwidget">Tr${tree.id}</a> + <a href="http://www.phylowidget.org/full/?tree='http://<%=request.getServerName()%>:<%=request.getServerPort()%>${url}TB2:Tr${tree.id}'" target="myplwidget">Tr${tree.id}</a> </display:column> @@ -81,11 +81,11 @@ sortable="false" class="iconColumn" headerClass="iconColumn"> - <c:url var="url" value="study/tree.html"> - <c:param name="treeid" value="${tree.id}" /> - <c:param name="id" value="${tree.study.id}" /> + <c:url var="url" value="/tree_for_phylowidget/"> + <!--c:param name="treeid" value="${tree.id}" /--> + <!--c:param name="id" value="${tree.study.id}" /--> </c:url> - <a href="${url}" target="myplwidget"> + <a href="http://www.phylowidget.org/full/?tree='http://<%=request.getServerName()%>:<%=request.getServerPort()%>${url}TB2:Tr${tree.id}'" target="myplwidget"> <img class="iconButton" src="<fmt:message key="icons.list"/>" Added: trunk/treebase-web/src/main/webapp/WEB-INF/urlrewrite.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/urlrewrite.xml (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/urlrewrite.xml 2010-03-31 18:46:29 UTC (rev 663) @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN" + "http://tuckey.org/res/dtds/urlrewrite3.2.dtd"> + +<!-- + + Configuration file for UrlRewriteFilter + http://tuckey.org/urlrewrite/ + +--> +<urlrewrite> + + <rule> + <note> + The rule means that requests to /test/status/ will be redirected to /rewrite-status + the url will be rewritten. + </note> + <from>/tree_for_phylowidget/(.*)</from> + <to>/phylows/tree/$1?format=nexus</to> + </rule> + + <!-- + <outbound-rule> + <note> + The outbound-rule specifies that when response.encodeURL is called (if you are using JSTL c:url) + the url /rewrite-status will be rewritten to /test/status/. + + The above rule and this outbound-rule means that end users should never see the + url /rewrite-status only /test/status/ both in thier location bar and in hyperlinks + in your pages. + </note> + <from>/rewrite-status</from> + <to>/test/status/</to> + </outbound-rule> + --> + + <!-- + + INSTALLATION + + in your web.xml add... + + <filter> + <filter-name>UrlRewriteFilter</filter-name> + <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class> + <init-param> + <param-name>logLevel</param-name> + <param-value>WARN</param-value> + </init-param> + </filter> + <filter-mapping> + <filter-name>UrlRewriteFilter</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + EXAMPLES + + Redirect one url + <rule> + <from>/some/old/page.html</from> + <to type="redirect">/very/new/page.html</to> + </rule> + + Redirect a directory + <rule> + <from>/some/olddir/(.*)</from> + <to type="redirect">/very/newdir/$1</to> + </rule> + + Clean a url + <rule> + <from>/products/([0-9]+)</from> + <to>/products/index.jsp?product_id=$1</to> + </rule> + eg, /products/1234 will be passed on to /products/index.jsp?product_id=1234 without the user noticing. + + Browser detection + <rule> + <condition name="user-agent">Mozilla/[1-4]</condition> + <from>/some/page.html</from> + <to>/some/page-for-old-browsers.html</to> + </rule> + eg, will pass the request for /some/page.html on to /some/page-for-old-browsers.html only for older + browsers whose user agent srtings match Mozilla/1, Mozilla/2, Mozilla/3 or Mozilla/4. + + Centralised browser detection + <rule> + <condition name="user-agent">Mozilla/[1-4]</condition> + <set type="request" name="browser">moz</set> + </rule> + eg, all requests will be checked against the condition and if matched + request.setAttribute("browser", "moz") will be called. + + --> + +</urlrewrite> + Modified: trunk/treebase-web/src/main/webapp/WEB-INF/web.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2010-03-31 14:49:01 UTC (rev 662) +++ trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2010-03-31 18:46:29 UTC (rev 663) @@ -85,8 +85,12 @@ <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class> </filter> - - + <filter> + <filter-name>UrlRewriteFilter</filter-name> + <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class> + </filter> + + <!-- ========================================================== --> <!-- Mappings for Filters defined aboved --> @@ -114,8 +118,13 @@ <filter-name>ResponseOverrideFilter</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> + + <filter-mapping> + <filter-name>UrlRewriteFilter</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> - + <!-- ========================================================== --> <!-- define the listener --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-04-03 14:52:27
|
Revision: 672 http://treebase.svn.sourceforge.net/treebase/?rev=672&view=rev Author: youjun Date: 2010-04-03 14:52:13 +0000 (Sat, 03 Apr 2010) Log Message: ----------- import oai-pmh-provider Modified Paths: -------------- trunk/treebase-web/pom.xml Added Paths: ----------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/Identify.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/OAIPMHCommand.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/validators/OAIPMHValidator.java trunk/treebase-web/src/main/webapp/WEB-INF/identify.properties Modified: trunk/treebase-web/pom.xml =================================================================== --- trunk/treebase-web/pom.xml 2010-04-03 14:08:25 UTC (rev 671) +++ trunk/treebase-web/pom.xml 2010-04-03 14:52:13 UTC (rev 672) @@ -326,5 +326,20 @@ <version>3.0.4</version> </dependency> + <dependency> + <groupId>velocity-tools</groupId> + <artifactId>velocity-tools</artifactId> + <version>1.1</version> + </dependency> + <dependency> + <groupId>velocity-tools</groupId> + <artifactId>velocity-tools-generic</artifactId> + <version>1.1</version> + </dependency> + <dependency> + <groupId>velocity-tools</groupId> + <artifactId>velocity-tools-view</artifactId> + <version>1.1</version> + </dependency> </dependencies> </project> Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/OAIPMHController.java 2010-04-03 14:52:13 UTC (rev 672) @@ -0,0 +1,275 @@ +package org.treebase.oai.web.controller; + +import java.lang.reflect.Method; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.validation.BindException; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.AbstractCommandController; +import org.treebase.oai.web.command.Identify; +import org.treebase.oai.web.command.OAIPMHCommand; +import org.treebase.oai.web.util.IdentifyUtil; +import org.cipres.treebase.domain.admin.Person; +import org.cipres.treebase.domain.study.ArticleCitation; +import org.cipres.treebase.domain.study.BookCitation; +import org.cipres.treebase.domain.study.Citation; +import org.cipres.treebase.domain.study.Study; +import org.cipres.treebase.domain.study.Submission; +import org.cipres.treebase.domain.study.SubmissionService; +import org.cipres.treebase.domain.study.StudyService; +/** + * OAIPMHController.java + * + * Created on Nov. 1, 2009 + * + * @author Youjun Guo + * + */ +public class OAIPMHController extends AbstractCommandController{ + + private SubmissionService submissionService; + private StudyService studyService; + private Identify identify; + + public OAIPMHController(){ + setCommandClass(OAIPMHCommand.class); + setCommandName("requestParams"); + } + + public SubmissionService getSubmissionService() { + return submissionService; + } + + public void setSubmissionService(SubmissionService submissionService) { + this.submissionService = submissionService; + } + + public StudyService getStudyService() { + return studyService; + } + + public void setStudyService(StudyService studyService) { + this.studyService = studyService; + } + + public Identify getIdentify() { + return identify; + } + + public void setIdentify(Identify identify) { + this.identify = identify; + } + + + + @Override + protected ModelAndView handle(HttpServletRequest request, + HttpServletResponse response, Object command, BindException errors) + throws Exception { + // TODO Auto-generated method stub + + OAIPMHCommand params = (OAIPMHCommand) command; + + Map model=errors.getModel(); + model.put("requestParams", params); + model.put("identify", this.identify); + + if(errors.getErrorCount()>0){ + if(errors.hasFieldErrors("metadataPrefix")){ + model.put("error_code", "cannotDisseminateFormat"); + model.put("error", "bad metadataPrefix"); + return new ModelAndView("error",model); + } + if(errors.hasFieldErrors("verb")){ + model.put("error_code", "badVerb"); + model.put("error", "no verb was found"); + return new ModelAndView("error",model); + } + if(errors.hasFieldErrors("identifier")){ + model.put("error_code", "idDoesNotExist"); + model.put("error", "no id was found"); + return new ModelAndView("error",model); + } + } + + Method method=null; + try{ + method=this.getClass().getMethod(params.getVerb(), new Class[]{OAIPMHCommand.class, Map.class}); + }catch(NoSuchMethodException nsme){ + model.put("error_code", "badVerb"); + model.put("error", "invalid verb"); + return new ModelAndView("error",model); + }catch(NullPointerException e){ + model.put("error_code", "badVerb"); + model.put("error", "missing verb"); + return (new ModelAndView("error",model)); + } + + return (ModelAndView) method.invoke(this, params, model); + + } + + public ModelAndView ListRecords(OAIPMHCommand params, Map model){ + + List<Submission> list=null; + try { + list = (List)submissionService.findSubmissionByCreateDateRange(IdentifyUtil.parseGranularity(identify.getGranularityPattern(),params.getModifiedFrom()), + IdentifyUtil.parseGranularity(identify.getGranularityPattern(),params.getModifiedUntil())); + } catch (ParseException e) { + model.put("error_code", "badArgument"); + model.put("error", "invalid from or until format"); + return (new ModelAndView("error",model)); + } + model.put("recordList", getRecordList(list)); + return (new ModelAndView("ListRecords",model)); + + } + + + public ModelAndView ListIdentifiers( OAIPMHCommand params, Map model){ + + List<Submission> list=null; + try { + list = (List)submissionService.findSubmissionByCreateDateRange(IdentifyUtil.parseGranularity(identify.getGranularityPattern(),params.getModifiedFrom()), + IdentifyUtil.parseGranularity(identify.getGranularityPattern(), params.getModifiedUntil())); + } catch (ParseException e) { + model.put("error_code", "badArgument"); + model.put("error", "invalid from or until format"); + return (new ModelAndView("error",model)); + } + model.put("recordList", getRecordList(list)); + return (new ModelAndView(params.getMetadataPrefix()+"_ListIdentifiers",model)); + + } + + public ModelAndView GetRecord( OAIPMHCommand params, Map model){ + + Submission submission = null; + + try{ + long id = IdentifyUtil.parseID(params); + submission = studyService.findByID(id).getSubmission(); + }catch(NumberFormatException nfe){ + model.put("error_code", "badArgument"); + model.put("error", "invalid id format"); + return (new ModelAndView("error",model)); + + } + catch (NullPointerException e){ + + model.put("error_code", "idDoesNotExist"); + model.put("error", "invalid id"); + return (new ModelAndView("error",model)); + + } + model.put("record", getRecordMap(submission)); + return (new ModelAndView("GetRecord",model)); + + } + + public ModelAndView Identify(OAIPMHCommand params, Map model){ + + + return (new ModelAndView("Identify",model)); + + } + + public ModelAndView ListSets(OAIPMHCommand params, Map model){ + model.put("error_code", "noSetHierarchy"); + model.put("error", "This repository does not support sets"); + return (new ModelAndView("error",model)); + + } + + public ModelAndView ListMetadataFormats(OAIPMHCommand params, Map model){ + + Submission submission = null; + + try{ + long id = IdentifyUtil.parseID(params); + submission = studyService.findByID(id).getSubmission(); + }catch(NumberFormatException nfe){ + model.put("error_code", "badArgument"); + model.put("error", "invalid id format"); + return (new ModelAndView("error",model)); + + } + catch (NullPointerException e){ + //id is optional for ListMetadataFormats + //return (new ModelAndView("error",model)); + } + + + return (new ModelAndView("ListMetadataFormats",model)); + + } + + + private Map getRecordMap(Submission submission){ + + Map map= new HashMap(); + + Study study=submission.getStudy(); + Citation citation=study.getCitation(); + String publisher=null; + if(!study.isPublished())return null; + + //System.out.println("ctype: "+citation.getCitationType()); + try{ + if(citation.getCitationType().toUpperCase().contains("BOOK")) + publisher=((BookCitation)citation).getPublisher(); + else publisher=((ArticleCitation)citation).getJournal(); + + + List<Person> authors=citation.getAuthors(); + + + map.put("title", citation.getTitle()); + map.put("creator", authors); + map.put("subject", citation.getKeywords()); + if(study.getName()!=null&study.getNotes()!=null) + map.put("description", study.getName()+" "+study.getNotes()); + else if(study.getNotes()==null) + map.put("description",study.getName()); + else + map.put("description",study.getNotes()); + map.put("publisher", publisher); + map.put("date", "published on "+citation.getPublishYear()); + map.put("identifier", "TreeBASE.org/study/TB2:s"+study.getId()); + map.put("datestamp", study.getReleaseDate()); + + }catch(NullPointerException e){ + //study 253 citation= null, data should be fixed + System.err.println("study "+study.getId()+ + " citation= "+e.getMessage()); + return null; + } + + //map.put("type", "text"); + //map.put("language", "en"); + + //map.put("issued", citation.getPublishYear()); + //map.put("abstract", citation.getAbstract()); + + + return map; + } + + private List getRecordList(List<Submission> sList) + { + List recordList=new ArrayList<Map>(); + + for(int i =0; i< sList.size(); i++){ + Map map=getRecordMap(sList.get(i)); + if(map!=null)recordList.add(map); + } + return recordList; + } +} Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/Identify.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/Identify.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/Identify.java 2010-04-03 14:52:13 UTC (rev 672) @@ -0,0 +1,125 @@ +package org.treebase.oai.web.command; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.SimpleTimeZone; +import java.util.TimeZone; +/** + * + * @author youjun + * class hold identify data about the service + */ + +public class Identify { + + + private String baseURL; + private String repositoryName; + private String protocolVersion; + private String adminEmail; + private String earliestDatestamp; + private String deletedRecord; + private String granularity; + private String granularityPattern; + private String repositoryIdentifier; + private String sampleIdentifier; + private String dryadPerfix; + private String identifierDelimiter; + private String dublinPerfix; + + + public String getGranularityPattern() { + return granularityPattern; + } + public void setGranularityPattern(String granularityPattern) { + this.granularityPattern = granularityPattern; + } + + + public String getIdentifierDelimiter() { + return identifierDelimiter; + } + public void setIdentifierDelimiter(String identifierDelimiter) { + this.identifierDelimiter = identifierDelimiter; + } + public String getDublinPerfix() { + return dublinPerfix; + } + public void setDublinPerfix(String dublinPerfix) { + this.dublinPerfix = dublinPerfix; + } + public String getDryadPerfix() { + return dryadPerfix; + } + public void setDryadPerfix(String dryadPerfix) { + this.dryadPerfix = dryadPerfix; + } + + public String getRepositoryIdentifier() { + return repositoryIdentifier; + } + public void setRepositoryIdentifier(String repositoryIdentifier) { + this.repositoryIdentifier = repositoryIdentifier; + } + public String getSampleIdentifier() { + return sampleIdentifier; + } + public void setSampleIdentifier(String sampleIdentifier) { + this.sampleIdentifier = sampleIdentifier; + } + + public String getBaseURL() { + return baseURL; + } + public void setBaseURL(String baseRUL) { + this.baseURL = baseRUL; + } + public String getRepositoryName() { + return repositoryName; + } + public void setRepositoryName(String repositoryName) { + this.repositoryName = repositoryName; + } + public String getProtocolVersion() { + return protocolVersion; + } + public void setProtocolVersion(String protocolVersion) { + this.protocolVersion = protocolVersion; + } + public String getAdminEmail() { + return adminEmail; + } + public void setAdminEmail(String adminEmail) { + this.adminEmail = adminEmail; + } + public String getEarliestDatestamp() { + return earliestDatestamp; + } + public void setEarliestDatestamp(String earliestDatestamp) { + this.earliestDatestamp = earliestDatestamp; + } + public String getDeletedRecord() { + return deletedRecord; + } + public void setDeletedRecord(String deletedRecord) { + this.deletedRecord = deletedRecord; + } + public String getGranularity() { + return granularity; + } + public void setGranularity(String granularity) { + this.granularity = granularity; + } + + // return a current date object in UTC + public String getResponseDate(){ + SimpleDateFormat format = new SimpleDateFormat(granularityPattern); + Calendar cal = Calendar.getInstance(new SimpleTimeZone(0, "GMT")); + format.setCalendar(cal); + return format.format(new Date()); + + } + +} Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/OAIPMHCommand.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/OAIPMHCommand.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/model/OAIPMHCommand.java 2010-04-03 14:52:13 UTC (rev 672) @@ -0,0 +1,74 @@ +package org.treebase.oai.web.command; +/** + * + * @author youjun + * class transfer page/query input data to controller + */ +public class OAIPMHCommand { + + private String from; + private String until; + private String resumptionToken; + private String identifier; + private String metadataPrefix; + private String set; + private String verb; + + public String getVerb() { + return verb; + } + public void setVerb(String verb) { + this.verb = verb; + } + public String getModifiedFrom() { + if(from!=null&&from.trim()!="")return from; + return "1995-11-04T00:00:00Z"; + } + + public String getFrom() { + return from; + } + + public void setFrom(String from) { + this.from = from; + } + public String getModifiedUntil() { + if(until != null && until.trim()!="") return until; + return ""; + } + + public String getUntil() { + return until; + } + + public void setUntil(String until) { + this.until = until; + } + public String getResumptionToken() { + return resumptionToken; + } + public void setResumptionToken(String resumptionToken) { + this.resumptionToken = resumptionToken; + } + public String getIdentifier() { + return identifier; + } + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + public String getMetadataPrefix() { + return metadataPrefix; + } + public void setMetadataPrefix(String metadataPrefix) { + this.metadataPrefix = metadataPrefix; + } + public String getSet() { + return set; + } + public void setSet(String set) { + this.set = set; + } + + + +} Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/IdentifyUtil.java 2010-04-03 14:52:13 UTC (rev 672) @@ -0,0 +1,51 @@ +package org.treebase.oai.web.util; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +import org.treebase.oai.web.command.Identify; +import org.treebase.oai.web.command.OAIPMHCommand; +/* + * + * @author youjun + * + */ +public class IdentifyUtil { + + // return a studyID by parsing params.identifier + + public static long parseID(OAIPMHCommand params) + { + String [] ids = params.getIdentifier().split("[/:.]"); + + return Long.parseLong(ids[ids.length-1].replaceAll("[a-zA-Z]","")); + } + + + // convert a time String to date object based on granularity + + public static Date parseGranularity(String granularity, String time ) throws ParseException + { + if(time=="")return new Date(); + SimpleDateFormat sdf = new SimpleDateFormat(granularity); + Date utcDate = sdf.parse(time); + return utcToLocal(utcDate); + + + } + + //convert a date object from utc to local + + protected static Date utcToLocal(Date utcDate) + { + long utcMiliseconds = utcDate.getTime(); + + Calendar cal = new GregorianCalendar(); + cal.setTimeInMillis(utcMiliseconds); + return new Date(utcMiliseconds + cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)); + } +} Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/validators/OAIPMHValidator.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/validators/OAIPMHValidator.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/validators/OAIPMHValidator.java 2010-04-03 14:52:13 UTC (rev 672) @@ -0,0 +1,40 @@ +package org.treebase.oai.web.validator; + +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import org.springframework.validation.Validator; +import org.treebase.oai.web.command.OAIPMHCommand; + +public class OAIPMHValidator implements Validator { + + public boolean supports(Class pClass) { + return OAIPMHCommand.class.equals(pClass); + } + + public void validate(Object pValidatable, Errors pError) { + // ValidationUtils.rejectIfEmpty(e, "name", "name.empty"); + OAIPMHCommand command = (OAIPMHCommand) pValidatable; + + String verb = command.getVerb(); + String fPrefix = command.getMetadataPrefix(); + + ValidationUtils.rejectIfEmptyOrWhitespace(pError, "verb", "empyt verb"); + + + if(verb!=null && verb.equals("GetRecord")) + ValidationUtils.rejectIfEmptyOrWhitespace(pError, "identifier", "empyt id"); + + // check format prefix + if(verb!=null){ + if(verb.equals("GetRecord")||verb.equals("ListIdentifiers")||verb.equals("ListRecords")){ + + ValidationUtils.rejectIfEmptyOrWhitespace(pError, "metadataPrefix", "cannotDisseminateFormat"); + + if(fPrefix!=null) + if(!(fPrefix.equals("oai_dc")||fPrefix.equals("dryad"))) + pError.rejectValue("metadataPrefix","cannotDisseminateFormat"); + } + } + } + +} Added: trunk/treebase-web/src/main/webapp/WEB-INF/identify.properties =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/identify.properties (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/identify.properties 2010-04-03 14:52:13 UTC (rev 672) @@ -0,0 +1,13 @@ +identify.baseURL=www.***.***:port/top +identify.repositoryName=TreeBASE repository +identify.protocolVersion=2.0 +identify.adminEmail=you...@ya... +identify.earliestDatestamp=1995-11-04T00:00:00Z +identify.deletedRecord=transient +identify.granularity=YYYY-MM-DDThh:mm:ssZ +identify.granularityPattern=yyyy-MM-dd'T'hh:mm:ss'Z' +identify.sampleIdentifier=TreeBASE.org/study/TB2:s6705 +identify.repositoryIdentifier=TreeBASE.org +identify.identifierDelimiter=: +identify.dublinPerfix=oai_dc +identify.dryadPerfix=dryad \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-07-13 16:38:10
|
Revision: 731 http://treebase.svn.sourceforge.net/treebase/?rev=731&view=rev Author: youjun Date: 2010-07-13 16:38:00 +0000 (Tue, 13 Jul 2010) Log Message: ----------- Modified Paths: -------------- trunk/treebase-web/pom.xml trunk/treebase-web/src/main/webapp/WEB-INF/web.xml Added Paths: ----------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/UnTarTool.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/webservices/DryadImportor.java Modified: trunk/treebase-web/pom.xml =================================================================== --- trunk/treebase-web/pom.xml 2010-07-07 19:32:38 UTC (rev 730) +++ trunk/treebase-web/pom.xml 2010-07-13 16:38:00 UTC (rev 731) @@ -21,6 +21,9 @@ </resource> </resources> <finalName>treebase-web</finalName> + + + <plugins> <!-- Ant Task plugin--> @@ -80,26 +83,20 @@ <repository> <id>org.tuckey.urlrewritefilter</id> <url>http://repository.jboss.org/maven2/org/tuckey/urlrewritefilter/</url> - </repository> - + </repository> + <repository> + <id>java.net</id> + <url>http://download.java.net/maven/2</url> + </repository> + + </repositories> + - <pluginRepositories> - <pluginRepository> - <id>Maven Snapshots</id> - <url>http://snapshots.maven.codehaus.org/maven2</url> - <snapshots> - <enabled>true</enabled> - </snapshots> - <releases> - <enabled>false</enabled> - </releases> - </pluginRepository> - </pluginRepositories> - <dependencies> - - + + + <dependencies> <dependency> <groupId>org.nexml.model</groupId> @@ -341,5 +338,36 @@ <artifactId>velocity-tools-view</artifactId> <version>1.1</version> </dependency> - </dependencies> + +<dependency> +<groupId>com.sun.jersey</groupId> +<artifactId>jersey-client</artifactId> +<version>1.1.5</version> +</dependency> + +<dependency> +<groupId>com.sun.jersey</groupId> +<artifactId>jersey-server</artifactId> +<version>1.1.5</version> +</dependency> + +<dependency> +<groupId>com.sun.jersey.contribs</groupId> +<artifactId>jersey-multipart</artifactId> +<version>1.1.5</version> +</dependency> + +<dependency> +<groupId>com.sun.jersey</groupId> +<artifactId>jersey-bundle</artifactId> +<version>1.1.5</version> +</dependency> + +<dependency> +<groupId>javax.ws.rs</groupId> +<artifactId>jsr311-api</artifactId> +<version>1.0</version> +</dependency> +</dependencies> + </project> Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/UnTarTool.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/UnTarTool.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/UnTarTool.java 2010-07-13 16:38:00 UTC (rev 731) @@ -0,0 +1,69 @@ +package org.cipres.treebase.web.util; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.zip.GZIPInputStream; + +import org.apache.tools.tar.TarEntry; +import org.apache.tools.tar.TarInputStream; + +public class UnTarTool +{ + + public static void unTarGz(File file,File outDir) throws IOException{ + + TarInputStream tarIn = null; + + try{ + + tarIn = new TarInputStream(new GZIPInputStream( + new BufferedInputStream(new FileInputStream(file))), + 1024); + + TarEntry entry = null; + //tarIn.getNextEntry(); + //File outputDir = new File(outDir, "myBag"); + //outputDir.mkdirs(); + while( (entry = tarIn.getNextEntry()) != null ){ + File f = new File(outDir,entry.getName()); + if(entry.isDirectory()){ + f.mkdirs(); + }else{ + f.getParentFile().mkdirs(); + f.createNewFile(); + OutputStream out = null; + try{ + out = new FileOutputStream(f); + int length = 0; + byte[] b = new byte[1024]; + while((length = tarIn.read(b)) != -1){ + out.write(b, 0, length); + } + + }catch(IOException ex){ + throw ex; + }finally{ + if(out!=null) + out.close(); + } + } + } + }catch(IOException ex){ + throw ex; + } finally{ + try{ + if(tarIn != null){ + tarIn.close(); + } + }catch(IOException ex){ + throw ex; + } + } + + } + +} Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/webservices/DryadImportor.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/webservices/DryadImportor.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/webservices/DryadImportor.java 2010-07-13 16:38:00 UTC (rev 731) @@ -0,0 +1,104 @@ +package org.cipres.treebase.web.webservices; + + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; + +import com.sun.jersey.multipart.*; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +//import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.core.Context; + +import org.cipres.treebase.TreebaseUtil; +import org.cipres.treebase.web.util.UnTarTool; + + + +@Path("/dryadImport") + +public class DryadImportor { + + @Context + HttpServletRequest httpRequest; + + @PUT + //@POST + //@GET + + @Consumes("multipart/mixed") + +public String processMultiparts(MultiPart multiPart) { + + String ip = httpRequest.getRemoteAddr(); + if(!AllowIP.isAllowIP(ip))return "not authorized"; + + BodyPartEntity bpe = (BodyPartEntity) multiPart.getBodyParts().get(0).getEntity(); + File unzipFold; + String systemTime; + + do{ + systemTime = "" + System.currentTimeMillis(); + String uploadDir = httpRequest.getSession().getServletContext() + .getRealPath(TreebaseUtil.FILESEP + "DryadFileUpload") + + TreebaseUtil.FILESEP + systemTime; + unzipFold = new File(uploadDir); + }while(unzipFold.exists()); + + + File zipfile = new File(unzipFold,"data.tar.gz"); + + try { + unzipFold.mkdirs(); + zipfile.createNewFile(); + InputStream in = bpe.getInputStream(); + OutputStream out=new FileOutputStream(zipfile); + + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0){ + out.write(buf, 0, len); + } + in.close(); + out.close(); + UnTarTool.unTarGz(zipfile,unzipFold); + + } catch (IOException e) { + // TODO Auto-generated catch block + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + return sw.getBuffer().toString(); + } + String[] baseURL=httpRequest.getRequestURL().toString().split("handshaking"); + String importURL= baseURL[0] + "login.jsp?importKey=" + systemTime; + + return importURL; + + } + +} + +class AllowIP{ + private static final String dryad1 = "152.1.24.8"; + private static final String dryad2 = "152.3.105.16"; + private static final String yale1 = "130.132.27.141"; + private static final String yale2 = "130.132.27.212"; + + static boolean isAllowIP(String ip){ + + if (ip.compareTo(dryad1)==0) return true; + if (ip.compareTo(dryad2)==0) return true; + if (ip.compareTo(yale1)==0)return true; + if (ip.compareTo(yale2)==0)return true; + + return false; + } + +} Modified: trunk/treebase-web/src/main/webapp/WEB-INF/web.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2010-07-07 19:32:38 UTC (rev 730) +++ trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2010-07-13 16:38:00 UTC (rev 731) @@ -120,13 +120,67 @@ <!-- ========================================================== --> <filter-mapping> <filter-name>securityFilter</filter-name> - <url-pattern>/*</url-pattern> + <url-pattern>/*</url-pattern> </filter-mapping> - <filter-mapping> + + <filter-mapping> <filter-name>sitemesh</filter-name> - <url-pattern>/*</url-pattern> + <url-pattern>*.html</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> + </filter-mapping> + + <filter-mapping> + <filter-name>sitemesh</filter-name> + <url-pattern>*.jsp</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>FORWARD</dispatcher> + </filter-mapping> + + <filter-mapping> + <filter-name>sitemesh</filter-name> + <url-pattern>*.htm</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>FORWARD</dispatcher> + </filter-mapping> + + <filter-mapping> + <filter-name>sitemesh</filter-name> + <url-pattern>*.rdf</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>FORWARD</dispatcher> + </filter-mapping> + + <filter-mapping> + <filter-name>sitemesh</filter-name> + <url-pattern>/</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>FORWARD</dispatcher> + </filter-mapping> + <filter-mapping> + <filter-name>sitemesh</filter-name> + <url-pattern>/phylows/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>FORWARD</dispatcher> + </filter-mapping> + + <filter-mapping> + <filter-name>sitemesh</filter-name> + <url-pattern>/top/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>FORWARD</dispatcher> + </filter-mapping> + + <filter-mapping> + <filter-name>sitemesh</filter-name> + <url-pattern>/services/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>FORWARD</dispatcher> + </filter-mapping> + + <filter-mapping> + <filter-name>hibernateFilter</filter-name> + <url-pattern>*.html</url-pattern> </filter-mapping> <filter-mapping> <filter-name>hibernateFilter</filter-name> @@ -197,8 +251,22 @@ </servlet-class> </servlet> - + <!-- ========================================================== --> + <!-- Processed by Jersey --> + <!-- ========================================================== --> + <servlet> + <servlet-name>HandshakingServlet</servlet-name> + <servlet-class> + com.sun.jersey.spi.container.servlet.ServletContainer + </servlet-class> + <init-param> + <param-name>com.sun.jersey.config.property.packages</param-name> + <param-value>org.cipres.treebase.web.webservices</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + <!-- ========================================================== --> <!-- url pattern that will be processed by DispatcherServlet --> <!-- ========================================================== --> @@ -239,6 +307,14 @@ <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/services/*</url-pattern> + </servlet-mapping> + + <!-- ========================================================== --> + <!-- url pattern that will be processed by CXFServlet --> + <!-- ========================================================== --> + <servlet-mapping> + <servlet-name>HandshakingServlet</servlet-name> + <url-pattern>/handshaking/*</url-pattern> </servlet-mapping> <!-- ========================================================== --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hs...@us...> - 2011-11-17 21:46:00
|
Revision: 982 http://treebase.svn.sourceforge.net/treebase/?rev=982&view=rev Author: hshyket Date: 2011-11-17 21:45:53 +0000 (Thu, 17 Nov 2011) Log Message: ----------- Updating the error message for when no study is found (and also handling no Taxa found). Adding JavaMelody monitoring system Modified Paths: -------------- trunk/treebase-web/pom.xml trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml trunk/treebase-web/src/main/webapp/WEB-INF/web.xml Added Paths: ----------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/exceptions/NoStudySpecifiedError.java trunk/treebase-web/src/main/webapp/WEB-INF/pages/errors/itemNotFound.jsp Modified: trunk/treebase-web/pom.xml =================================================================== --- trunk/treebase-web/pom.xml 2011-11-16 17:08:00 UTC (rev 981) +++ trunk/treebase-web/pom.xml 2011-11-17 21:45:53 UTC (rev 982) @@ -393,6 +393,33 @@ <version>1.0</version> </dependency> +<!-- javamelody-core --> + <dependency> + <groupId>net.bull.javamelody</groupId> + <artifactId>javamelody-core</artifactId> + <version>1.32.1</version> + </dependency> + <!-- itext, option to add PDF export --> + <dependency> + <groupId>com.lowagie</groupId> + <artifactId>itext</artifactId> + <version>2.1.7</version> + <exclusions> + <exclusion> + <artifactId>bcmail-jdk14</artifactId> + <groupId>bouncycastle</groupId> + </exclusion> + <exclusion> + <artifactId>bcprov-jdk14</artifactId> + <groupId>bouncycastle</groupId> + </exclusion> + <exclusion> + <artifactId>bctsp-jdk14</artifactId> + <groupId>bouncycastle</groupId> + </exclusion> + </exclusions> + </dependency> + </dependencies> </project> Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2011-11-16 17:08:00 UTC (rev 981) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2011-11-17 21:45:53 UTC (rev 982) @@ -50,6 +50,7 @@ import org.cipres.treebase.web.util.AnalyzedDataComparator; import org.cipres.treebase.web.util.ControllerUtil; +import org.cipres.treebase.web.exceptions.NoStudySpecifiedError; import org.springframework.validation.BindException; import org.springframework.web.servlet.ModelAndView; @@ -71,7 +72,6 @@ String defaultPage = null; private static final Logger LOGGER = Logger.getLogger(SearchSummaryController.class); - class NoStudySpecifiedError extends Error { } class UnknownStudyError extends Error { } class RestrictedStudyError extends Error { } @@ -90,7 +90,7 @@ theStudy = null; { Long studyID = getIDParam(param, "id"); - if (studyID == null) { throw new NoStudySpecifiedError(); } + if (studyID == null) { throw new NoStudySpecifiedError("No study was found"); } theStudy = getStudyService().findByID(studyID); if (theStudy == null) { throw new UnknownStudyError(); } LOGGER.debug("formBackingObject found study " + theStudy); @@ -268,7 +268,17 @@ */ private Long getIDParam(Map<String, String []> params, String paramName) { String [] IDParam = params.get(paramName); - return IDParam.length == 0 ? null : Long.parseLong(IDParam[0]); + if (IDParam == null || IDParam.length == 0) { + return null; + } + else { + try { + return Long.parseLong(IDParam[0]); + } + catch(Exception e) { + return null; + } + } } @Override Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java 2011-11-16 17:08:00 UTC (rev 981) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TaxonSearchController.java 2011-11-17 21:45:53 UTC (rev 982) @@ -239,7 +239,7 @@ switch(namingAuthority) { case TREEBASE : LOGGER.debug("Going to search for TreeBASE IDs"); - if ( ! index.endsWith(".tb1") ) { + if (null != index && ! index.endsWith(".tb1") ) { TreebaseIDString idstr; try { idstr = new TreebaseIDString(identifier, Taxon.class, true); @@ -261,7 +261,7 @@ addMessage(request, "Ignoring malformed TreeBASE1 ID string '" + identifier + "', because: " + e.getMessage()); LOGGER.error("Couldn't parse legacy ID: "+e.getMessage()); } - if ( null != tb1LegacyId && index.matches(".*taxonVariant.*") ) { + if ( null != tb1LegacyId && null != index && index.matches(".*taxonVariant.*") ) { TaxonVariant tv = getTaxonHome().findVariantByTB1LegacyId(tb1LegacyId); LOGGER.debug("Found taxon variant: " + tv.getId()); if ( null != tv.getTaxon() ) { Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/exceptions/NoStudySpecifiedError.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/exceptions/NoStudySpecifiedError.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/exceptions/NoStudySpecifiedError.java 2011-11-17 21:45:53 UTC (rev 982) @@ -0,0 +1,19 @@ + +package org.cipres.treebase.web.exceptions; + +/** + * EmptySubmissionException.java + * + * Created on Jun 7, 2006 + * @author lcchan + * + */ +public class NoStudySpecifiedError extends RuntimeException { + + /** + * Constructor. + */ + public NoStudySpecifiedError(String s) { + super(s); + } +} Added: trunk/treebase-web/src/main/webapp/WEB-INF/pages/errors/itemNotFound.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/errors/itemNotFound.jsp (rev 0) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/errors/itemNotFound.jsp 2011-11-17 21:45:53 UTC (rev 982) @@ -0,0 +1,3 @@ +<%@ include file="/common/taglibs.jsp" %> + +${requestScope.exception.message} \ No newline at end of file Modified: trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2011-11-16 17:08:00 UTC (rev 981) +++ trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2011-11-17 21:45:53 UTC (rev 982) @@ -1112,7 +1112,8 @@ <props> <prop key="org.springframework.dao.DataAccessException">/errors/dataAccessFailure</prop> <prop key="org.springframework.transaction.TransactionException">/errors/dataAccessFailure</prop> - <prop key="org.cipres.treebase.web.exceptions.EmptyStudyException">/errors/studyAccessFailure</prop> + <prop key="org.cipres.treebase.web.exceptions.EmptyStudyException">/errors/studyAccessFailure</prop> + <prop key="org.cipres.treebase.web.exceptions.NoStudySpecifiedError">/errors/itemNotFound</prop> </props> </property> </bean> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/web.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2011-11-16 17:08:00 UTC (rev 981) +++ trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2011-11-17 21:45:53 UTC (rev 982) @@ -111,7 +111,17 @@ <filter> <filter-name>UrlRewriteFilter</filter-name> <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class> - </filter> + </filter> + + <filter> + <filter-name>monitoring</filter-name> + <filter-class>net.bull.javamelody.MonitoringFilter</filter-class> + <init-param> + <param-name>system-actions-enabled</param-name> + <param-value>true</param-value> + </init-param> + </filter> + @@ -200,6 +210,12 @@ <filter-name>UrlRewriteFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> + + <filter-mapping> + <filter-name>monitoring</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + @@ -215,6 +231,9 @@ <listener> <listener-class>net.sf.navigator.menu.MenuContextListener</listener-class> </listener> + <listener> + <listener-class>net.bull.javamelody.SessionListener</listener-class> + </listener> <!-- listener> <listener-class>org.cipres.treebase.web.listeners.EventListener</listener-class> </listener --> @@ -356,6 +375,10 @@ <exception-type>java.lang.Exception</exception-type> <location>/WEB-INF/pages/errors/uncaughtException.jsp</location> </error-page> + <error-page> + <exception-type>java.lang.Exception</exception-type> + <location>/WEB-INF/pages/errors/uncaughtException.jsp</location> + </error-page> <!-- Internal Server Error --> <error-page> <error-code>500</error-code> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hs...@us...> - 2011-11-22 20:38:32
|
Revision: 986 http://treebase.svn.sourceforge.net/treebase/?rev=986&view=rev Author: hshyket Date: 2011-11-22 20:38:26 +0000 (Tue, 22 Nov 2011) Log Message: ----------- Adding OSCache with expiration time so that Apache can cache study downloads Modified Paths: -------------- trunk/treebase-web/pom.xml trunk/treebase-web/src/main/webapp/WEB-INF/web.xml Modified: trunk/treebase-web/pom.xml =================================================================== --- trunk/treebase-web/pom.xml 2011-11-18 22:22:51 UTC (rev 985) +++ trunk/treebase-web/pom.xml 2011-11-22 20:38:26 UTC (rev 986) @@ -419,6 +419,12 @@ </exclusion> </exclusions> </dependency> + + <dependency> + <groupId>opensymphony</groupId> + <artifactId>oscache</artifactId> + <version>2.4.1</version> + </dependency> </dependencies> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/web.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2011-11-18 22:22:51 UTC (rev 985) +++ trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2011-11-22 20:38:26 UTC (rev 986) @@ -58,8 +58,26 @@ <listener> <listener-class>net.bull.javamelody.SessionListener</listener-class> </listener> - + + <filter> + <filter-name>CacheFilter</filter-name> + <filter-class>com.opensymphony.oscache.web.filter.CacheFilter</filter-class> + <init-param> + <param-name>expires</param-name> + <param-value>time</param-value> + </init-param> + <init-param> + <param-name>time</param-name> + <param-value>2592000</param-value> <!-- one month --> + </init-param> + </filter> + <filter-mapping> + <filter-name>CacheFilter</filter-name> + <url-pattern>/search/downloadAStudy.html*</url-pattern> + </filter-mapping> + + <!-- =================================================================== --> <!-- Declarations of JNDI Resources expected from the Tomcat container --> <!-- =================================================================== --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hs...@us...> - 2012-05-25 15:25:55
|
Revision: 1093 http://treebase.svn.sourceforge.net/treebase/?rev=1093&view=rev Author: hshyket Date: 2012-05-25 15:25:44 +0000 (Fri, 25 May 2012) Log Message: ----------- Removing Caching Modified Paths: -------------- trunk/treebase-web/pom.xml trunk/treebase-web/src/main/webapp/WEB-INF/web.xml Modified: trunk/treebase-web/pom.xml =================================================================== --- trunk/treebase-web/pom.xml 2012-04-03 14:24:26 UTC (rev 1092) +++ trunk/treebase-web/pom.xml 2012-05-25 15:25:44 UTC (rev 1093) @@ -419,13 +419,6 @@ </exclusion> </exclusions> </dependency> - - <dependency> - <groupId>opensymphony</groupId> - <artifactId>oscache</artifactId> - <version>2.4.1</version> - </dependency> - </dependencies> </project> Modified: trunk/treebase-web/src/main/webapp/WEB-INF/web.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2012-04-03 14:24:26 UTC (rev 1092) +++ trunk/treebase-web/src/main/webapp/WEB-INF/web.xml 2012-05-25 15:25:44 UTC (rev 1093) @@ -58,47 +58,7 @@ <listener> <listener-class>net.bull.javamelody.SessionListener</listener-class> </listener> - - <filter> - <filter-name>CacheFilter</filter-name> - <filter-class>com.opensymphony.oscache.web.filter.CacheFilter</filter-class> - <init-param> - <param-name>expires</param-name> - <param-value>time</param-value> - </init-param> - <init-param> - <param-name>time</param-name> - <param-value>2592000</param-value> <!-- one month --> - </init-param> - </filter> - <filter-mapping> - <filter-name>CacheFilter</filter-name> - <url-pattern>/search/downloadAStudy.html</url-pattern> - </filter-mapping> - - <filter-mapping> - <filter-name>CacheFilter</filter-name> - <url-pattern>/search/study/anyObjectAsRDF.rdf</url-pattern> - </filter-mapping> - - <filter-mapping> - <filter-name>CacheFilter</filter-name> - <url-pattern>/search/downloadANexusFile.html</url-pattern> - </filter-mapping> - - <filter-mapping> - <filter-name>CacheFilter</filter-name> - <url-pattern>/search/downloadAMatrix.html</url-pattern> - </filter-mapping> - - <filter-mapping> - <filter-name>CacheFilter</filter-name> - <url-pattern>/search/downloadATree.html</url-pattern> - </filter-mapping> - - - <!-- =================================================================== --> <!-- Declarations of JNDI Resources expected from the Tomcat container --> <!-- =================================================================== --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |