This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testReceive1() throws Exception { | |
receiver.addMessageListener("NotificationQueue"); | |
sender.sendMessage("NotificationQueue", "bir mesaj gönderiliyor...queue.ya", null); | |
System.out.println("First style message send..."); | |
TimeUnit.SECONDS.sleep(10); | |
//receiver.getLatch().await(10000, TimeUnit.MILLISECONDS); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page | |
@model IndexModel | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Sohbet - SignalRExample</title> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> | |
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var connection = new signalR.HubConnectionBuilder().withUrl("/chatHub").build(); | |
//Disable send button until connection is established | |
document.getElementById("sendButton").disabled = true; | |
connection.on("ReceiveMessage", function (user, message) { | |
var msg = message.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); | |
if (user == $("#userInput").val()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="chatEkrani"> | |
<div class="row"> | |
<div id="mesajAlani bg-white" class="col-md-12"> | |
<div class="d-flex"> | |
<div class="alert alert-dark" role="alert"> | |
<b>@kizildas</b> Bu mesaj karşı taraftan geldi! | |
</div> | |
</div> | |
<div class="d-flex justify-content-end"> | |
<div class="alert alert-info" role="alert"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Article = (props) => { | |
// Notice: <li>s are gone | |
return <div class="article"> | |
<h2 class="article__title">{ props.title }</h2> | |
{ /* ... */ } | |
</div>; | |
} | |
const ArticleList = (props) => { | |
return <div class="articles"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//as json | |
new Gson().toJson(map) | |
//as json | |
ObjectMapper mapper = new ObjectMapper(); | |
mapper.writerWithDefaultPrettyPrinter().writeValueAsString(object); | |
//as json | |
Map<String, Object> stats = ...; | |
System.out.println(new JSONObject(stats).toString(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//jackson mapper.readValue - json to java object | |
@RequestMapping(value="/newPost", method = RequestMethod.POST, produces="application/json", consumes = "application/json") | |
@ResponseBody | |
public ResponseEntity newPost(@RequestBody String body) throws Exception { | |
ObjectMapper mapper = new ObjectMapper(); | |
TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {}; | |
HashMap<String,Object> map = mapper.readValue(body, typeRef); | |
} | |
//jackson - json to object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.xxx.common.util; | |
import com.atomikos.icatch.config.UserTransactionServiceImp; | |
import org.springframework.beans.factory.InitializingBean; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.core.env.Environment; | |
import org.springframework.stereotype.Component; | |
import java.util.Arrays; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.xxx.common.config; | |
import com.atomikos.icatch.config.UserTransactionServiceImp; | |
import com.atomikos.icatch.jta.UserTransactionImp; | |
import com.atomikos.icatch.jta.UserTransactionManager; | |
import net.sf.ehcache.transaction.manager.TransactionManagerLookup; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
import org.springframework.context.annotation.Bean; |
OlderNewer