java.net.URLConnection.setAllowUserInteraction()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(256)

本文整理了Java中java.net.URLConnection.setAllowUserInteraction()方法的一些代码示例,展示了URLConnection.setAllowUserInteraction()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URLConnection.setAllowUserInteraction()方法的具体详情如下:
包路径:java.net.URLConnection
类名称:URLConnection
方法名:setAllowUserInteraction

URLConnection.setAllowUserInteraction介绍

[英]Sets allowUserInteraction. Unused by Android.
[中]设置allowUserInteraction。Android没有使用过。

代码示例

代码示例来源:origin: stackoverflow.com

  1. String addr = "http://172.26.41.18:8080/domain/list";
  2. URL url = new URL(addr);
  3. HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
  4. httpCon.setUseCaches(false);
  5. httpCon.setAllowUserInteraction(false);
  6. httpCon.addRequestProperty("Authorization", "Basic YWRtaW4fYFgjkl5463");
  7. System.out.println(httpCon.getResponseCode());
  8. System.out.println(httpCon.getResponseMessage());

代码示例来源:origin: org.codehaus.groovy/groovy

  1. final URLConnection connection = url.openConnection();
  2. if (parameters != null) {
  3. if (parameters.containsKey("connectTimeout")) {
  4. connection.setAllowUserInteraction(DefaultGroovyMethods.asType(parameters.get("allowUserInteraction"), Boolean.class));

代码示例来源:origin: stackoverflow.com

  1. String userPassword = "login:password";
  2. URL url = new URL(ksGateUrl);
  3. // URLConnection urlc = url.openConnection();
  4. URLConnection urlc = new URLConnection(url);
  5. urlc.setDoOutput(true);
  6. urlc.setUseCaches(false);
  7. urlc.setAllowUserInteraction(false);
  8. urlc.setRequestProperty("Authorization",
  9. "Basic " + new sun.misc.BASE64Encoder().encode (userPassword.getBytes()));
  10. urlc.connect();

代码示例来源:origin: stackoverflow.com

  1. URL url = new URL("http","www.google.com");
  2. HttpURLConnection urlc = (HttpURLConnection)url.openConnection();
  3. urlc.setAllowUserInteraction( false );
  4. urlc.setDoInput( true );
  5. urlc.setDoOutput( false );
  6. urlc.setUseCaches( true );
  7. urlc.setRequestMethod("GET");
  8. urlc.connect();
  9. // check you have received an status code 200 to indicate OK
  10. // get the encoding from the Content-Type header
  11. BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream()));
  12. String line = null;
  13. while((line = in.readLine()) != null) {
  14. System.out.println(line);
  15. }
  16. // close sockets, handle errors, etc.

代码示例来源:origin: kebernet/shortyz

  1. private InputStream OpenHttpConnection(URL url, String cookies)
  2. throws IOException {
  3. InputStream in = null;
  4. URLConnection conn = url.openConnection();
  5. if ((cookies != null) && !cookies.trim()
  6. .equals("")) {
  7. conn.setRequestProperty("Cookie", cookies);
  8. }
  9. conn.setAllowUserInteraction(false);
  10. conn.connect();
  11. in = conn.getInputStream();
  12. return in;
  13. }

