Hi there,
to get _any_ http header, you can do:
Form form = (Form) request.getAttributes("org.restlet.http.headers");
String someHeader = form.getFirstValue("a-header");
Or something like that (wrote from top of my head, maybe wrong with
some method name but the idea is clear I hope).
The REMOTE_USER env variabla by
http://hoohoo.ncsa.uiuc.edu/cgi/env.html represents the
_authenticated_ user. That means, that REMOTE_USER will contain the
username that is an _authenticated_ request using. In restlet, you can
get that information like this:
String username = request.getChallengeResponse().getIdentifier();
Meaning: a HTTP Response will contain ChallengeResponse (either as
response to server's 401 or is doing a "preemptive" authentication).
Restlet will get the username for you, whatever auth is used (BASIC,
DIGEST, ...).
Hope helps,
~t~
On Fri, Feb 20, 2009 at 3:52 AM, dtanner <
dtanner@...> wrote:
>
> Hi,
>
>
>
> I already tried:
>
> request.getAttributes().get( "REMOTE_USER" )
>
> this returns null.
>
>
>
> Any other ideas? I'm at a loss.
>
>
>
> David
>
>
>
> David Tanner
>
> Massachusetts Institute of Technology
>
> Information Services and Technology
>
> W92-144
>
>
dtanner@...
>
> 617-253-0110
>
>
>
> ________________________________
>
> From:
t.cservenak@... [mailto:
t.cservenak@...] On Behalf Of Tamás Cservenák
> Sent: Thursday, February 19, 2009 9:08 PM
> To:
nexus-dev@...
> Subject: Re: [nexus-dev] HTTP request header
>
>
>
> Hi,
>
>
>
> something like this?
>
>
>
>
http://www.restlet.org/documentation/1.1/api/org/restlet/data/Message.html#getAttributes()
>
>
>
> See the attribute "org.restlet.http.headers"...
>
>
>
> ~t~
>
>
>
> On Fri, Feb 20, 2009 at 3:07 AM, dtanner <
dtanner@...> wrote:
>
> I would love to get rid of:
>
>
>
> HttpServletRequest servletRequest = ((ServletCall)((HttpRequest)request).getHttpCall()).getRequest();
>
>
>
> And replace it with:
>
>
>
> request.getAttributes().get( "value" )
>
>
>
> However, I have to get the apache REMOTE_USER environmental variable and the only way that I've been able to do this is by using:
>
>
>
> HttpServletRequest servletRequest = ((ServletCall)((HttpRequest)request).getHttpCall()).getRequest();
>
> String Username = (String)servletRequest.getRemoteUser();
>
>
>
> If you know of a way that is equivalent to the above using request.getAttributes().get( "value" ) or by any other means, I'm all ears!
>
>
>
> Have any ideas?
>
>
>
> David
>
>
>
> David Tanner
>
> Massachusetts Institute of Technology
>
> Information Services and Technology
>
> W92-144
>
>
dtanner@...
>
> 617-253-0110
>
>
>
> ________________________________
>
> From:
t.cservenak@... [mailto:
t.cservenak@...] On Behalf Of Tamás Cservenák
> Sent: Thursday, February 19, 2009 2:32 PM
> To:
nexus-dev@...
> Subject: Re: [nexus-dev] HTTP request header
>
>
>
> Well,
>
>
>
> the code seems right (albeit dirty as I warned you) :)
>
>
>
> Only thing I can say: the header is not there. Are you sure that you put the header into the _incoming_ request? Isn't that coming from the response header you send out to do the auth? (if I understood correctly).
>
>
>
> Ie. Maven will never send an email in header, when requesting an artifact :)
>
>
>
> ~t~
>
> On Thu, Feb 19, 2009 at 8:25 PM, dtanner <
dtanner@...> wrote:
>
> I'm using nexus 1.2.1 war with apache 2.2.3 and Tomcat 5.5.25.
>
>
>
> I need to get header information from the initial HTTP request. I'm doing the following:
>
>
>
> HttpServletRequest servletRequest = ((ServletCall)((HttpRequest)request).getHttpCall()).getRequest();
>
> String email = (String)servletRequest.getHeader("Shib-InetOrgPerson-mail");
>
>
>
> I should be getting an email address, but instead I'm getting a null.
>
>
>
> I know I should be getting an email address because I wrote a simple jsp test web application (and deployed the test to that same container that nexus is deployed to) to test the header.
>
>
>
> I'm doing something wrong. Any ideas?
>
>
>
> David
>
>
>
> David Tanner
>
> Massachusetts Institute of Technology
>
> Information Services and Technology
>
> W92-144
>
>
dtanner@...
>
> 617-253-0110
>
>
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail:
nexus-dev-unsubscribe@...
For additional commands, e-mail:
nexus-dev-help@...