shakila 6 anos atrás
pai
commit
5254195520

+ 3
- 1
.idea/misc.xml Ver arquivo

7
       </list>
7
       </list>
8
     </option>
8
     </option>
9
   </component>
9
   </component>
10
-  <component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
10
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
11
+    <output url="file://$PROJECT_DIR$/classes" />
12
+  </component>
11
 </project>
13
 </project>

+ 1
- 1
.idea/modules.xml Ver arquivo

2
 <project version="4">
2
 <project version="4">
3
   <component name="ProjectModuleManager">
3
   <component name="ProjectModuleManager">
4
     <modules>
4
     <modules>
5
-      <module fileurl="file://$PROJECT_DIR$/.idea/ZCW-Fido-URLFetch.iml" filepath="$PROJECT_DIR$/.idea/ZCW-Fido-URLFetch.iml" />
5
+      <module fileurl="file://$PROJECT_DIR$/ZCW-Fido-URLFetch.iml" filepath="$PROJECT_DIR$/ZCW-Fido-URLFetch.iml" />
6
     </modules>
6
     </modules>
7
   </component>
7
   </component>
8
 </project>
8
 </project>

+ 1
- 1
.idea/vcs.xml Ver arquivo

1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
 <project version="4">
2
 <project version="4">
3
   <component name="VcsDirectoryMappings">
3
   <component name="VcsDirectoryMappings">
4
-    <mapping directory="" vcs="Git" />
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
   </component>
5
   </component>
6
 </project>
6
 </project>

.idea/ZCW-Fido-URLFetch.iml → ZCW-Fido-URLFetch.iml Ver arquivo

5
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
5
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
     <content url="file://$MODULE_DIR$">
6
     <content url="file://$MODULE_DIR$">
7
       <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
7
       <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9
-      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10
       <excludeFolder url="file://$MODULE_DIR$/target" />
8
       <excludeFolder url="file://$MODULE_DIR$/target" />
11
     </content>
9
     </content>
12
     <orderEntry type="inheritedJdk" />
10
     <orderEntry type="inheritedJdk" />

+ 24
- 4
src/main/java/Main.java Ver arquivo

1
+import java.net.URL;
2
+import java.net.URLConnection;
3
+import java.util.Scanner;
4
+
1
 public class Main {
5
 public class Main {
2
     public static void main(String[] args) {
6
     public static void main(String[] args) {
3
-        //ask for a url
4
-        // fetch the url
5
-        // print the url
7
+            System.out.println("Enter an URl");
8
+            Scanner scanner = new Scanner(System.in);
9
+            String url = scanner.nextLine().trim();
10
+            //ask for a url
11
+            System.out.println("Fetching " + url);
12
+            // fetch the url
13
+            String content = null;
14
+            URLConnection connection = null;
15
+            try {
16
+                connection =  new URL("https://"+url).openConnection();
17
+                scanner = new Scanner(connection.getInputStream());
18
+                scanner.useDelimiter("\\Z");
19
+                content = scanner.next();
20
+            }catch ( Exception ex ) {
21
+                ex.printStackTrace();
22
+            }
23
+            System.out.println(content);
24
+            //print url
25
+        }
26
+
6
     }
27
     }
7
-}

BIN
target/classes/Main.class Ver arquivo