• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving parameter from redirected url

 
Tapan Agarwal
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have a link -

https://abc.com/oauth/o/authorize?client_id=7b3fe4ba-3c3d-4fbf-9304&redirect_uri=http://localhost:4500/GetOauthCodeServlet.html&state=t&scope=learner


This link does some authorization and then redirect to the url provided in parameter.It also appends a parameter "code" to the redirect URL.So the redirect url looks like-
http://localhost:4500/GetOauthCodeServlet.html?code=oauth_7aaaaaa3d694a3b&state=t


I am working on retrieving the parameter "code" using java codes.

Any idea on this can be achieved?
 
Tim Moores
Saloon Keeper
Posts: 3326
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From within the code of the GetOauthCodeServlet, you would call the getParameter method on the HttpServletRequest object.
 
Tapan Agarwal
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:From within the code of the GetOauthCodeServlet, you would call the getParameter method on the HttpServletRequest object.




I used the code-



In GetOauthCodeServlet.java  I have used -



The problem is GetOauthCodeServlet.java never gets invoked.The same works fine when I try with my browser.

 
Tim Moores
Saloon Keeper
Posts: 3326
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the actual problem is figuring out why the servlet is not accessed?
 
Tapan Agarwal
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:So the actual problem is figuring out why the servlet is not accessed?



Yup
 
Tim Moores
Saloon Keeper
Posts: 3326
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the value of getStatus? Is the HttpClient set up to do redirects automatically? I think that's the default, but better to make sure.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!