diff --git a/Dockerfile.jdk8 b/Dockerfile.jdk8 index b5c108d129..c205fc846e 100644 --- a/Dockerfile.jdk8 +++ b/Dockerfile.jdk8 @@ -1,11 +1,11 @@ # This image will be published as dspace/dspace # See https://dspace-labs.github.io/DSpace-Docker-Images/ for usage details -# +# # This version is JDK8 compatible # - tomcat:8-jre8 # - ANT 1.10.5 # - maven:3-jdk-8 -# - note: +# - note: # - default tag for branch: dspace/dspace: dspace/dspace:dspace-7_x-jdk8 # Step 1 - Run Maven Build @@ -55,6 +55,6 @@ EXPOSE 8080 8009 ENV JAVA_OPTS=-Xmx2000m RUN mv /usr/local/tomcat/webapps/ROOT /usr/local/tomcat/webapps/ROOT.bk && \ - ln -s $DSPACE_INSTALL/webapps/spring-rest /usr/local/tomcat/webapps/ROOT && \ - ln -s $DSPACE_INSTALL/webapps/spring-rest /usr/local/tomcat/webapps/spring-rest && \ + ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/ROOT && \ + ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/server && \ ln -s $DSPACE_INSTALL/webapps/rest /usr/local/tomcat/webapps/rest diff --git a/Dockerfile.jdk8-test b/Dockerfile.jdk8-test index 54ef4d105f..f528c5fb36 100644 --- a/Dockerfile.jdk8-test +++ b/Dockerfile.jdk8-test @@ -1,11 +1,11 @@ # This image will be published as dspace/dspace # See https://dspace-labs.github.io/DSpace-Docker-Images/ for usage details -# +# # This version is JDK8 compatible # - tomcat:8-jre8 # - ANT 1.10.5 # - maven:3-jdk-8 -# - note: +# - note: # - default tag for branch: dspace/dspace: dspace/dspace:dspace-7_x-jdk8-test # Step 1 - Run Maven Build @@ -55,8 +55,8 @@ EXPOSE 8080 8009 ENV JAVA_OPTS=-Xmx2000m RUN mv /usr/local/tomcat/webapps/ROOT /usr/local/tomcat/webapps/ROOT.bk && \ - ln -s $DSPACE_INSTALL/webapps/spring-rest /usr/local/tomcat/webapps/ROOT && \ - ln -s $DSPACE_INSTALL/webapps/spring-rest /usr/local/tomcat/webapps/spring-rest && \ + ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/ROOT && \ + ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/server && \ ln -s $DSPACE_INSTALL/webapps/rest /usr/local/tomcat/webapps/rest COPY dspace/src/main/docker/test/rest_web.xml $DSPACE_INSTALL/webapps/rest/WEB-INF/web.xml diff --git a/README.md b/README.md index aac6b7e6cc..13b68d3f18 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ For more information, visit http://www.dspace.org/ *** :warning: **Work on DSpace 7 has begun on our `master` branch.** This means that there is temporarily NO user interface on this `master` branch. DSpace 7 will feature a new, unified [Angular](https://angular.io/) user interface, along with an enhanced, rebuilt REST API. The latest status of this work can be found on the [DSpace 7 UI Working Group](https://wiki.duraspace.org/display/DSPACE/DSpace+7+UI+Working+Group) page. Additionally, the codebases can be found in the following places: - * DSpace 7 REST API work is occurring on the [`master` branch](https://github.com/DSpace/DSpace/tree/master/dspace-spring-rest) of this repository. + * DSpace 7 REST API work is occurring on the [`master` branch](https://github.com/DSpace/DSpace/tree/master/dspace-server-webapp) of this repository. * The REST Contract is being documented at https://github.com/DSpace/Rest7Contract * DSpace 7 Angular UI work is occurring at https://github.com/DSpace/dspace-angular @@ -126,7 +126,7 @@ run automatically by [Travis CI](https://travis-ci.org/DSpace/DSpace/) for all P mvn clean install # Then, move into a module subdirectory, and run the test command - cd [dspace-src]/dspace-spring-rest + cd [dspace-src]/dspace-server-webapp # Choose your test command from the lists above ``` diff --git a/dspace-api/pom.xml b/dspace-api/pom.xml index 0f6a4ebf64..8cde7f749e 100644 --- a/dspace-api/pom.xml +++ b/dspace-api/pom.xml @@ -334,6 +334,16 @@ org.dspace handle + + org.eclipse.jetty.aggregate + jetty-all + + + javax.servlet + org.eclipse.jetty.orbit + + + org.dspace jargon @@ -749,6 +759,13 @@ 20180130 + + org.apache.velocity + velocity-engine-core + 2.0 + jar + + org.xmlunit xmlunit-matchers diff --git a/dspace-api/src/main/java/org/dspace/checker/DailyReportEmailer.java b/dspace-api/src/main/java/org/dspace/checker/DailyReportEmailer.java index 56dabb0460..350facaad5 100644 --- a/dspace-api/src/main/java/org/dspace/checker/DailyReportEmailer.java +++ b/dspace-api/src/main/java/org/dspace/checker/DailyReportEmailer.java @@ -67,7 +67,7 @@ public class DailyReportEmailer { email.setSubject( "Checksum checker Report - " + numberOfBitstreams + " Bitstreams found with POSSIBLE issues on " + hostname); - email.setContent("report is attached ..."); + email.setContent("Checker Report", "report is attached ..."); email.addAttachment(attachment, "checksum_checker_report.txt"); email.addRecipient(ConfigurationManager.getProperty("mail.admin")); email.send(); diff --git a/dspace-api/src/main/java/org/dspace/content/BitstreamFormat.java b/dspace-api/src/main/java/org/dspace/content/BitstreamFormat.java index c1e2a7ec8b..4587e75b44 100644 --- a/dspace-api/src/main/java/org/dspace/content/BitstreamFormat.java +++ b/dspace-api/src/main/java/org/dspace/content/BitstreamFormat.java @@ -71,7 +71,7 @@ public class BitstreamFormat implements Serializable, ReloadableEntity @Column(name = "internal") private boolean internal = false; - @ElementCollection(fetch = FetchType.LAZY) + @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "fileextension", joinColumns = @JoinColumn(name = "bitstream_format_id")) @CollectionId( columns = @Column(name = "file_extension_id"), diff --git a/dspace-api/src/main/java/org/dspace/content/BitstreamFormatServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/BitstreamFormatServiceImpl.java index 7239424d91..21d1fa4ba4 100644 --- a/dspace-api/src/main/java/org/dspace/content/BitstreamFormatServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/BitstreamFormatServiceImpl.java @@ -270,4 +270,4 @@ public class BitstreamFormatServiceImpl implements BitstreamFormatService { } return null; } -} +} \ No newline at end of file diff --git a/dspace-api/src/main/java/org/dspace/content/service/BitstreamFormatService.java b/dspace-api/src/main/java/org/dspace/content/service/BitstreamFormatService.java index 19ef5c7d07..96f9d78cb8 100644 --- a/dspace-api/src/main/java/org/dspace/content/service/BitstreamFormatService.java +++ b/dspace-api/src/main/java/org/dspace/content/service/BitstreamFormatService.java @@ -128,4 +128,4 @@ public interface BitstreamFormatService extends DSpaceCRUDServicedspace-dir/config/emails/ (which also includes the subject.) * arg0 and arg1 are arguments to fill out the * message with. - *