代码示例来源:origin: stackoverflow.com

  1. HttpURLConnection c = null;
  2. try {
  3. URL u = new URL(url);
  4. c = (HttpURLConnection) u.openConnection();
  5. c.setRequestMethod("GET");
  6. c.setRequestProperty("Content-length", "0");
  7. c.setUseCaches(false);
  8. c.setAllowUserInteraction(false);
  9. c.setConnectTimeout(timeout);
  10. c.setReadTimeout(timeout);

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

  1. public InputStream asStream() throws IOException {
  2. URLConnection connection = getURL().openConnection();
  3. connection.setAllowUserInteraction(false);
  4. connection.setUseCaches(true);
  5. return connection.getInputStream();
  6. }

代码示例来源:origin: stackoverflow.com

  1. HttpURLConnection c = null;
  2. try {
  3. URL u = new URL(url);
  4. c = (HttpURLConnection) u.openConnection();
  5. c.setRequestMethod("GET");
  6. c.setRequestProperty("Content-length", "0");
  7. c.setUseCaches(false);
  8. c.setAllowUserInteraction(false);
  9. c.setConnectTimeout(timeout);
  10. c.setReadTimeout(timeout);

代码示例来源:origin: com.numdata/numdata-swing

  1. @Override
  2. @NotNull
  3. public Image getImage()
  4. throws IOException
  5. {
  6. final URLConnection urlConnection = _url.openConnection();
  7. urlConnection.setAllowUserInteraction( false );
  8. urlConnection.setDoInput( true );
  9. urlConnection.setUseCaches( true );
  10. final Image image = (Image)urlConnection.getContent( new Class<?>[] { Image.class } );
  11. if ( image == null )
  12. {
  13. throw new IOException( "Failed to load image from " + _url );
  14. }
  15. return image;
  16. }

代码示例来源:origin: stackoverflow.com

  1. URL url = new URL(INSERT_HERE_YOUR_URL);
  2. String query = INSERT_HERE_YOUR_URL_PARAMETERS;
  3. URLConnection urlc = url.openConnection();
  4. urlc.setAllowUserInteraction(false);

代码示例来源:origin: freenet/fred

  1. @Override
  2. InputStream getInputStream(PluginProgress progress) throws IOException {
  3. URLConnection urlConnection = getSource().openConnection();
  4. urlConnection.setUseCaches(false);
  5. urlConnection.setAllowUserInteraction(false);
  6. //urlConnection.connect();
  7. return openConnectionCheckRedirects(urlConnection);
  8. }

代码示例来源:origin: stackoverflow.com

  1. int response = -1;
  2. URL url = new URL(urlString);
  3. URLConnection conn = url.openConnection();
  4. httpConn.setAllowUserInteraction(false);
  5. httpConn.setInstanceFollowRedirects(true);
  6. httpConn.setRequestMethod("GET");

代码示例来源:origin: stackoverflow.com

  1. public String getpage(URL url)
  2. {
  3. try {
  4. // try opening the URL
  5. URLConnection urlConnection = url.openConnection();
  6. urlConnection.setAllowUserInteraction(false);
  7. InputStream urlStream = url.openStream();
  8. byte buffer[] = new byte[1000];
  9. int numRead = urlStream.read(buffer);
  10. String content = new String(buffer, 0, numRead);
  11. while ((numRead != -1) && (content.length() < MAX_PAGE_SIZE)) {
  12. numRead = urlStream.read(buffer);
  13. if (numRead != -1) {
  14. String newContent = new String(buffer, 0, numRead);
  15. content += newContent;
  16. }
  17. }
  18. return content;
  19. } catch (IOException e) {
  20. e.printTrackStace();
  21. }catch(IndexOutOfBoundsException e1){
  22. e1.printTrackStace();
  23. }
  24. }

代码示例来源:origin: robovm/robovm

  1. URL url = new URL(absoluteURI);
  2. OutputStream urlOutStream = null;
  3. String protocol = url.getProtocol();
  4. URLConnection urlCon = url.openConnection();
  5. urlCon.setDoInput(false);
  6. urlCon.setDoOutput(true);
  7. urlCon.setUseCaches(false);
  8. urlCon.setAllowUserInteraction(false);

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

  1. public long lastModified() {
  2. try {
  3. URLConnection connection = getURL().openConnection();
  4. connection.setAllowUserInteraction(false);
  5. connection.setUseCaches(true);
  6. connection.setIfModifiedSince(mLastModified);
  7. mLastModified = connection.getLastModified();
  8. }
  9. catch (IOException ignore) {
  10. }
  11. return mLastModified;
  12. }
  13. }

代码示例来源:origin: plutext/docx4j

  1. URL url = new URL(absoluteURI);
  2. OutputStream urlOutStream = null;
  3. String protocol = url.getProtocol();
  4. URLConnection urlCon = url.openConnection();
  5. urlCon.setDoInput(false);
  6. urlCon.setDoOutput(true);
  7. urlCon.setUseCaches(false);
  8. urlCon.setAllowUserInteraction(false);

代码示例来源:origin: IanDarwin/javasrc

  1. public static String converse(URL url, String postBody) throws IOException {
  2. URLConnection conn = url.openConnection();
  3. boolean post = postBody != null;
  4. if (post)
  5. conn.setDoInput(true);
  6. conn.setDoOutput(true);
  7. conn.setAllowUserInteraction(true);
  8. conn.connect();
  9. if (post) {
  10. PrintWriter out = new PrintWriter(conn.getOutputStream());
  11. out.println(postBody);
  12. out.close(); // Important!
  13. }
  14. StringBuilder sb = new StringBuilder();
  15. BufferedReader in = new BufferedReader(
  16. new InputStreamReader(conn.getInputStream()));
  17. String line;
  18. while ((line = in.readLine()) != null) {
  19. sb.append(line);
  20. }
  21. in.close();
  22. return sb.toString();
  23. }
  24. }

代码示例来源:origin: robovm/robovm

  1. URL url = new URL(absoluteURI);
  2. OutputStream urlOutStream = null;
  3. String protocol = url.getProtocol();
  4. URLConnection urlCon = url.openConnection();
  5. urlCon.setDoInput(false);
  6. urlCon.setDoOutput(true);
  7. urlCon.setUseCaches(false);
  8. urlCon.setAllowUserInteraction(false);

代码示例来源:origin: org.samba.jcifs/jcifs

  1. private void reconnect() throws IOException {
  2. connection = (HttpURLConnection) connection.getURL().openConnection();
  3. connection.setRequestMethod(method);
  4. headerFields = null;
  5. Iterator properties = requestProperties.entrySet().iterator();
  6. while (properties.hasNext()) {
  7. Map.Entry property = (Map.Entry) properties.next();
  8. String key = (String) property.getKey();
  9. StringBuffer value = new StringBuffer();
  10. Iterator values = ((List) property.getValue()).iterator();
  11. while (values.hasNext()) {
  12. value.append(values.next());
  13. if (values.hasNext()) value.append(", ");
  14. }
  15. connection.setRequestProperty(key, value.toString());
  16. }
  17. connection.setAllowUserInteraction(allowUserInteraction);
  18. connection.setDoInput(doInput);
  19. connection.setDoOutput(doOutput);
  20. connection.setIfModifiedSince(ifModifiedSince);
  21. connection.setUseCaches(useCaches);
  22. }

代码示例来源:origin: plutext/docx4j

  1. URL url = new URL(absoluteURI);
  2. OutputStream urlOutStream = null;
  3. String protocol = url.getProtocol();
  4. URLConnection urlCon = url.openConnection();
  5. urlCon.setDoInput(false);
  6. urlCon.setDoOutput(true);
  7. urlCon.setUseCaches(false);
  8. urlCon.setAllowUserInteraction(false);

相关文章

URLConnection类方法