Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:32

    ryber on main

    give the body parts somewhat me… (compare)

  • 12:16
    ryber commented #376
  • 12:16
    ryber commented #376
  • 06:26
    FireDrunk commented #376
  • 06:25
    FireDrunk commented #376
  • 06:25
    FireDrunk commented #376
  • 05:45
    FireDrunk commented #376
  • Oct 21 14:57
    ryber commented #377
  • Oct 21 14:29
    AAIING opened #377
  • Oct 21 13:46
    ryber commented #376
  • Oct 21 13:12
    FireDrunk opened #376
  • Oct 19 19:56
    pedr0-fr commented #375
  • Oct 18 12:45
    ryber commented #375
  • Oct 17 17:06
    pedr0-fr commented #375
  • Oct 17 17:06
    pedr0-fr commented #375
  • Oct 17 13:12
    ryber closed #373
  • Oct 17 13:12
    ryber commented #373
  • Oct 17 13:12
    ryber labeled #373
  • Oct 17 13:12
    ryber assigned #373
  • Oct 17 13:11
    ryber milestoned #373
Kent Avasarala
@kent92
and when i launch the main class using 'gradle run', things work fine and i don't get any errors
but when i build a jar using 'gradle jar', and then try to run the jar using 'java -jar myapp.jar', i get:
$ java -jar java-http-req.jar
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/mashape/unirest/http/exceptions/UnirestException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.mashape.unirest.http.exceptions.UnirestException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Kent Avasarala
@kent92
nvm, found my answer
in the gradle build script, make sure your 'jar' tasks look like this:

jar {
manifest {
attributes 'Main-Class': 'com.javatesting.req.App'
}

from {
    configurations.compile.collect {
        it.isDirectory() ? it : zipTree(it)
    }
}

}

Laxman-M-R
@Laxman-M-R
Hi!
Does anyone know how to use unirest in dropwizard? I am new to both. So help is required. Thanks in advance!
kingdevnl
@kingdevnl
Hey
Is it possible to add a json body to an get request?
Ryan Bergman
@ryber
@kingdevnl No, this isn't something normally done (see this SO for the philosophical why https://stackoverflow.com/questions/978061/http-get-with-request-body) for the concrete why ... Unirest is powered by Apache Http Client, and that library also, does not allow for it.
Exerosis
@Exerosis
OMG :O unirest is back?
Onilton Maciel
@onilton
@ryber I started trying to update unirest.io/java since it is very outdated and seems to point people to an outdated unirest-java version. Any tips or idea to who to talk to?
I was also thinking about a script to automatically convert from the REAME.md to html
I know this is the source https://github.com/Kong/unirest-website
Ryan Bergman
@ryber
@onilton I made an issue for it Kong/unirest-website#9
Charlie J
@Chazza
Hey @ryber :
Just joined :)
Ryan Bergman
@ryber
Hello, so to answer your question, you can DO whatever you want. but each time you create a new configuration and a new authentication it's going to spawn some threads that need to exist and you will want to properly shut down. One of the advantages of Unirest/Apache is that it does connection pooling, so in a high volume rest instance where you are making thousands of requests per second it has some optimizations that you would lose by creating new instances all the time
Charlie J
@Chazza
Oh right I see, the endpoint has the username on the end I wish to use. I used to use nodejs which made rapid requests with proxies easy. With java it seems to be more challenging
Ryan Bergman
@ryber
yea, agree, it's not really designed for this case, most languages make this part easier, Apache Http Client is basically built like a browser. It's very powerful and very fast, but it's config is not optimized for each request being a snowflake
You might look at something like OpenFeign
Or OkHttp
Charlie J
@Chazza
I did see OkHttp, I wasn’t sure how it would perform. I also looked at plain java requests with multi threading
Ryan Bergman
@ryber
OpenFeign uses OkHttp. My experience is its quite performant. I mean Netflix uses it so...
Charlie J
@Chazza
Oh right I’ll look into that too, really? :O wow
Ryan Bergman
@ryber
They made it
Charlie J
@Chazza
Damn that’s awesome
It’s mainly being able to use proxies and be rapid
V1 of my tool is in nodejs, that’s rapid. However I’d like to move to java and use the obfuscator I bought
So I can ensure it doesn’t get leaked n stuff
Ryan Bergman
@ryber
Yea, I think given your use case, even if I made Unirest attempt to do multiple proxies you would still need to do that up front and it wouldn't work well for you. Take a look at some of the alternatives
Charlie J
@Chazza
I’m currently looking at using java itself for requests with multi threading, speed seems good - tho I’m not sure how I use proxies with it
Ryan Bergman
@ryber
The Java http client is pretty raw. I don't think it can do proxies unless they have added that in the newest versions
Charlie J
@Chazza
Oh welp, see this is the struggle I’m in. I need something which can perform rapid with proxy support
Charlie J
@Chazza
Is it possible to save a file using Unirest? @ryber
Roman Beskrovnyi
@romankh3
Hello, the community!
Tell me please, what's the difference between this library and com.mashape.unirest ? @ryber
Ryan Bergman
@ryber
@romankh3 its the same thing. Mashape became Kong years ago
Sruti
@Su-s
how to set redirect and cookie in unirest
ancileddu
@ancileddu
Hi all, how can i log ma unirest request? can i log the request body?
Ryan
@Uniconnector
What is the minimum of a Java version of unirest-java?
jdk 8?
viswared
@viswared
Hi Community, how can i retrieve RequestBodyEntity or Body as string from kong.unirest.HttpRequest ? i am looking equivalent method for request.body() of com.mashape.unirest version 1.4.9. @ryber
Ryan Bergman
@ryber
@Uniconnector yes 8
@viswared String body = Unirest.get("http://someplace").asString().getBody()