Link to home
Create AccountLog in
Avatar of cgray1223
cgray1223

asked on

HTTP POST to Spring Security Filter

Hello,

I have created a custom Spring Security filter that gets executed based off a request to a certain url path within my application.  I have an external site that needs to send me a HTTP POST and I need to use that xml data inside my Security filter in order to validate a user.  How do I pull that xml posted data off the request?
Avatar of Sathish David  Kumar N
Sathish David Kumar N
Flag of India image

Avatar of cgray1223
cgray1223

ASKER

I think the best approach is to just pull the body off the HttpServletRequest as you have access to that in the Filter.  I was looking for a nice library to take the xml response body and map it to a Java Object graph, any ideas there?
>>any ideas there?

XMLBeans,
Commons Digester,
JAXB

It really depends on what the xml is like and what you want to capture
> I think the best approach is to just pull the body off the HttpServletRequest as you have access to that in the Filter

you would be calling the external site wouldn't you?  Which means you won't have a HttpServletRequest, and are instead sending a POST request
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
the external site is posting to me, so why wont I have the HttpServetRequest?  Basically, they'll have a link into http://app/xml_security_check where xml_security_check maps to my filter.  I should be able to pull the object from the request body in the filter right?
do you have schema for the xml
no, but I know what it looks like so I can model a java object structure just like it.  schema may be overkill....
having the schema makes it easy :)

what do you need to pull out of the xml?
I'm going to use jaxb to marshall it to an object then deal with it that way i guess...
that can get a bit painful without a schema, let me know if you need a hand.