- *

- * Emails are formatted using java.text.MessageFormat. - * Additionally, comment lines (starting with '#') are stripped, and if a line - * starts with "Subject:" the text on the right of the colon is used for the - * subject line. For example: + *

+ * Emails are formatted using Apache Velocity. Headers such as Subject may be + * supplied by the template, by defining them using #set(). Example: *

* *
  *
- *     # This is a comment line which is stripped
- *     #
- *     # Parameters:   {0}  is a person's name
- *     #               {1}  is the name of a submission
- *     #
- *     Subject: Example e-mail
+ *     ## This is a comment line which is stripped
+ *     ##
+ *     ## Parameters:   {0}  is a person's name
+ *     ##               {1}  is the name of a submission
+ *     ##
+ *     #set($subject = 'Example e-mail')
  *
- *     Dear {0},
+ *     Dear ${params[0]},
  *
- *     Thank you for sending us your submission "{1}".
+ *     Thank you for sending us your submission "${params[1]}".
  *
  * 
* @@ -97,11 +104,6 @@ import org.dspace.services.factory.DSpaceServicesFactory; * * * - *

- * Note that parameters like {0} cannot be placed in the subject - * of the e-mail; they won't get filled out. - *

- * * @author Robert Tansley * @author Jim Downing - added attachment handling code * @author Adan Roman Ruiz at arvo.es - added inputstream attachment handling code @@ -111,6 +113,7 @@ public class Email { * The content of the message */ private String content; + private String contentName; /** * The subject of the message @@ -120,37 +123,56 @@ public class Email { /** * The arguments to fill out */ - private List arguments; + private final List arguments; /** * The recipients */ - private List recipients; + private final List recipients; /** * Reply to field, if any */ private String replyTo; - private List attachments; - private List moreAttachments; + private final List attachments; + private final List moreAttachments; /** * The character set this message will be sent in */ private String charset; - private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(Email.class); + private static final Logger LOG = LogManager.getLogger(); + + /** Velocity template settings. */ + private static final String RESOURCE_REPOSITORY_NAME = "Email"; + private static final Properties VELOCITY_PROPERTIES = new Properties(); + static { + VELOCITY_PROPERTIES.put(Velocity.RESOURCE_LOADER, "string"); + VELOCITY_PROPERTIES.put("string.resource.loader.description", + "Velocity StringResource loader"); + VELOCITY_PROPERTIES.put("string.resource.loader.class", + StringResourceLoader.class.getName()); + VELOCITY_PROPERTIES.put("string.resource.loader.repository.name", + RESOURCE_REPOSITORY_NAME); + VELOCITY_PROPERTIES.put("string.resource.loader.repository.static", + "false"); + } + + /** Velocity template for a message body */ + private Template template; /** * Create a new email message. */ public Email() { - arguments = new ArrayList(50); - recipients = new ArrayList(50); - attachments = new ArrayList(10); - moreAttachments = new ArrayList(10); + arguments = new ArrayList<>(50); + recipients = new ArrayList<>(50); + attachments = new ArrayList<>(10); + moreAttachments = new ArrayList<>(10); subject = ""; + template = null; content = ""; replyTo = null; charset = null; @@ -166,15 +188,17 @@ public class Email { } /** - * Set the content of the message. Setting this "resets" the message - * formatting -addArgument will start. Comments and any + * Set the content of the message. Setting this also "resets" the message + * formatting - addArgument will start over. Comments and any * "Subject:" line must be stripped. * + * @param name a name for this message body * @param cnt the content of the message */ - public void setContent(String cnt) { + public void setContent(String name, String cnt) { content = cnt; - arguments = new ArrayList(); + contentName = name; + arguments.clear(); } /** @@ -213,14 +237,14 @@ public class Email { public void addAttachment(InputStream is, String name, String mimetype) { if (null == mimetype) { - log.error("Null MIME type replaced with '" + DEFAULT_ATTACHMENT_TYPE + LOG.error("Null MIME type replaced with '" + DEFAULT_ATTACHMENT_TYPE + "' for attachment '" + name + "'"); mimetype = DEFAULT_ATTACHMENT_TYPE; } else { try { new ContentType(mimetype); // Just try to parse it. } catch (ParseException ex) { - log.error("Bad MIME type '" + mimetype + LOG.error("Bad MIME type '" + mimetype + "' replaced with '" + DEFAULT_ATTACHMENT_TYPE + "' for attachment '" + name + "'", ex); mimetype = DEFAULT_ATTACHMENT_TYPE; @@ -235,26 +259,35 @@ public class Email { } /** - * "Reset" the message. Clears the arguments and recipients, but leaves the - * subject and content intact. + * "Reset" the message. Clears the arguments, attachments and recipients, + * but leaves the subject and content intact. */ public void reset() { - arguments = new ArrayList(50); - recipients = new ArrayList(50); - attachments = new ArrayList(10); - moreAttachments = new ArrayList(10); + arguments.clear(); + recipients.clear(); + attachments.clear(); + moreAttachments.clear(); replyTo = null; charset = null; } /** - * Sends the email. + * Sends the email. If the template defines a Velocity context property + * named among the values of DSpace configuration property + * {@code mail.message.headers} then that name and its value will be added + * to the message's headers. + * + *

"subject" is treated specially: if {@link setSubject()} has not been called, + * the value of any "subject" property will be used as if setSubject had + * been called with that value. Thus a template may define its subject, but + * the caller may override it. * * @throws MessagingException if there was a problem sending the mail. * @throws IOException if IO error */ public void send() throws MessagingException, IOException { - ConfigurationService config = DSpaceServicesFactory.getInstance().getConfigurationService(); + ConfigurationService config + = DSpaceServicesFactory.getInstance().getConfigurationService(); // Get the mail configuration properties String from = config.getProperty("mail.from.address"); @@ -279,20 +312,55 @@ public class Email { i.next())); } - // Format the mail message - Object[] args = arguments.toArray(); - String fullMessage = MessageFormat.format(content, args); - Date date = new Date(); + // Format the mail message body + VelocityEngine templateEngine = new VelocityEngine(); + templateEngine.init(VELOCITY_PROPERTIES); + VelocityContext vctx = new VelocityContext(); + vctx.put("config", new UnmodifiableConfigurationService(config)); + vctx.put("params", Collections.unmodifiableList(arguments)); + + if (null == template) { + if (StringUtils.isBlank(content)) { + // No template and no content -- PANIC!!! + throw new MessagingException("Email has no body"); + } + // No template, so use a String of content. + StringResourceRepository repo = (StringResourceRepository) + templateEngine.getApplicationAttribute(RESOURCE_REPOSITORY_NAME); + repo.putStringResource(contentName, content); + // Turn content into a template. + template = templateEngine.getTemplate(contentName); + } + + StringWriter writer = new StringWriter(); + template.merge(vctx, writer); + String fullMessage = writer.toString(); + + // Set some message header fields + Date date = new Date(); message.setSentDate(date); message.setFrom(new InternetAddress(from)); - // Set the subject of the email (may contain parameters) - String fullSubject = MessageFormat.format(subject, args); + // Get headers defined by the template. + for (String headerName : config.getArrayProperty("mail.message.headers")) { + String headerValue = (String) vctx.get(headerName); + if ("subject".equalsIgnoreCase(headerName)) { + if (null != subject) { + subject = headerValue; + } + } else if ("charset".equalsIgnoreCase(headerName)) { + charset = headerValue; + } else { + message.setHeader(headerName, headerValue); + } + } + + // Set the subject of the email. if (charset != null) { - message.setSubject(fullSubject, charset); + message.setSubject(subject, charset); } else { - message.setSubject(fullSubject); + message.setSubject(subject); } // Add attachments @@ -305,39 +373,33 @@ public class Email { } } else { Multipart multipart = new MimeMultipart(); + // create the first part of the email BodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setText(fullMessage); multipart.addBodyPart(messageBodyPart); - if (!attachments.isEmpty()) { - for (Iterator iter = attachments.iterator(); iter.hasNext(); ) { - FileAttachment f = iter.next(); - // add the file - messageBodyPart = new MimeBodyPart(); - messageBodyPart.setDataHandler(new DataHandler( - new FileDataSource(f.file))); - messageBodyPart.setFileName(f.name); - multipart.addBodyPart(messageBodyPart); - } - message.setContent(multipart); + + // Add file attachments + for (FileAttachment attachment : attachments) { + // add the file + messageBodyPart = new MimeBodyPart(); + messageBodyPart.setDataHandler(new DataHandler( + new FileDataSource(attachment.file))); + messageBodyPart.setFileName(attachment.name); + multipart.addBodyPart(messageBodyPart); } - if (!moreAttachments.isEmpty()) { - for (Iterator iter = moreAttachments.iterator(); iter.hasNext(); ) { - InputStreamAttachment isa = iter.next(); - // add the stream - messageBodyPart = new MimeBodyPart(); - messageBodyPart.setDataHandler( - new DataHandler(new InputStreamDataSource( - isa.name, - isa.mimetype, - isa.is) - ) - ); - messageBodyPart.setFileName(isa.name); - multipart.addBodyPart(messageBodyPart); - } - message.setContent(multipart); + + // Add stream attachments + for (InputStreamAttachment attachment : moreAttachments) { + // add the stream + messageBodyPart = new MimeBodyPart(); + messageBodyPart.setDataHandler(new DataHandler( + new InputStreamDataSource(attachment.name,attachment.mimetype,attachment.is))); + messageBodyPart.setFileName(attachment.name); + multipart.addBodyPart(messageBodyPart); } + + message.setContent(multipart); } if (replyTo != null) { @@ -347,7 +409,7 @@ public class Email { } if (disabled) { - StringBuffer text = new StringBuffer( + StringBuilder text = new StringBuilder( "Message not sent due to mail.server.disabled:\n"); Enumeration headers = message.getAllHeaderLines(); @@ -365,19 +427,21 @@ public class Email { text.append('\n').append(fullMessage); - log.info(text); + LOG.info(text.toString()); } else { Transport.send(message); } } /** - * Get the template for an email message. The message is suitable for - * inserting values using java.text.MessageFormat. + * Get the VTL template for an email message. The message is suitable + * for inserting values using Apache Velocity. + * + * @param emailFile + * full name for the email template, for example "/dspace/config/emails/register". + * + * @return the email object, configured with subject and body. * - * @param emailFile full name for the email template, for example "/dspace/config/emails/register". - * @return the email object, with the content and subject filled out from - * the template * @throws IOException if IO error * if the template couldn't be found, or there was some other * error reading the template @@ -385,55 +449,25 @@ public class Email { public static Email getEmail(String emailFile) throws IOException { String charset = null; - String subject = ""; StringBuilder contentBuffer = new StringBuilder(); - InputStream is = null; - InputStreamReader ir = null; - BufferedReader reader = null; - try { - is = new FileInputStream(emailFile); - ir = new InputStreamReader(is, "UTF-8"); - reader = new BufferedReader(ir); + try ( + InputStream is = new FileInputStream(emailFile); + InputStreamReader ir = new InputStreamReader(is, "UTF-8"); + BufferedReader reader = new BufferedReader(ir); + ) { boolean more = true; while (more) { String line = reader.readLine(); if (line == null) { more = false; - } else if (line.toLowerCase().startsWith("subject:")) { - subject = line.substring(8).trim(); - } else if (line.toLowerCase().startsWith("charset:")) { - charset = line.substring(8).trim(); - } else if (!line.startsWith("#")) { + } else { contentBuffer.append(line); contentBuffer.append("\n"); } } - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException ioe) { - // ignore - } - } - if (ir != null) { - try { - ir.close(); - } catch (IOException ioe) { - // ignore - } - } - if (is != null) { - try { - is.close(); - } catch (IOException ioe) { - // ignore - } - } } Email email = new Email(); - email.setSubject(subject); - email.setContent(contentBuffer.toString()); + email.setContent(emailFile, contentBuffer.toString()); if (charset != null) { email.setCharset(charset); } @@ -452,24 +486,36 @@ public class Email { /** * Test method to send an email to check email server settings * - * @param args the command line arguments given + * @param args command line arguments. The first is the path to an email + * template file; the rest are the positional arguments for the + * template. If there are no arguments, a short, plain test + * message is sent. */ public static void main(String[] args) { - ConfigurationService config = DSpaceServicesFactory.getInstance().getConfigurationService(); + ConfigurationService config + = DSpaceServicesFactory.getInstance().getConfigurationService(); String to = config.getProperty("mail.admin"); String subject = "DSpace test email"; String server = config.getProperty("mail.server"); String url = config.getProperty("dspace.url"); - Email e = new Email(); - e.setSubject(subject); - e.addRecipient(to); - e.content = "This is a test email sent from DSpace: " + url; - System.out.println("\nAbout to send test email:"); - System.out.println(" - To: " + to); - System.out.println(" - Subject: " + subject); - System.out.println(" - Server: " + server); - boolean disabled = config.getBooleanProperty("mail.server.disabled", false); + Email message; try { + if (args.length <= 0) { + message = new Email(); + message.setContent("testing", "This is a test email sent from DSpace: " + url); + } else { + message = Email.getEmail(args[0]); + for (int i = 1; i < args.length; i++) { + message.addArgument(args[i]); + } + } + message.setSubject(subject); + message.addRecipient(to); + System.out.println("\nAbout to send test email:"); + System.out.println(" - To: " + to); + System.out.println(" - Subject: " + subject); + System.out.println(" - Server: " + server); + boolean disabled = config.getBooleanProperty("mail.server.disabled", false); if (disabled) { System.err.println("\nError sending email:"); System.err.println(" - Error: cannot test email because mail.server.disabled is set to true"); @@ -478,16 +524,10 @@ public class Email { System.exit(1); return; } - e.send(); - } catch (MessagingException me) { + message.send(); + } catch (MessagingException | IOException ex) { System.err.println("\nError sending email:"); - System.err.println(" - Error: " + me); - System.err.println("\nPlease see the DSpace documentation for assistance.\n"); - System.err.println("\n"); - System.exit(1); - } catch (IOException e1) { - System.err.println("\nError sending email:"); - System.err.println(" - Error: " + e1); + System.err.format(" - Error: %s%n", ex); System.err.println("\nPlease see the DSpace documentation for assistance.\n"); System.err.println("\n"); System.exit(1); @@ -532,9 +572,9 @@ public class Email { * @author arnaldo */ public class InputStreamDataSource implements DataSource { - private String name; - private String contentType; - private ByteArrayOutputStream baos; + private final String name; + private final String contentType; + private final ByteArrayOutputStream baos; InputStreamDataSource(String name, String contentType, InputStream inputStream) throws IOException { this.name = name; @@ -568,4 +608,30 @@ public class Email { } } + /** + * Wrap ConfigurationService to prevent templates from modifying + * the configuration. + */ + public class UnmodifiableConfigurationService { + private final ConfigurationService configurationService; + + /** + * Swallow an instance of ConfigurationService. + * + * @param cs the real instance, to be wrapped. + */ + public UnmodifiableConfigurationService(ConfigurationService cs) { + configurationService = cs; + } + + /** + * Look up a key in the actual ConfigurationService. + * + * @param key to be looked up in the DSpace configuration. + * @return whatever value ConfigurationService associates with {@code key}. + */ + public String get(String key) { + return configurationService.getProperty(key); + } + } } diff --git a/dspace-api/src/main/java/org/dspace/handle/HandlePlugin.java b/dspace-api/src/main/java/org/dspace/handle/HandlePlugin.java index 9e8d04faf2..feff8fbda7 100644 --- a/dspace-api/src/main/java/org/dspace/handle/HandlePlugin.java +++ b/dspace-api/src/main/java/org/dspace/handle/HandlePlugin.java @@ -14,13 +14,14 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import net.cnri.util.StreamTable; import net.handle.hdllib.Encoder; import net.handle.hdllib.HandleException; import net.handle.hdllib.HandleStorage; import net.handle.hdllib.HandleValue; import net.handle.hdllib.ScanCallback; import net.handle.hdllib.Util; -import net.handle.util.StreamTable; + import org.apache.logging.log4j.Logger; import org.dspace.core.Context; import org.dspace.handle.factory.HandleServiceFactory; diff --git a/dspace-rest/pom.xml b/dspace-rest/pom.xml index 4e5f898032..3c06a15027 100644 --- a/dspace-rest/pom.xml +++ b/dspace-rest/pom.xml @@ -4,8 +4,9 @@ dspace-rest war 7.0-SNAPSHOT - DSpace REST :: API and Implementation - DSpace RESTful Web Services API + DSpace (Deprecated) REST Webapp + DSpace RESTful Web Services API. NOTE: this REST API is DEPRECATED. + Please consider using the REST API in the dspace-server-webapp instead! http://demo.dspace.org diff --git a/dspace-spring-rest/README.md b/dspace-server-webapp/README.md similarity index 87% rename from dspace-spring-rest/README.md rename to dspace-server-webapp/README.md index 2def91d522..e71039308a 100644 --- a/dspace-spring-rest/README.md +++ b/dspace-server-webapp/README.md @@ -1,5 +1,5 @@ -# DSpace7 REST Webapp -> This is the new REST webapp for DSpace 7 build with Spring MVC + HATEOAS with a focus on the [JSON HAL format](http://stateless.co/hal_specification.html) ([formal specification](https://tools.ietf.org/html/draft-kelly-json-hal-08)) +# DSpace Server Webapp +> This is the new server webapp for DSpace 7 built with Spring Boot, MVC + HATEOAS with a focus on the [JSON HAL format](http://stateless.co/hal_specification.html) ([formal specification](https://tools.ietf.org/html/draft-kelly-json-hal-08)) This webapp uses the following technologies: - [Spring Boot](https://projects.spring.io/spring-boot/) @@ -15,8 +15,8 @@ Check the infomation available on the DSpace Official Wiki page for the [DSpace [DSpace 7 REST: Coding DSpace Objects](https://wiki.duraspace.org/display/DSPACE/DSpace+7+REST%3A+Coding+DSpace+Objects) ## How to run -The only tested way right now is to run this webapp inside your IDE (Eclipse). Just create a new Tomcat 8 server and deploy the dspace-spring-rest maven module to it. -> The *dspace.dir* is configured in the *dspace-spring-rest/src/main/resources/application.properties* file +The only tested way right now is to run this webapp inside your IDE (Eclipse). Just create a new Tomcat 8 server and deploy the dspace-server-webapp maven module to it. +> The *dspace.dir* is configured in the *dspace-server-webapp/src/main/resources/application.properties* file [currently](src/main/resources/application.properties#L25) > dspace.dir = d:/install/dspace7 diff --git a/dspace-spring-rest/pom.xml b/dspace-server-webapp/pom.xml similarity index 99% rename from dspace-spring-rest/pom.xml rename to dspace-server-webapp/pom.xml index 6b6fbb7911..0c872184ff 100644 --- a/dspace-spring-rest/pom.xml +++ b/dspace-server-webapp/pom.xml @@ -1,11 +1,11 @@ 4.0.0 org.dspace - dspace-spring-rest + dspace-server-webapp war - DSpace Spring Rest (Boot MVC + HATEOAS) + DSpace Server Webapp - DSpace new Rest API + DSpace Server Webapp (Spring Boot) - - dspace-rdf - - - rdf/pom.xml - - - - rdf - - dspace-rest @@ -62,47 +51,14 @@ - dspace-sword + dspace-server-webapp` - sword/pom.xml + server/pom.xml - sword - - - - dspace-swordv2 - - - swordv2/pom.xml - - - - swordv2 - - - - dspace-oai - - - oai/pom.xml - - - - oai - - - - dspace-spring-rest - - - spring-rest/pom.xml - - - - spring-rest + server diff --git a/dspace/modules/rest/pom.xml b/dspace/modules/rest/pom.xml index 4b9c4a2a24..e6962b5da3 100644 --- a/dspace/modules/rest/pom.xml +++ b/dspace/modules/rest/pom.xml @@ -3,10 +3,11 @@ org.dspace.modules rest war - DSpace REST :: Local Customizations + DSpace (Deprecated) REST Webapp :: Local Customizations This project allows you to overlay your own local REST customizations - on top of the default REST API provided with DSpace. + on top of the deprecated REST API provided with DSpace. NOTE: This REST API is DEPRECATED. Please consider + using the REST API in dspace-server-webapp instead. diff --git a/dspace/modules/spring-rest/pom.xml b/dspace/modules/server/pom.xml similarity index 94% rename from dspace/modules/spring-rest/pom.xml rename to dspace/modules/server/pom.xml index b8d834a3f8..710867affd 100644 --- a/dspace/modules/spring-rest/pom.xml +++ b/dspace/modules/server/pom.xml @@ -1,13 +1,13 @@ 4.0.0 org.dspace.modules - spring-rest + server war - DSpace Spring Rest:: Local Customizations - Overlay REST customizations. -This is probably a temporary solution to the build problems. We like to investigate about -the possibility to remove the overlays enable a more flexible extension mechanism. -The use of web-fragment and spring mvc technology allow us to add request handlers + DSpace Server Webapp:: Local Customizations + Overlay customizations. +This is probably a temporary solution to the build problems. We like to investigate about +the possibility to remove the overlays enable a more flexible extension mechanism. +The use of web-fragment and spring mvc technology allow us to add request handlers just adding new jar in the classloader @@ -101,7 +101,7 @@ just adding new jar in the classloader org.dspace - dspace-spring-rest + dspace-server-webapp war diff --git a/dspace/modules/spring-rest/src/main/webapp/.gitignore b/dspace/modules/server/src/main/webapp/.gitignore similarity index 100% rename from dspace/modules/spring-rest/src/main/webapp/.gitignore rename to dspace/modules/server/src/main/webapp/.gitignore diff --git a/dspace/pom.xml b/dspace/pom.xml index bf46f313bf..c03dab19db 100644 --- a/dspace/pom.xml +++ b/dspace/pom.xml @@ -218,7 +218,7 @@ org.dspace - dspace-spring-rest + dspace-server-webapp war compile @@ -267,7 +267,7 @@ ${project.parent.basedir}/dspace-rdf/src/main/java ${project.parent.basedir}/dspace-rest/src/main/java ${project.parent.basedir}/dspace-services/src/main/java - ${project.parent.basedir}/dspace-spring-rest/src/main/java + ${project.parent.basedir}/dspace-server-webapp/src/main/java ${project.parent.basedir}/dspace-sword/src/main/java ${project.parent.basedir}/dspace-swordv2/src/main/java diff --git a/pom.xml b/pom.xml index 86d53c29f0..b8a8115aa6 100644 --- a/pom.xml +++ b/pom.xml @@ -822,14 +822,14 @@ - dspace-spring-rest + dspace-server-webapp - dspace-spring-rest/pom.xml + dspace-server-webapp/pom.xml - dspace-spring-rest + dspace-server-webapp @@ -854,7 +854,7 @@ dspace-services dspace-sword dspace-swordv2 - dspace-spring-rest + dspace-server-webapp @@ -980,7 +980,7 @@ org.dspace - dspace-spring-rest + dspace-server-webapp 7.0-SNAPSHOT war @@ -1104,7 +1104,18 @@ org.dspace handle - 6.2 + 9.1.0.v20190416 + + + org.eclipse.jetty.aggregate + jetty-all + 8.1.22.v20160922 + + + javax.servlet + org.eclipse.jetty.orbit + + org.dspace