New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javalin 3.0 suggestions and feature request #514
Comments
maybe |
Rewriting to be based on Java 8 instead of Kotlin, but still be Kotlin-viable. Java is the language (IMO) that lacks good framework like Javalin, in Kotlin, there are alternatives. |
@kran What is nested form data? @majorpasza There are mostly upsides to rewriting to Java, except for one thing... It has to be written in Java. I didn't think that was so bad until I actually started rewriting it. I've become very accustomed to Kotlin over the years, and going back to Java was kind of a shock. The majority of users use Kotlin (although it's very close to 50/50), but that's not really an argument. As you say, they wouldn't really notice. Javalin is almost two years old now, and no one has complained about the Kotlin dependencies yet, so it doesn't appear to be a problem. It's probably mainly something which bothers me and other people working on the project. All things considered, I think it's better to spend time on new features and API improvements, compared to a Java rewrite. |
@tipsy |
data class student(var name:String = "kangkang", var age : Date? = null)
//request json: {"name":"jan","date":"1553741222"} ps: date is CST Unix timestamp CST:2019-03-28 10:47:02
val student = Context.bodyAsClass(Student::class.java)
println(student.age) //1970-1-1 00:00.000 Date GMT = CST + 8 why? Can the new version be just a different time zone? Thank you very much for your help. |
Hello @tipsy! Great work that you have done! After I use Spark in some projects I would enjoy to use Javalin. I have some issues to use Javalin in Google App Engine. I will appreciate a lot that you implement something like SparkFilter. Thank you. |
@kran can you show me in code? @fuuqiu This is not really related to Javalin, it's Jackson. You can configure your own Jackson mapper by calling @inaiat thank you! I'm not sure what "something like SparkFilter would mean in this sense", but it's possible to do this:
Javalin 3 will make the process of creating a |
@tipsy In my apps with sparkjava I use in this way:
SparkFilter implements javax.servlet.Filter. The implementation of SparkFilter is here: https://github.com/perwendel/spark/blob/master/src/main/java/spark/servlet/SparkFilter.java Thanks. |
@tipsy Thank you very much, I am negligent, I found the relevant configuration of jackson in the configuration, and now it has been modified. If you can add some data class data verification in version 3.0, I think this will be a very good function. |
sorry for my weak english. here is the code. form:
handler:
output:
keys are encoded and include in other languages/frameworks, like PHP, the struct is like this:
|
@tipsy Support for kotlin coroutines please Being able to launch coroutines and let them do things async-ly and independent of the req/resp flow would be great |
@asad-awadia currently you can do Edit: There's this for converting a coroutine to a future: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-jdk8/kotlinx.coroutines.future/kotlinx.coroutines.-coroutine-scope/future.html |
|
I'm not saying coroutines aren't nice, but you don't really have to deal with async at all in Javalin (at least that's the idea). You should be able to write all your code with coroutines if you do somthing like Interoperability and "sameness" are key concerns for Javalin, so I don't want to introduce a concept that will only benefit Kotlin users. |
Let me start by saying I love this project. Of all the options available for Java, Javalin is light-weight and easy to work with. I was able to write a simple MVC framework (similar to ASP.NET Core) that uses annotation processing to build Javalin route definitions at compile time. Javalin makes a great core to my web stack. One of things I found myself doing was using a 404 handler to support my single-page applications. I have to be careful because I am using A short-hand for top-level error handling would be nice, too. Right now, I just write this: app.exception(Exception.class, (e, ctx) -> {
logger.error("Encountered an unhandled exception.", e);
ctx.status(500);
}); Again, that works, but I could see most users not wanting to deal with that. A simple Honestly, I love how small this project is. I'd hate to see it get weighed down with features I'd never use. There's plenty of room for little conveniences, though. I feel like there was something else I had on my wish list. If I remember it, I will be sure to share. Thanks! |
@jehugaleahsa thank you very much! There is a single page handler already:
I think it does exactly what you want (?). For your second point, I'm not sure you save that much?
Why do you think this is better? One of my main goals for 3.0 is to slim down the number of methods on the |
Hello, |
javalin how to integrated with jpa,redis ,i try to use it for some small system |
@Nezteb Swagger support would be great, but I don't have any good ideas for how to solve it. If you want to try I'd be happy to help. @scorsi Could you be a bit more specific? Are you talking about infrastructure, project structure, or something else? @kindywu What do you mean support? You can use both of them fine, what would the support include? |
Hey @tipsy, import io.javalin.Context
import io.javalin.Javalin
import io.javalin.apibuilder.ApiBuilder
import io.javalin.apibuilder.ApiBuilder.get
// JAVALIN INTERNAL CODE
interface Microservice {
fun route()
}
fun Javalin.microservice(path: String, microservice: MyMicroservice) {
routes {
ApiBuilder.path(path) { microservice.route() }
}
}
// END OF JAVALIN INTERNAL CODE
object MyMicroservice : Microservice {
override fun route() {
get("/toto", this::getToto)
}
private fun getToto(ctx: Context) {
ctx.result("Hello World")
}
}
fun main() {
val app = Javalin.create().start(7000)
app.microservice("/my-microservice", MyMicroservice)
} The goal is to have a micro service per jar file (Gradle/Maven project) and to easily implement them like the EDIT: |
Hi, what about implementing JSR 380 Bean validation 2.0? Then we could use some of these goodies:
And this would not have to be necessary:
But I may be missing something and perhaps it is easy to plug my own validation already. Some links: |
@vrozkovec I'm fine with that, but it would have to be an optional dependency. Would you like to submit a PR? @scorsi I'm having some trouble understanding. You want to create one Javalin-instance per endpoint? |
@tipsy when should be PR ready to make it to 3.0? |
@vrozkovec The preliminary completion date is set to June, so some time before that. I will be releasing alpha/beta builds though, the first alpha version was released today. |
I would like for an easy and simple way to deploy javalin on serverless environments (aws, google...) |
Protobuf over rest? |
@asad-awadia have a look at this issue: #453 What support is required? |
@tipsy nvm then lol |
Hi, is it possible to add a way to throw my own exception when validating request body instead use getOrThrow in check?
|
@vinigmoraes The API for this has changed a bit with 3.0, the last call is just called |
Would it be possible to make the size of thread-pool (min, max) configurable for the integrated Jetty? I'd like to use Javalin with Hibernate, but with the default thread-pool size of up to 250, I'm not sure if I want to possibly have 250 Hibernate sessions. Or does this sound stupid? |
You can already run on a custom server by calling |
@TobiasWalle If you're okay with it, I'd like to mention you by name in the OpenAPI section of the 3.0 release announcement. Do you have any profile you'd like me to link to (LinkedIn, GitHub, Twitter?). Or would you prefer to stay anonymous? |
Is the 3.0 version going to be updated? It’s a good news. Looking forward to the release.Is there a related Telegram group for javalin? |
Getting close to release, so closing this issue. |
Feel free to discuss Javalin 3.0 in this issue.
Please create new issues if you have specific requests.
The current milestone (roadmap) can be seen here: https://github.com/tipsy/javalin/milestone/7
Current changelog: dbf2090...HEAD
Javalin 2.8.X will receive security updates when 3.0 is out, but no new features.
Alpha/beta builds available at: https://javalin.io/future/documentation
Progress
Misc
FileRenderer
throw exceptionasyncRequestTimeout
enforceSsl
javalin-servlet
separately (rejected)WebSocket
wsBefore
/wsAfter
andwsException
The text was updated successfully, but these errors were encountered: