I'm attempting to open this uri

https://some-host/a/getmeta?id=10  (this url is passed to proxi.jsp page)

.. however it redirects to authentication service (on https) which advertisements popping a box for password...and when on browser.. after that it needs you to definitely key-within the qualifications.. also it then returns towards the first link i had been attempting to open and shows this content... so i wish to realize that if this intermediate redirect to authentication service happens.. how do you enter my password to that particular popup through code.. I'm attempting to use apache HttpClient to get this done...

This really is my proxi.jsp code that is making the request..

<%@ page language="java" import="
java.util.Collection,
org.apache.commons.httpclient.HttpClient,
org.apache.commons.httpclient.UsernamePasswordCredentials,
org.apache.commons.httpclient.auth.AuthScope,
org.apache.commons.httpclient.methods.GetMethod"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<%
try {
String a_Url = request.getParameter( "url" ) ;

HttpClient client = new HttpClient();
client.getState().setCredentials(
    new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, "realm"),
    new UsernamePasswordCredentials("test", "pass")
);

GetMethod get = new GetMethod(a_Url);
get.setDoAuthentication( true );
try {
    int status = client.executeMethod( get );
    out.println(status + "\n" + get.getResponseBodyAsString());
} finally {
     get.releaseConnection();
}
} catch (Throwable t) {
    t.printStackTrace();
}   

%>

And this is actually the error I get:-

org.apache.commons.httpclient.InvalidRedirectLocationException: Invalid redirect
 location: https://login.somehost.com/siteminderagent/nocert/1309460767/smgetcre
d.scc?TYPE=16777217&REALM=-SM-Documentum%20[12%3a06%3a07%3a4932]&SMAUTHREASON=0&
METHOD=GET&SMAGENTNAME=-SM-6D9yKpar83ASDc5Sb4KDjZtHgfZId%2fYHFKbzwYvx5EUeGMi0dOa
uGVx6wOk1daI3&TARGET=-SM-http%3A%2F%2Fsome-host%2Fa%2Fgetmeta%3Fid%3D10
        at org.apache.commons.httpclient.HttpMethodDirector.processRedirectRespo
nse(HttpMethodDirector.java:619)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMe
thodDirector.java:179)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:397)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:323)
        at org.apache.jsp.proxi_jsp._jspService(org.apache.jsp.proxi_jsp:64)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:389)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:4
86)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511
)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
90)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav
a:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1
82)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:7
65)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)

        at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
        at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
        at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(Normal
RewrittenUrl.java:213)
        at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.j
ava:171)
        at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:14
5)
        at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewri
ter.java:92)
        at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewrit
eFilter.java:381)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1157)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainI
nvocation.java:67)
        at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilte
rPipeline.java:122)
        at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1157)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
88)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav
a:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1
82)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:7
65)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)

        at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHand
lerCollection.java:230)
        at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.
java:114)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
52)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:53
6)
        at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpCo
nnection.java:915)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.ja
va:409)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.j
ava:582)
Caused by: org.apache.commons.httpclient.URIException: Invalid query
        at org.apache.commons.httpclient.URI.parseUriReference(URI.java:2049)
        at org.apache.commons.httpclient.URI.<init>(URI.java:147)
        at org.apache.commons.httpclient.HttpMethodDirector.processRedirectRespo
nse(HttpMethodDirector.java:601)
        ... 44 more

And When I attempt to paste this url

https://login.somehost.com/siteminderagent/nocert/1309460767/smgetcre
d.scc?TYPE=16777217&REALM=-SM-Documentum%20[12%3a06%3a07%3a4932]&SMAUTHREASON=0&
METHOD=GET&SMAGENTNAME=-SM-6D9yKpar83ASDc5Sb4KDjZtHgfZId%2fYHFKbzwYvx5EUeGMi0dOa
uGVx6wOk1daI3&TARGET=-SM-http%3A%2F%2Fsome-host%2Fa%2Fgetmeta%3Fid%3D10

back around the browser i quickly obtain a appear window for authentication and when I write my password for the reason that window i quickly obtain the actual content that i'm searching for. Can there be any header that I must pass in proxi.jsp page. Because passing password within the page isn't the easiest method to get it done..Or other way. Any suggestions is going to be appreciated..