aspose file tools*
The moose likes Servlets and the fly likes passing url(with parameters) as a parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "passing url(with parameters) as a parameter" Watch "passing url(with parameters) as a parameter" New topic
Author

passing url(with parameters) as a parameter

axel garcia
Greenhorn

Joined: Sep 02, 2009
Posts: 8
Have servlet that parses a url feed which takes parameters in the form of:
http://theirsite/xfeeds/feed1?q=99&p=2345
Basically, my parser will get the contents by creating a URL object and reading the output lines.

i've tried the form http://mysite/parser/myparser1?url=http://xfeeds/feed1?q=99&p=2345,
but this one chops off the url parameter after q=99, after hitting the "&".
i've tried http://mysite/parser/myparser1?url='http://xfeeds/feed1?q=99&p=2345',
but this one treats the first apostrophe as part of the url parameter and my URL blows up.

anybody tried this? any suggestions?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

Values should always be URL-encoded, especially other URLs.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
axel garcia
Greenhorn

Joined: Sep 02, 2009
Posts: 8
Bear Bibeault wrote:Values should always be URL-encoded, especially other URLs.


thank you for the useless comment. pontificate somewhere else. how do i filter you out?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29241
    
139

Axel,
Bear was giving you the answer. You need to encode the "?" and "&" in the url parameter so they don't get treated as separate parameters.

Let's also keep in mind the rule of this forum is to be nice. Saying someone's comment is useless isn't nice. And Bear is one of the moderators of this forum - a moderator isn't likely to give useless comments.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: passing url(with parameters) as a parameter
 
Similar Threads
Web.xml Question - Map Servlet
encrypted parameters
Proxy Server in Java
Multiple responses to a request
Request parameter is missing