2

I need to develop a website with the following requirements:

  • Free (gratis)
  • The ability to perform calls to Java code (stored in a Java library I've written) when serving a page, so that the information returned by said Java call can be used to customize the page that is being served
  • Support for file downloads and the ability to accept file uploads
  • Support for user authentication & sessions

Would be good but not essential:

  • Would be great if it was easily embeddable (minimal/no setup required)

Now, I know HTML/JS but on the server side of things I've only ever used ASP.net, so I'm out of my depths here. What I need is basically the equivalent of ASP.net WebForms but for Java.

What would you use to create dynamic pages with Java in the manner described?

5
  • 1
    it think the answer is Jetty, but it has been a while since i used it. Jun 2, 2015 at 0:04
  • 1
    Do you host the server by yourself or are you looking for a hosted server? Jun 2, 2015 at 8:48
  • @StefanBirkner: Self hosting. Oxinabox: I've found it, but was waiting for someone to bring some alternatives and pros/cons
    – Master_T
    Jun 2, 2015 at 17:48
  • 1
    For the part "how to create dynamic pages" - you might want to ask a different question for that (looking for a library). Be aware that all the java Webservers will serve them all the same (for the extend of your question, that is). If you want to learn beforehand you might want to lookup: JSP, JSF, Struts and Spring WebMVC - There are more libraries, each with their own pros and cons and only seriously answerable when we have more data from you. I use Spring WebMVC for most projects, but depending on how simple your setup is a JSP will do fine. Jun 3, 2015 at 12:44
  • Where do you want to run this ? On Linux or Windows ?
    – Marged
    Jul 3, 2015 at 14:32

3 Answers 3

0

What you are searching for is an application server or servlet container.

Because you have developer skills in Java I suggest you use Spring Boot: Spring Boot bundles your code and whatever container you prefer (Tomcat being the default) and creates a self-contained jar which you simply run with your Java runtime.

Your requirements are met in the same way Angelo explained in his answer. I see an advantage in flexibility (jetty and wildfly can be used instead of tomcat), monitoring and embedding.

1

I would recommend Tomcat. Setup is trivial (under debian its aptitude install tomcat8 tomcat8-admin). The server comes up on port 8080 by default. To deploy stuff is in the admin interface http://localhost:8080/admin.

Your dots:

  • Free (gratis): YES
  • The ability to perform calls to Java code YES You supply it with a JSP that does the call, wrap it up in a proper .war file and deploy it. It then is available under host:port/warName/pageName.jsp
  • Support for file downloads YES Static pages and dynamic pages.
  • ability to accept file uploads YES <input type="file"> and proper handling in the receiving JSP/Servlet does that.
  • Support for user authentication & sessions YES Configurable in your web.xml that you deploy with your application. Ships its own user authentication process for the admin and management pages.

Embeddable:

  • Tomcat is not the first choice when it comes to minimal resource usage.
  • You need to provide (next-to) no setup (if you want to change the admin password you need to do that beforehand), the defaults are good enough for simple setups.
1

Really easy to learn and setup is Spark. It uses an embedded Jetty server and I think it has all the features you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.