• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Retrieving parameter from redirected url

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From within the code of the GetOauthCodeServlet, you would call the getParameter method on the HttpServletRequest object.
 
Tapan Agarwal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So the actual problem is figuring out why the servlet is not accessed?
 
Tapan Agarwal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic