- 这是我的代码。
- 我使用一种简单的方法来制作 POST httprespon。
- 安装在小程序上。
- 我在 Eclipse 中工作正常。
- 但挂载在appletviewer 导致被击落。
- 网页也会被击落。
- 数据量太大无法处理?
- 还是有其他原因?
我需要帮助 谢谢
public class we extends Applet { Button sd = new Button("11"); Label title= new Label(); Label prompt = new Label(); TextField input = new TextField(8); Label result = new Label(); public void init() { add(sd); } public void start() { } public void paint (Graphics g) { } public boolean action(Event e, Object o) { if (e.target == input) { match(); } else if (e.target == sd) { abandon(); } return true; } private void match() { } private void abandon() { String url="http://119.14.80.132/ACT_ID_355"; HttpPost httppost=new HttpPost(url); List<NameValuePair> params=new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("UNCLOSE1","1")); try { httppost.setEntity(new UrlEncodedFormEntity(params,HTTP.ISO_8859_1)); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } HttpResponse response = null; try { response = new DefaultHttpClient().execute(httppost); } catch (ClientProtocolException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } if(response.getStatusLine().getStatusCode()==200){ try { String resultq=EntityUtils.toString(response.getEntity()); } catch (ParseException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } }
}
小程序查看器
Exception in thread "AWT-EventQueue-1" java.security.AccessControlException: acc
ess denied ("java.net.SocketPermission" "119.14.80.132:80" "connect,resolve")
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:366)
at java.security.AccessController.checkPermission(AccessController.java:
560)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1051)
at java.net.Socket.connect(Socket.java:574)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSoc
ketFactory.java:127)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnect
ion(DefaultClientConnectionOperator.java:180)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedCli
entConnectionImpl.java:294)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(Default
RequestDirector.java:640)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultReq
uestDirector.java:479)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpCl
ient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpCl
ient.java:805)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpCl
ient.java:784)
at we.abandon(we.java:130)
at we.action(we.java:49)
at java.awt.Component.handleEvent(Component.java:6751)
at java.awt.Component.postEvent(Component.java:5160)
at java.awt.Component.postEvent(Component.java:5170)
at java.awt.Component.dispatchEventImpl(Component.java:4877)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:696)
at java.awt.EventQueue$4.run(EventQueue.java:694)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:693)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)