简体   繁体   English

创建一个简单的Java哈希服务器

[英]Creating a simple java hash server

Is it possible to create a simple server in Java that returns a response based on a given key? 是否有可能创建一个简单的Java服务器返回基于给定密钥的响应?

So it would be a simple program, that stores a hashmap and returns the result based on a key provided by the client. 因此,这将是一个简单的程序,该程序存储哈希图并根据客户端提供的密钥返回结果。

What would be the fasted implementation, to have it over HTTP or a socket? 通过HTTP或套接字实现斋戒的实现是什么? The client will be a web based application. 客户端将是基于Web的应用程序。

No should describe your environment a little better in order to get a qualified answer. 不能更好地描述您的环境以获得合格答案。 Client is a web based application, thats all we know. 客户是一个基于Web的应用程序,仅此而已。

You could provide a servlet and add your hashcode as a request parameter. 您可以提供一个servlet并将您的哈希码添加为请求参数。 The servlet will do a lookup and return the requested object using JSON , this can be parsed in your web based application from javascript. Servlet将进行查找并使用JSON返回请求的对象,可以在基于Web的应用程序中使用javascript进行解析。

A tutorial for prototype and one for jQuery (which seems more popular). 有关原型的教程和有关jQuery的教程(似乎更受欢迎)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM