jmfayard
10/19/2019, 8:17 AMSteve
10/20/2019, 6:58 PMNikky
10/21/2019, 5:25 AMfetch
requests fail
Access to fetch at '<https://pentagame.herokuapp.com/api/status>' from origin '<http://pentagame.herokuapp.com>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
as if all the cors settings i set in Ktor had no effect anymorevlad.minaev
10/21/2019, 8:28 AMIlya Shaydullin [IceRock]
10/21/2019, 11:48 AM<http://127.0.0.3/order/admin?filters%5Bid%5D=33&filters%5Baddress%5D=fooooooooo>
When I try to get query parameters, ktor returns this:
(img)
How can I make it parse the filters
parameter as an hashMap
? (val filters = hashMapOf("id" to 33, "address" to "fooooooooo")
)jaguililla
10/21/2019, 3:05 PMNikky
10/21/2019, 5:06 PMjaguililla
10/27/2019, 8:25 AMVyacheslav Farionik
11/04/2019, 11:35 AMthiagoretondar
11/13/2019, 11:33 PM{
"object":"page",
"entry":[
{
"id":"<PAGE_ID>",
"time":1458692752478,
"messaging":[
{
"sender":{ "id":"<PSID>" },
"recipient":{ "id":"<PAGE_ID>" },
... // <-- this
}
]
}
]
}
where ...
can be different events like message
, reaction
, postback
and others. My doubt is at this part. How do you guys map those kind of JSON? The content of each property isn’t that much important for me since once it’s mapped I can send to the correct microservice the original JSON.Kyle Jablonski
11/24/2019, 12:26 PMrrva
11/25/2019, 4:38 PMDaniil Bubnov
12/05/2019, 11:24 AMjava.sql.*
, what kotlin lib I should choose? (preferably very simple - no orm/active record)nkiesel
12/06/2019, 1:11 AMfun hello(@QueryParam("greeting") @DefaultValue("hi") greeting: String = "hi")
to get the same default value when called via REST or directly. Is there a way to avoid duplicating the default value?Pierre Thibault
12/06/2019, 1:53 AMOmprakash Sridharan
12/07/2019, 5:51 PMMatthias R
12/09/2019, 9:59 AMminucha
12/12/2019, 4:13 PM@RequestMapping(value = "/my_image",
method = RequestMethod.GET,
produces = MediaType.IMAGE_PNG_VALUE)
public ResponseEntity<byte[]> getMyImage() throws IOException {
ClassPathResource imgFile = new ClassPathResource("static/images/user/my_image.png");
byte[] bytes = StreamUtils.copyToByteArray(imgFile.getInputStream());
return ResponseEntity
.ok()
.contentType(MediaType.IMAGE_PNG)
.body(bytes);
}
The thing is, I have 7 images, and I believe there has to be a better way than writing this method 7 times. Can someone point me in the right direction? I want generic method for serving images.minucha
12/14/2019, 9:25 AMDataSource
class which configures Hikari
public class DataSource {
private static HikariConfig config = new HikariConfig();
private static HikariDataSource ds;
static {
config.setJdbcUrl("jdbc:<mysql://username>:<mailto:password@q2gen47hi68k1yrb.chr7pe7iynqr.eu-west-1.rds.amazonaws.com|password@q2gen47hi68k1yrb.chr7pe7iynqr.eu-west-1.rds.amazonaws.com>:3306/mmylxkukgpzvjvfx");
config.setUsername("username");
config.setPassword("password");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
config.addDataSourceProperty("cachePrepStmts", "true");
ds = new HikariDataSource(config);
}
private DataSource() {
}
public static Connection getConnection() throws SQLException {
return ds.getConnection();
}
}
In all tutorials I followed, they show this code or similer one but they don’t tell where and how to use the getConnection()
.
And the question is when, where and how do I call the getConnecion()
method?
Am I going to call it in every request I receive (in every api method defined in every single controller) ?
@GetMapping(path = "/all")
public @ResponseBody Iterable<ExampleEntity> getAllUsers() {
try {
Connection connection = DataSource.getConnection();
// what am I gonna do with the connection ?
return mExampleService.getAll();
} catch (SQLException ex) {
System.err.println("Exception Occurred");
}
}
Ray Eldath
12/17/2019, 3:07 AMamar_1995
12/17/2019, 12:11 PMshelbycohen
12/18/2019, 1:02 AMlifey
12/21/2019, 8:06 AMAhsan Raza
12/21/2019, 10:47 AMcodebijan
12/27/2019, 10:03 PMPipsy100
12/29/2019, 9:41 AMcodebijan
12/29/2019, 5:55 PMBrendan Weinstein
01/11/2020, 9:29 PMBrendan Weinstein
01/12/2020, 2:05 AMSlackbot
01/15/2020, 7:55 PMSlackbot
01/15/2020, 7:55 PMDico
01/15/2020, 8:02 PMJoshua
01/15/2020, 8:53 PMTristan
01/15/2020, 9:26 PMkqr
01/15/2020, 9:53 PM