相关疑难解决方法(0)

你如何在Java中执行http帖子?

这是我正在使用的代码.它不是将数据发布到页面,而是像常规文本文件一样下载它.所以,我实际上是返回了html代码并且没有提交表单.

我知道html表单有效.如果我在浏览器中打开它,我可以发布到它,我的数据显示在我的数据库中.我猜我错过了参数或其他东西.

public void testComm ()
{
try
    {
    URL         url;
    URLConnection   urlConn;
    DataOutputStream    printout;
    DataInputStream input;

    url = new URL ("http://mysite.com/myform.html");

    // URL connection channel.
    urlConn = url.openConnection();

    // Let the run-time system (RTS) know that we want input.
    urlConn.setDoInput (true);

    // Let the RTS know that we want to do output.
    urlConn.setDoOutput (true);

    // No caching, we want the real thing.
    urlConn.setUseCaches (false);

    // Specify the content type.
    urlConn.setRequestProperty
    ("Content-Type", "application/x-www-form-urlencoded");

    // Send POST output.
    printout = new …
Run Code Online (Sandbox Code Playgroud)

java post http

2
推荐指数
1
解决办法
3793
查看次数

从OMDb API获取剧集信息

我在我的应用程序中使用了很棒的OMDb API,我希望能够使用此API搜索剧集信息.

到目前为止,我已经能够搜索电影/剧集,但我找不到搜索特定剧集的方法.(我想我可以使用剧集的IMDB ID来做到这一点,但要发现我需要搜索OMDb,我不知道怎么做)

有谁知道执行此任务的方法?

java api imdb

2
推荐指数
1
解决办法
3445
查看次数

从Java调用Web服务/网站

为现有的GWT项目编写一些额外的类.我需要:

  • 请求URL
  • 读入返回的网页,以便执行操作.

返回的页面是非常简单的HTML,因此解析它应该不是很困难,我只需要先获取数据.

我如何用Java做到这一点?我最好看哪些套餐?

java gwt web-services

1
推荐指数
1
解决办法
1817
查看次数

将Java Applet连接到MySQL DB - 通信链接失败

我正在尝试将我的Java Applet连接到MySQL数据库.我知道它有效,因为我可以在localhost上连接到它,它可以很好地检索记录列表.但是,当我把它放在互联网上时,它不起作用.

这是我的小程序:http://mystikrpg.com/play

它已签名,但我一直收到以下异常:

SQLException获取原因:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通信链接失败

成功发送到服务器的最后一个数据包是0毫秒前.驱动程序未收到来自服务器的任何数据包.

怎么会发生这种情况,我该怎么做才能解决这个问题呢?

这是applet的源代码:http://sodan.pastebin.com/jWKTgBSU

php java mysql jdbc

1
推荐指数
1
解决办法
4299
查看次数

AppEngine:如何查看 POST 请求中的内容

我向 AppEngine 服务器发送 POST 请求。HttpServletRequest 说我:

POST /connexionDeconnexion HTTP/1.1
User-Agent: Java/1.6.0_20
Host: localhost:8888
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 25
Run Code Online (Sandbox Code Playgroud)

我已经发送了世界“HelloHelloHelloHelloHello”,根据Content-Length是正确的。但是,我不知道如何恢复它。你能解释一下吗?

java post google-app-engine servlets request

1
推荐指数
1
解决办法
2864
查看次数

如何用Java发送POST请求?

当我从JSP发送请求时,我使用此代码

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<form method="post"  action="http://translate.intelsoft.az" id="tform" name="ftext">
<input class="gogo1"  value="a" name="l" id="l1" /> <div class="il">
<p>Rusca</p>
<textarea class="ilkin1" name="t" id="t1" >
???????????????????
???????????????????
???????????????????
???????????????????</textarea>
<div><input class="gogo" type="submit" value="T?rcüm?1" name="b1" /></div></div>    </form>

</body>
</html> 
Run Code Online (Sandbox Code Playgroud)

并且响应是正确的,以便我看到参数的值.但是当我从Java发送时,我没有得到正确的答复.我认为参数没有正确发送.这是我的Java代码:

String urlParameters = "t=???????????????????&l=a";
String request = "http://translate.intelsoft.az";
URL url = null;
try {
    url = new URL(request);
} catch (MalformedURLException …
Run Code Online (Sandbox Code Playgroud)

java jsp httprequest

1
推荐指数
1
解决办法
1万
查看次数

如何将http请求发送到另一个servlet

在我的项目文件夹中,我们有2个ContextPath/WEB-INF/Classes/*.class名称为App1.class和的java文件App2.class

如果我想运行App1.class,我只需要在浏览器中触发URL.

  http://localhost:8080/Mapping/App1
Run Code Online (Sandbox Code Playgroud)

同样,如果要触发App2.class,请使用以下链接

 http://localhost:8080/Mapping/App2
Run Code Online (Sandbox Code Playgroud)

我想触发App2App1,意味着如果触发App1在浏览器对应的URL,这将是触发App2.

我也不想做任何回应.

我怎样才能做到这一点.

谁能帮我.

谢谢.

java java-ee-6

1
推荐指数
1
解决办法
2万
查看次数

android java.net.ProtocolException:已建立连接

public static Bitmap getImage(String address) throws Exception {

    Bitmap imgmap = null;
    InputStream is = null;

    URL url = new URL(address);

    HttpURLConnection  conn = (HttpURLConnection)url.openConnection();
    try {
        conn.setRequestMethod("GET"); >>> here was been excuted,but go to finally block
        conn.setConnectTimeout(5000); 
        is = conn.getInputStream();
        byte[] imgbytes = StreamTool.getBytes(is);
        imgmap = BitmapFactory.decodeByteArray(imgbytes, 0, imgbytes.length);

    } finally {
        if (is != null) {
            is.close();
        }
        if (conn != null) {
            conn.disconnect();
        }
    }

    return imgmap;
}
Run Code Online (Sandbox Code Playgroud)

conn.setRequestMethod("GET")被解雇之前,Thorw异常连接已经建立.谁能给我一个解决方案

java android

1
推荐指数
1
解决办法
5110
查看次数

如何使用Java或C#从Google获取搜索结果?

我想在我的应用程序中使用谷歌搜索(包括获取特定结果的选项,如:'结果仅从最后一天').

我怎样才能做到这一点?

c# java

-3
推荐指数
1
解决办法
908
查看次数

标签 统计

java ×9

post ×2

android ×1

api ×1

c# ×1

google-app-engine ×1

gwt ×1

http ×1

httprequest ×1

imdb ×1

java-ee-6 ×1

jdbc ×1

jsp ×1

mysql ×1

php ×1

request ×1

servlets ×1

web-services ×1