Advertisement
Pedro_Rocha

Untitled

Oct 16th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. StringBuilder string = null;
  2.  
  3. try {
  4.  
  5.     URL url = new URL ("https://www.example.com/info“);
  6.     BufferedReader buffer = new BufferedReader ( new InputStreamReader ( url.openStream ( ) ) );
  7.  
  8.     String line;
  9.  
  10.     string = new StringBuilder ( );
  11.  
  12.     while ( ( line = buffer.readLine ( ) ) != null ) {
  13.  
  14.         string.append ( line );
  15.         string.append ( System.lineSeparator ( ) );
  16.     }
  17.  
  18.     RequestDispatcher response = request.getRequestDispatcher ( string );
  19.  
  20.     } catch ( Exception error ) {
  21.  
  22.         System.err.println ( error.toString ( ) );
  23.  
  24.     }
  25.  
  26.     buffer.close ( );
  27.  
  28. }
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. StringBuilder string = null;
  37.  
  38. try {
  39.  
  40.     URL url = new URL ("https://www.example.com/info“);
  41.     BufferedReader buffer = new BufferedReader ( new InputStreamReader ( url.openStream ( ) ) );
  42.  
  43.     String line;
  44.  
  45.     string = new StringBuilder ( );
  46.  
  47.     while ( ( line = buffer.readLine ( ) ) != null ) {
  48.  
  49.         string.append ( line );
  50.         string.append ( System.lineSeparator ( ) );
  51.     }
  52.  
  53.     if ( user.hasPermission ( user, eq("read") ) ).thenReturn ( true, false ) )
  54.         RequestDispatcher response = request.getRequestDispatcher ( string );
  55.  
  56.     } catch ( Exception error ) {
  57.  
  58.         System.err.println ( error.toString ( ) );
  59.  
  60.     }
  61.  
  62.     buffer.close ( );
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement