Questions tagged [spark-framework]

Spark Framework - A tiny Java web framework. Use this tag for Spark framework related questions. Spark is a free and open-source software web application framework and domain-specific language written in Java. This is not for Apache Spark, this is for a web application framework.

Spark Framework is a simple and lightweight Java web framework built for rapid development built in Java.

It is an alternative to other Java web application frameworks such as JAX-RS, Play framework and Spring MVC. It runs on an embedded Jetty web server by default, but can be configured to run on other webservers.

Spark was originally inspired by the web framework Sinatra, but it's intention isn't to compete with Sinatra, or other similar web frameworks in different languages.

Refer

44 questions
14
votes
2 answers

Spark Framework: Match with or without trailing slash

I have noticed something in the Spark Framework. It does not match trailing slashes with a mapped route. So it considers /api/test and /api/test/ as different URIs. That's fine if there is a way to wildcard them together, but there doesn't seem to…
mtyson
  • 8,196
  • 16
  • 66
  • 106
11
votes
4 answers

Java spark framework enable logging

I'm building a java application with Spark framework with embedded Jetty and handlebars template engine. But when i get an 500 Internal Error, the console didn't say anything. I have added to my pom.xml the dependencies here:…
SergiX44
  • 371
  • 2
  • 5
  • 15
6
votes
1 answer

Spark WS Framework Filter being called twice

I am tying to use a before filter to add trailing slashes as well as a before filter to handle authentication on certain endpoint. Here is my routing code: // Add filter to all requests which adds a trailing slash if it is missing // before("*",…
Nathan Case
  • 655
  • 1
  • 6
  • 15
5
votes
1 answer

Gradle Jar packaging Vue into Spark

I am bundling a Vue UI with a Spark Java backend. Both modules are built independently, which works fine with the following structure: project +-- backend | +-- src | | +-- main | | +-- resources | | +-- public…
MonoThreaded
  • 11,429
  • 12
  • 71
  • 102
5
votes
1 answer

Better way to create a web application with Java and Vue

I'm starting to get into web development a little more. Currently I use the Spark Framework along with Vue for the few apps I've made. While this certainly works it's not ideal. The project is built with Maven (and NPM for Vue) and the build process…
Jerred Shepherd
  • 530
  • 1
  • 6
  • 18
5
votes
2 answers

How to get all exposed routes in Spark framework

In java spark web framework a route is defined as get("/", (request, response) -> { // Show something }); In my application I define multiple routes. Is there any way I can get all the exposed routes of the application?
yellow boy
  • 149
  • 1
  • 7
4
votes
1 answer

How to reload templates without reloading server?

I'm working on an application in Java/Spark framework and I'm using the Apache Velocity template engine. My problem is, that every time I change anything in the templates, I have to reload the whole server. Is there a way to enable some kind of…
Jake S.
  • 568
  • 6
  • 25
3
votes
2 answers

How do I configure Jetty to allow larger forms when used with Spark Framework

How do I configure Jetty options via Spark framework ? Im getting the problem below when i submit a large form. The solution for Jetty is documented at Form too Large Exception But Jetty is hidden from me using Spark Framework, how would I…
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
3
votes
1 answer

Correct url flow for web Java-spark application

My web application is created with Spark Framework (Connecting on same page as server) the url of the first page is http://localhost:4567/start From here the user clicks on a button to decide one of four tasks. The form action button is /start The…
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
3
votes
1 answer

Concurrency inside embedded Jetty of Spark java

We have a simple Java REST API that is supported by Spark framework. We have initialized the threads as is indicated in http://sparkjava.com/documentation#embedded-web-server by the following chunk that is being called from the Java main method of…
Arcones
  • 3,954
  • 4
  • 26
  • 46
3
votes
0 answers

SSE implementation in Spark REST

Looking for a simple example of a GET rest api that produces text/event-stream. How do I keep a track of listeners, how to use emitter in spark? Basically, how do I achieve SSE using spark framework (Server side code)
3
votes
2 answers

Couchbase server connection is giving an authentication error

All I want to do is to do an upsert operation. I have a JsonDocument and I have a Couchbase server "123.456.789.1011" and a bucket inside, called "testbucket". Now, when I open the server using the IP address with port 8091, it asks me for a…
Vikash Kumar
  • 87
  • 2
  • 11
2
votes
2 answers

Why does Html Audio control fails in html if served rather than treated as a regular file

I have a Java application that can run as a regular java Swing application but creates a standard html5 report that opens in a webbrowser. e.g Browser Url…
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
2
votes
1 answer

Correct content-type for sending this AJAX Post data

I am having problem sending base64 image data using ajax post I think I have the wrong value for Content-Type but have tried application/json, text/json and image/jpeg without any success Javascript function sendFormData(fD) { var urls…
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
2
votes
1 answer

How do I use Java Spark Framework queryMaps?

My Html is of the form 01 - Big Love.WAV
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
1
2 3