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
@Stateless | |
class Cliente { | |
public void metodo() { | |
// Meu metodo remoto.... | |
} | |
} |
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
@WebService | |
@Stateless | |
class Cliente { | |
public void metodo() { | |
// Meu metodo remoto... | |
} | |
} |
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
@Local | |
interface ClienteLocal { | |
public void metodo(); | |
} | |
@Remote | |
interface ClienteRemote { | |
public void metodo(); | |
} |
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
@Servlet(urlMappings={"/MinhaAplicacao"}) | |
public class MinhaServlet { | |
@GET | |
public void tratadorGet(HttpServletRequest request, | |
HttpServletResponse response) { | |
.... | |
} | |
} |
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
// Carga de modulos em Javascript. Aqui estou carregando o modulo HTTP, que dar | |
//suporte a requisicoes em protocolo HTTP | |
var http = require('http'); | |
// Nesta linha eu crio um servidor Web, que irá ouvir requisições no porto 8080. | |
// Toda conexao a esse servidor será tratado por uma função criada pelo desenvolvedor. | |
// Esta funcao gera um cabeçalho HTTP 200 (OK) e então ecoa uma mensagem para | |
//o navegador que originou a requisição. | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); |
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
// Aplicacao minima Node.JS com MySQL | |
// Carrega modulos express em mysql | |
var express = require('express'), | |
mysql = require('mysql'); | |
// Inicializa conexao com o banco de dados e servidor Web express | |
var connection = mysql.createConnection({ | |
host : 'localhost', |
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
{ | |
"name": "AloMundoNodeMysql" | |
, "description": "Demonstração de como usar o Express e MySQL juntos" | |
, "author": "Modificado por *Seu nome*" | |
, "version": "0.0.1" | |
, "private": true | |
, "dependencies": { | |
"express": "~2.5", | |
"mysql": "~2.0" | |
} |
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
<!doctype html> | |
<html> | |
<head> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
$('#user-submit').click(function () { | |
var payload = { | |
name: $('#user-name').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
[RoutePrefix("api/books")] | |
public class ControladorLivros : ApiController | |
{ | |
[Route("api/livros")] | |
public IEnumerable<Livro> ObterLivros() { ... } | |
[Route("api/livros/{id:int}")] | |
public Livro ObterLivro(int id) { ... } | |
[Route("api/livros")] |
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
[Route("api/[controller]")] | |
public class ValuesController : Controller | |
{ | |
// GET api/values | |
[HttpGet] | |
public IEnumerable<string> Get() | |
{ | |
return new string[] { "value1", "value2" }; | |
} |
OlderNewer