本文整理了Java中java.net.URLConnection.setAllowUserInteraction()
方法的一些代码示例,展示了URLConnection.setAllowUserInteraction()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URLConnection.setAllowUserInteraction()
方法的具体详情如下:
包路径:java.net.URLConnection
类名称:URLConnection
方法名:setAllowUserInteraction
[英]Sets allowUserInteraction. Unused by Android.
[中]设置allowUserInteraction。Android没有使用过。
代码示例来源:origin: stackoverflow.com
String addr = "http://172.26.41.18:8080/domain/list";
URL url = new URL(addr);
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
httpCon.setUseCaches(false);
httpCon.setAllowUserInteraction(false);
httpCon.addRequestProperty("Authorization", "Basic YWRtaW4fYFgjkl5463");
System.out.println(httpCon.getResponseCode());
System.out.println(httpCon.getResponseMessage());
代码示例来源:origin: org.codehaus.groovy/groovy
final URLConnection connection = url.openConnection();
if (parameters != null) {
if (parameters.containsKey("connectTimeout")) {
connection.setAllowUserInteraction(DefaultGroovyMethods.asType(parameters.get("allowUserInteraction"), Boolean.class));
代码示例来源:origin: stackoverflow.com
String userPassword = "login:password";
URL url = new URL(ksGateUrl);
// URLConnection urlc = url.openConnection();
URLConnection urlc = new URLConnection(url);
urlc.setDoOutput(true);
urlc.setUseCaches(false);
urlc.setAllowUserInteraction(false);
urlc.setRequestProperty("Authorization",
"Basic " + new sun.misc.BASE64Encoder().encode (userPassword.getBytes()));
urlc.connect();
代码示例来源:origin: stackoverflow.com
URL url = new URL("http","www.google.com");
HttpURLConnection urlc = (HttpURLConnection)url.openConnection();
urlc.setAllowUserInteraction( false );
urlc.setDoInput( true );
urlc.setDoOutput( false );
urlc.setUseCaches( true );
urlc.setRequestMethod("GET");
urlc.connect();
// check you have received an status code 200 to indicate OK
// get the encoding from the Content-Type header
BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream()));
String line = null;
while((line = in.readLine()) != null) {
System.out.println(line);
}
// close sockets, handle errors, etc.
代码示例来源:origin: kebernet/shortyz
private InputStream OpenHttpConnection(URL url, String cookies)
throws IOException {
InputStream in = null;
URLConnection conn = url.openConnection();
if ((cookies != null) && !cookies.trim()
.equals("")) {
conn.setRequestProperty("Cookie", cookies);
}
conn.setAllowUserInteraction(false);
conn.connect();
in = conn.getInputStream();
return in;
}
代码示例来源:origin: stackoverflow.com
HttpURLConnection c = null;
try {
URL u = new URL(url);
c = (HttpURLConnection) u.openConnection();
c.setRequestMethod("GET");
c.setRequestProperty("Content-length", "0");
c.setUseCaches(false);
c.setAllowUserInteraction(false);
c.setConnectTimeout(timeout);
c.setReadTimeout(timeout);
代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core
public InputStream asStream() throws IOException {
URLConnection connection = getURL().openConnection();
connection.setAllowUserInteraction(false);
connection.setUseCaches(true);
return connection.getInputStream();
}
代码示例来源:origin: stackoverflow.com
HttpURLConnection c = null;
try {
URL u = new URL(url);
c = (HttpURLConnection) u.openConnection();
c.setRequestMethod("GET");
c.setRequestProperty("Content-length", "0");
c.setUseCaches(false);
c.setAllowUserInteraction(false);
c.setConnectTimeout(timeout);
c.setReadTimeout(timeout);
代码示例来源:origin: com.numdata/numdata-swing
@Override
@NotNull
public Image getImage()
throws IOException
{
final URLConnection urlConnection = _url.openConnection();
urlConnection.setAllowUserInteraction( false );
urlConnection.setDoInput( true );
urlConnection.setUseCaches( true );
final Image image = (Image)urlConnection.getContent( new Class<?>[] { Image.class } );
if ( image == null )
{
throw new IOException( "Failed to load image from " + _url );
}
return image;
}
代码示例来源:origin: stackoverflow.com
URL url = new URL(INSERT_HERE_YOUR_URL);
String query = INSERT_HERE_YOUR_URL_PARAMETERS;
URLConnection urlc = url.openConnection();
urlc.setAllowUserInteraction(false);
代码示例来源:origin: freenet/fred
@Override
InputStream getInputStream(PluginProgress progress) throws IOException {
URLConnection urlConnection = getSource().openConnection();
urlConnection.setUseCaches(false);
urlConnection.setAllowUserInteraction(false);
//urlConnection.connect();
return openConnectionCheckRedirects(urlConnection);
}
代码示例来源:origin: stackoverflow.com
int response = -1;
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
httpConn.setAllowUserInteraction(false);
httpConn.setInstanceFollowRedirects(true);
httpConn.setRequestMethod("GET");
代码示例来源:origin: stackoverflow.com
public String getpage(URL url)
{
try {
// try opening the URL
URLConnection urlConnection = url.openConnection();
urlConnection.setAllowUserInteraction(false);
InputStream urlStream = url.openStream();
byte buffer[] = new byte[1000];
int numRead = urlStream.read(buffer);
String content = new String(buffer, 0, numRead);
while ((numRead != -1) && (content.length() < MAX_PAGE_SIZE)) {
numRead = urlStream.read(buffer);
if (numRead != -1) {
String newContent = new String(buffer, 0, numRead);
content += newContent;
}
}
return content;
} catch (IOException e) {
e.printTrackStace();
}catch(IndexOutOfBoundsException e1){
e1.printTrackStace();
}
}
代码示例来源:origin: robovm/robovm
URL url = new URL(absoluteURI);
OutputStream urlOutStream = null;
String protocol = url.getProtocol();
URLConnection urlCon = url.openConnection();
urlCon.setDoInput(false);
urlCon.setDoOutput(true);
urlCon.setUseCaches(false);
urlCon.setAllowUserInteraction(false);
代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core
public long lastModified() {
try {
URLConnection connection = getURL().openConnection();
connection.setAllowUserInteraction(false);
connection.setUseCaches(true);
connection.setIfModifiedSince(mLastModified);
mLastModified = connection.getLastModified();
}
catch (IOException ignore) {
}
return mLastModified;
}
}
代码示例来源:origin: plutext/docx4j
URL url = new URL(absoluteURI);
OutputStream urlOutStream = null;
String protocol = url.getProtocol();
URLConnection urlCon = url.openConnection();
urlCon.setDoInput(false);
urlCon.setDoOutput(true);
urlCon.setUseCaches(false);
urlCon.setAllowUserInteraction(false);
代码示例来源:origin: IanDarwin/javasrc
public static String converse(URL url, String postBody) throws IOException {
URLConnection conn = url.openConnection();
boolean post = postBody != null;
if (post)
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setAllowUserInteraction(true);
conn.connect();
if (post) {
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.println(postBody);
out.close(); // Important!
}
StringBuilder sb = new StringBuilder();
BufferedReader in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
sb.append(line);
}
in.close();
return sb.toString();
}
}
代码示例来源:origin: robovm/robovm
URL url = new URL(absoluteURI);
OutputStream urlOutStream = null;
String protocol = url.getProtocol();
URLConnection urlCon = url.openConnection();
urlCon.setDoInput(false);
urlCon.setDoOutput(true);
urlCon.setUseCaches(false);
urlCon.setAllowUserInteraction(false);
代码示例来源:origin: org.samba.jcifs/jcifs
private void reconnect() throws IOException {
connection = (HttpURLConnection) connection.getURL().openConnection();
connection.setRequestMethod(method);
headerFields = null;
Iterator properties = requestProperties.entrySet().iterator();
while (properties.hasNext()) {
Map.Entry property = (Map.Entry) properties.next();
String key = (String) property.getKey();
StringBuffer value = new StringBuffer();
Iterator values = ((List) property.getValue()).iterator();
while (values.hasNext()) {
value.append(values.next());
if (values.hasNext()) value.append(", ");
}
connection.setRequestProperty(key, value.toString());
}
connection.setAllowUserInteraction(allowUserInteraction);
connection.setDoInput(doInput);
connection.setDoOutput(doOutput);
connection.setIfModifiedSince(ifModifiedSince);
connection.setUseCaches(useCaches);
}
代码示例来源:origin: plutext/docx4j
URL url = new URL(absoluteURI);
OutputStream urlOutStream = null;
String protocol = url.getProtocol();
URLConnection urlCon = url.openConnection();
urlCon.setDoInput(false);
urlCon.setDoOutput(true);
urlCon.setUseCaches(false);
urlCon.setAllowUserInteraction(false);
内容来源于网络,如有侵权,请联系作者删除!