users@grizzly.java.net

Re: Quick question on servlet-mapping for Embedded Grizzly

From: aloleary <alanoleary_at_gmail.com>
Date: Fri, 8 May 2009 11:22:33 -0700 (PDT)

Its a good question - the answer is I don't based on the way I am configuring
it above....

After the lines above I do the following (apologies for not including
before):

        // Add Spring Security
        adapter.addFilter(delegatingFilterProxy,
"springSecurityFilterChain", null);
       
adapter.addServletListener("org.springframework.security.ui.session.HttpSessionEventPublisher");

        threadSelector = GrizzlyServerFactory.create(baseUri, adapter);

And now I have a running server...

I guess I could refactor a bit to get usage of
GrizzlyWebServer.addGrizzlyAdapter(adapter,"/rest");

-A-


Jeanfrancois Arcand-2 wrote:
>
> Salut,
>
> aloleary wrote:
>> Hello,
>> I have embeded Grizzly working great as part of my junit4.x test
>> framework (@BeforeClass to boot strap for all tests and @AfterClass to
>> tear
>> down) I have configured it properly to bootstrap my spring context and
>> spring-security.
>>
>> I have one small problem I cannot work out how to programatically
>> configure the equivalent of the servlet mapping in web-xml fragment e.g.
>>
>> <!-- REST Support (Jersey/Spring) -->
>> <servlet>
>> <servlet-name>rest-servlet</servlet-name>
>> <servlet-class>
>> com.sun.jersey.spi.spring.container.servlet.SpringServlet
>> </servlet-class>
>> <load-on-startup>1</load-on-startup>
>> </servlet>
>>
>> <servlet-mapping>
>> <servlet-name>rest-servlet</servlet-name>
>> <url-pattern>/rest/*</url-pattern>
>> </servlet-mapping>
>>
>> Here is my embedded code:
>>
>> URI baseUri =
>> UriBuilder.fromUri("http://localhost/").port(PORT).build();
>> final ServletAdapter adapter = new ServletAdapter();
>>
>> adapter.addInitParameter("com.sun.jersey.config.property.packages",
>> JERSEY_PACKAGE_ROOT);
>>
>> adapter.addContextParameter("contextConfigLocation",
>> SPRING_APP_CONTEXT);
>>
>> adapter.addServletListener("org.springframework.web.context.ContextLoaderListener");
>> adapter.setServletInstance(new SpringServlet());
>>
>> adapter.setContextPath(baseUri.getPath()); // so this is just
>> '/'
>> here
>>
>> //adapter.setServletPath("/rest"); << this does not seem to
>> work ?
>>
>> Any help really appreciated...
>
> How do you add the Adapter to the GrizzlyWebServer? Try something like:
>
> GrizzlyWebServer.addGrizzlyAdapter(adapter,"/rest");
>
> Let me know the result.
>
> Thanks!
>
> -- Jeanfrancois
>
>
>>
>> Thanks
>> -A-
>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/Quick-question-on-servlet-mapping-for-Embedded-Grizzly-tp23446010p23451150.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.