# Access to http request in plugin

**URL:** <https://discuss.elastic.co/t/access-to-http-request-in-plugin/11138>\
**Category:** Elasticsearch\
**Created:** [March 13, 2013, 2:06pm UTC](https://discuss.elastic.co/t/access-to-http-request-in-plugin/11138 "2013-03-13T14:06:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric\_sanford](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@eric\_sanford](https://discuss.elastic.co/u/eric_sanford)\
**Post date:** [March 13, 2013, 2:06pm UTC](https://discuss.elastic.co/t/access-to-http-request-in-plugin/11138/1 "2013-03-13T14:06:14Z")

</div>

Hello

I am writing a security plugin and in the body of the incoming HTTP request  
is user information provided by SiteMinder

I know i can access the raw bytes of the request body using the (  
request.content().array() call from the RestRequest object

but my question is..is there a simpler way to get access to the request  
parameters...

In other words... is there a "java like" way similar to  
HTTPRequest.getParameter("SM\_USER");

thanks !!!!!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 13, 2013, 2:25pm UTC](https://discuss.elastic.co/t/access-to-http-request-in-plugin/11138/2 "2013-03-13T14:25:44Z")

</div>

Hey,

RestRequest.params() or RestRequest.param("yourParam") might help you

--Alexander

On Wed, Mar 13, 2013 at 3:06 PM, eric sanford  
[pcstechnologiesinc@gmail.com](mailto:pcstechnologiesinc@gmail.com)wrote:

> Hello
> 
> I am writing a security plugin and in the body of the incoming HTTP  
> request is user information provided by SiteMinder
> 
> I know i can access the raw bytes of the request body using the (  
> request.content().array() call from the RestRequest object
> 
> but my question is..is there a simpler way to get access to the request  
> parameters...
> 
> In other words... is there a "java like" way similar to  
> HTTPRequest.getParameter("SM\_USER");
> 
> thanks !!!!!
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![eric\_sanford](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@eric\_sanford](https://discuss.elastic.co/u/eric_sanford)\
**Post date:** [March 13, 2013, 4:43pm UTC](https://discuss.elastic.co/t/access-to-http-request-in-plugin/11138/3 "2013-03-13T16:43:57Z")

</div>

thanks...

it seems that params doesnt get request body params... only path and query  
params

On Wednesday, March 13, 2013 9:06:14 AM UTC-5, eric sanford wrote:

> Hello
> 
> I am writing a security plugin and in the body of the incoming HTTP  
> request is user information provided by SiteMinder
> 
> I know i can access the raw bytes of the request body using the (  
> request.content().array() call from the RestRequest object
> 
> but my question is..is there a simpler way to get access to the request  
> parameters...
> 
> In other words... is there a "java like" way similar to  
> HTTPRequest.getParameter("SM\_USER");
> 
> thanks !!!!!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 13, 2013, 4:55pm UTC](https://discuss.elastic.co/t/access-to-http-request-in-plugin/11138/4 "2013-03-13T16:55:33Z")

</div>

Hey,

well, the problem ist, that a web application actually knows that the body  
consists of parameters by checking HTTP headers. This does not work with  
elasticsearch (there might actually be JSON in it, as it is in most cases).

Anyway, if you writing your own plugin, you could just call  
RestUtils.decodeQueryString(String s, int fromIndex, Map\<String, String\>  
params)  
in your own code and hand over the request body to the method.

--Alex

On Wed, Mar 13, 2013 at 5:43 PM, eric sanford  
[pcstechnologiesinc@gmail.com](mailto:pcstechnologiesinc@gmail.com)wrote:

> thanks...
> 
> it seems that params doesnt get request body params... only path and query  
> params
> 
> On Wednesday, March 13, 2013 9:06:14 AM UTC-5, eric sanford wrote:
> 
> > Hello
> > 
> > I am writing a security plugin and in the body of the incoming HTTP  
> > request is user information provided by SiteMinder
> > 
> > I know i can access the raw bytes of the request body using the (  
> > request.content().array() call from the RestRequest object
> > 
> > but my question is..is there a simpler way to get access to the request  
> > parameters...
> > 
> > In other words... is there a "java like" way similar to  
> > HTTPRequest.getParameter("SM\_\*\*USER");
> > 
> > thanks !!!!!
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![eric\_sanford](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@eric\_sanford](https://discuss.elastic.co/u/eric_sanford)\
**Post date:** [March 13, 2013, 5:16pm UTC](https://discuss.elastic.co/t/access-to-http-request-in-plugin/11138/5 "2013-03-13T17:16:09Z")

</div>

yes that is what i am doing

thanks!!!

On Wednesday, March 13, 2013 9:06:14 AM UTC-5, eric sanford wrote:

> Hello
> 
> I am writing a security plugin and in the body of the incoming HTTP  
> request is user information provided by SiteMinder
> 
> I know i can access the raw bytes of the request body using the (  
> request.content().array() call from the RestRequest object
> 
> but my question is..is there a simpler way to get access to the request  
> parameters...
> 
> In other words... is there a "java like" way similar to  
> HTTPRequest.getParameter("SM\_USER");
> 
> thanks !!!!!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:46am UTC](https://discuss.elastic.co/t/access-to-http-request-in-plugin/11138/6 "2017-07-06T02:46:39Z")

</div>


