✍️
Notes.md
  • Table of contents
  • React.Js
    • React Hooks
    • Old :- React : Using Classes
  • Blockchain
    • Solidity
    • Custom ERC20 token
    • Contract
  • Tools and Tech
    • Docker
    • Git version Control
  • Java
    • Data & Data Types
    • IO in Java
    • Data Structures
      • Array in Java
      • Collections in Java
      • Map in Java
      • Enums in Java
      • Linked List in Java
      • List in Java
      • Queues & Stacks
      • Set in Java
      • TreeSet and TreeMap
    • Object Oriented Programming
      • Object Class Methods and Constructor
      • Immutable Class & Objects
      • Constructors
      • Visibility
      • Generics
    • Threads in Java
    • Useful Stuff Java
      • Lambda & Stream
    • Keywords in Java
      • Annotations
      • Comparators
      • Packages in Java
    • Miscellaneous
    • Articles to refer to
  • Golang
    • Competitive Programming in Go
    • Testing simple web server
    • Learning Go : Part 1
    • Maps vs slices
    • Golang Garbage Collector 101
    • Things Golang do differently
    • Go Things
  • Linux
    • Shell programming
    • Linux Commands Part 1 - 4
    • Linux Commands Part 5 - 8
    • Linux Commands Part 9 - 10
  • Software Design
    • Solid Design
    • OOPS
    • Design Patterns
      • Creational Design Pattern
        • Builder DP
        • Factory DP
        • Singleton DP
      • Adapter DP
      • Bridge DP
      • Iterator DP
      • State DP
      • Strategy DP
      • Behavioral Design Pattern
        • Observer DP
      • Structural Design Pattern
        • Facade DP
  • Cloud
    • Google Cloud Platform
      • GCP Core Infrastructure
      • Cloud Networking
  • Spring Boot
    • Spring Basics
      • Spring Beans
      • Important Annotations
      • Important Spring Things
      • Maven Things
      • Spring A.O.P
    • Spring Boot Controller
      • Response Entity Exception Handling
    • Spring Things
    • Spring MVC
    • Spring Data
      • Redis
      • Spring Data JPA
      • JDBC
    • Apache Camel
  • Miscellaneous
    • Troubleshooting and Debugging
Powered by GitBook
On this page

Was this helpful?

  1. Java

Miscellaneous

Sending a Request

@Bean
public void SendRequest() throws IOException {
		OkHttpClient client = new OkHttpClient().newBuilder()
				.build();

		String idToken = "eyJhbGciOiJSUzI1NiIsImtpZCI6ImQ0ZTA2Y2ViMjJiMDFiZTU2YzIxM2M5ODU0MGFiNTYzYmZmNWE1OGMiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiYXpwIjoiNzM4MTYzMTE5NDU3LTZlb2k0bjVoaWEya2dkbHRzNWdyOWViNXQ5aWxidHRjLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiYXVkIjoiNzM4MTYzMTE5NDU3LTZlb2k0bjVoaWEya2dkbHRzNWdyOWViNXQ5aWxidHRjLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwic3ViIjoiMTA1MjMwOTI2NTAzNjg2Njg5NzgxIiwiZW1haWwiOiJ5YWRhdjExN3VkYXlAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImF0X2hhc2giOiIwamdyNUY5WmZ0azJZb2hPX0JyWE9RIiwiaWF0IjoxNjM4MDIxOTA1LCJleHAiOjE2MzgwMjU1MDV9.NMBQ3UpmkUzNeE3mhU29IcszLxZ04lyscpYQzgyuczbYdA3-OJ8qHxUCWkNMPcjitDu9E8KonK8DkwVhJmI0n5TkNAxZkvgxxlhiErQvpGv63s3QldRjTsnvXQw-J_V_OhmOyGLo5JStFu8m90tjrIE-m2f8parrqhz3tb31fhDeLhdHJWcVm2B9l5B9hjz3BpVCf08va0ucC6E9MdE1gWuxc9CyyFi7fzk4TI0B-5-up1inbKVPEXuO2i50SGS1IMM8kLCNREaQth5VLJgHGnkyS_X-5x-gofb7k7raOJs_UibjpdEeQzhFHNUNjAWkdwxNiJcVstpE7M1kCTgztQ";
		String url = "https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=" + idToken;

		System.out.println(url);

		Request request = new Request.Builder()
				.url(url)
				.method("GET", null)
				.build();
		Response response = client.newCall(request).execute();
		System.out.println(response.body().string());

}

// POM.XML

<dependency>
			<groupId>com.squareup.okhttp3</groupId>
			<artifactId>okhttp</artifactId>
			<version>4.1.0</version>
</dependency>
PreviousPackages in JavaNextArticles to refer to

Last updated 3 years ago

Was this helpful?