abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: Issue with Servlet and missing context in URI
Date Wed, 29 Aug 2007 15:40:10 GMT
In 0.3.0, the Target Resolver mechanism was modified so that resolvers
could be implementing independently of the application context path.
You'll need to tweak your regex patterns so that they account for the
change.

- James

Chris Berry wrote:
> Greetings,
> 
> With current SVN HEAD I am seeing different behavior at the
> RegexTargetResolver.
> After a string of ServletFilters (using Acegi Security), I used to get a
> URI that contained the Servlet Context (in my case /hcdata)
> So I would get: uri= /hcdata/v1/rentals/trips/2797.en.xml
> But now I get: uri= /v1/rentals/trips/2797.en.xml
> 
> Of course, my TargetResolver now fails, since the "match patterns"
> contain the Servlet Context,
> which is how stuff works without the ServetFilters in line. (as shown
> below)
> 
> Am I doing something wrong??
> Any help would be greatly appreciated.
> Thanks,
> -- Chris
> 
> =====================================================================================================
> 
> NOW (with ServletFilters)
> =====
> 
> DEBUG - bstractSecurityInterceptor - Secure object: FilterInvocation:
> URL: /v1/rentals/trips/2797.en.xml; ConfigAttributes:
> [ROLE_RENTALS_TRIPS_READER]
> DEBUG - bstractSecurityInterceptor - Previously Authenticated:
> org.acegisecurity.providers.UsernamePasswordAuthenticationToken@fd17d6b8:
> Username: org.acegisecurity.userdetails.User@d3cb600: Username: marissa;
> Password: [PROTECTED]; Enabled: true; AccountNonExpired: true;
> credentialsNonExpired: true; AccountNonLocked: true; Granted
> Authorities: ROLE_RENTALS_TRIPS_READER, ROLE_RENTALS_TRIPS_WRITER;
> Password: [PROTECTED]; Authenticated: true; Details:
> org.acegisecurity.ui.WebAuthenticationDetails@957e: RemoteIpAddress:
> 127.0.0.1; SessionId: null; Granted Authorities:
> ROLE_RENTALS_TRIPS_READER, ROLE_RENTALS_TRIPS_WRITER
> DEBUG - bstractSecurityInterceptor - Authorization successful
> DEBUG - bstractSecurityInterceptor - RunAsManager did not change
> Authentication object
> DEBUG - FilterChainProxy           - /v1/rentals/trips/2797.en.xml
> reached end of additional filter chain; proceeding with original chain
> DEBUG - DefaultServiceContext      - Returning
> org.apache.abdera.protocol.server.impl.SimpleSubjectResolver@623f3e as
> instance of {1}.
> +++++++++++++> HttpServletRequestContext: CTOR  targetResolver=
> com.homeaway.hcdata.store.beans.ConfigurableRegexTargetResolver@ba5839
> <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  this=
> com.homeaway.hcdata.store.beans.ConfigurableRegexTargetResolver@ba5839
> <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  uri=
> /v1/rentals/trips/2797.en.xml <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/([^/#?]+)\?[\w-]+=[\w-:.]+(&[\w-]+=[\w-:.]+)?
> <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/([^/#?]+) <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/?\?[\w-]+=[\w-:.]+(&[\w-]+=[\w-:.]+)?
> <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/([^/#?]+)/?[\d]+ <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/? <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/([^/#?]+)/?[\d]+\?[\w-]+=[\w-:.]+(&[\w-]+=[\w-:.]+)?
> <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/? <++++++++++++++
> +++++++++++++> HttpServletRequestContext: CTOR  target= null
> <++++++++++++++
> DEBUG - DefaultServiceContext      - Returning
> org.apache.abdera.protocol.server.impl.DefaultRequestHandlerManager@3579e0
> as instance of {1}.
> DEBUG - AbderaServlet              - Processing request
> DEBUG - AbderaServlet              - Handler -
> org.apache.abdera.protocol.server.impl.DefaultRequestHandler@c0b403
> +++++++++++++> AbstractRequestHandler process START<++++++++++++++
> DEBUG - AbstractRequestHandler     - Processing the request
> DEBUG - AbstractRequestHandler     - Using provider:
> com.homeaway.hcdata.store.StoreProvider@6a4d0a
> +++++++++++++> testing preconditions <++++++++++++++
> +++++++++++++> preconditions: NULL target <++++++++++++++
> DEBUG - header                     - << "HTTP/1.1 404 Not Found[\r][\n]"
> DEBUG - header                     - << "Content-Type: text/html;
> charset=iso-8859-1[\r][\n]"
> DEBUG - header                     - << "Content-Length: 1412[\r][\n]"
> DEBUG - AbstractRequestHandler     - Releasing provider:
> com.homeaway.hcdata.store.StoreProvider@6a4d0a
> DEBUG - AbderaServlet              - Releasing handler -
> org.apache.abdera.protocol.server.impl.DefaultRequestHandler@c0b403
> 
> =====================================================================================================
> 
> BEFORE (0.3 from a few weeks ago... -- using Servlet Filters)
> =========
> 
> DEBUG - bstractSecurityInterceptor - Secure object: FilterInvocation:
> URL: /v1/rentals/trips/2797.en.xml; ConfigAttributes: [ROLE_SUPERVISOR]
> DEBUG - bstractSecurityInterceptor - Previously Authenticated:
> org.acegisecurity.providers.UsernamePasswordAuthenticationToken@af4bbed9:
> Username: org.acegisecurity.userdetails.User@bc4300: Username: marissa;
> Password: [PROTECTED]; Enabled: true; AccountNonExpired: true;
> credentialsNonExpired: true; AccountNonLocked: true; Granted
> Authorities: ROLE_SUPERVISOR; Password: [PROTECTED]; Authenticated:
> true; Details: org.acegisecurity.ui.WebAuthenticationDetails@957e:
> RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities:
> ROLE_SUPERVISOR
> DEBUG - bstractSecurityInterceptor - Authorization successful
> DEBUG - bstractSecurityInterceptor - RunAsManager did not change
> Authentication object
> DEBUG - FilterChainProxy           - /v1/rentals/trips/2797.en.xml
> reached end of additional filter chain; proceeding with original chain
> DEBUG - SpringAbderaServlet        - context =
> com.homeaway.hcdata.server.SpringBasedServiceContext@85d94
> DEBUG - SpringAbderaServlet        - manager =
> org.apache.abdera.protocol.server.servlet.DefaultRequestHandlerManager@37a013
> 
> DEBUG - SpringAbderaServlet        - handler =
> org.apache.abdera.protocol.server.servlet.DefaultRequestHandler@ee667c
> ????????? RegexTargetResolver.resolve():: uri=
> /hcdata/v1/rentals/trips/2797.en.xml
> ????????? RegexTargetResolver.resolve():: MATCH
> ????????????DefaultRequestHandler.process:: method= GET, type= ENTRY
> DEBUG - SimpleStopWatch            - start()
> DEBUG - StoreProvider              -
> StoreProvider.getEntry(/hcdata/v1/rentals/trips/2797.en.xml)
> 
> 
> 
> =====================================================================================================
> 
> NOW (without ServletFilters)
> =====
> DEBUG - HttpConnection             - Open connection to localhost:40506
> DEBUG - header                     - >> "GET
> /hcdata/v1/rentals/trips/12345.en.xml/2 HTTP/1.1[\r][\n]"
> DEBUG - HttpMethodBase             - Adding Host request header
> DEBUG - header                     - >> "Connection: close[\r][\n]"
> DEBUG - header                     - >> "Accept-Encoding: gzip,
> deflate[\r][\n]"
> DEBUG - header                     - >> "Accept-Charset: utf-8,
> *;q=0.5[\r][\n]"
> DEBUG - header                     - >> "Accept:
> application/atom+xml;type=entry, application/atom+xml;type=feed,
> application/atom+xml, application/atomsvc+xml, application/atomcat+xml,
> application/xml, text/xml, */*[\r][\n]"
> DEBUG - header                     - >> "User-Agent:
> Abdera/v0.3.0-incubating-SNAPSHOT[\r][\n]"
> DEBUG - header                     - >> "Host: localhost:40506[\r][\n]"
> DEBUG - header                     - >> "[\r][\n]"
> +++++++++++++> HttpServletRequestContext: CTOR  targetResolver=
> com.homeaway.hcdata.store.beans.ConfigurableRegexTargetResolver@1ffcc2
> <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  this=
> com.homeaway.hcdata.store.beans.ConfigurableRegexTargetResolver@1ffcc2
> <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  uri=
> /hcdata/v1/rentals/trips/12345.en.xml/2 <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/([^/#?]+) <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/?\?[\w-]+=[\w-:.]+(&[\w-]+=[\w-:.]+)?
> <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/? <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/? <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/([^/#?]+)/?[\d]+\?[\w-]+=[\w-:.]+(&[\w-]+=[\w-:.]+)?
> <++++++++++++++
> +++++++++++++> RegexTargetResolver.resolve  pattern=
> /hcdata/v1/([^/#?]+)/([^/#?]+)/([^/#?]+)/?[\d]+ <++++++++++++++
> +++++++++++++> HttpServletRequestContext: CTOR  target=
> RegexTarget[/hcdata/v1/([^/#?]+)/([^/#?]+)/([^/#?]+)/?[\d]+ ==>
> /hcdata/v1/rentals/trips/12345.en.xml/2] = ENTRY
> 
> 
> S'all good  ---   chriswberry@gmail.com
> 
> 
> 
> 

Mime
View raw message