Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

junit - Turn on gzip compression for grizzly under JerseyTest -


i have jersey implementation of web service. response per requirements must gzip-ed.

client side contains following bootstrap code switch gzip on:

client retval = client.create(); retval.addfilter(     new com.sun.jersey.api.client.filter.gzipcontentencodingfilter()); 

for tomcat web.xml gzip configured follow

 <servlet>   <display-name>jax-rs rest servlet</display-name>   <servlet-name>jax-rs rest servlet</servlet-name>   <servlet-class>       com.sun.jersey.spi.container.servlet.servletcontainer   </servlet-class>   <load-on-startup>1</load-on-startup>   <init-param>         <param-name>com.sun.jersey.spi.container.containerrequestfilters</param-name>         <param-value>com.sun.jersey.api.container.filter.gzipcontentencodingfilter</param-value>   </init-param>   <init-param>         <param-name>com.sun.jersey.spi.container.containerresponsefilters</param-name>         <param-value>com.sun.jersey.api.container.filter.gzipcontentencodingfilter</param-value>   </init-param> 

and works fine!

but need write unit test invokes service. i'm using jerseytest base , in practice way shown grizzly not correctly handles gzip without explicit declaration. have found code snippet how switch on similar problem, have no idea how combine jerseytest.

thank in advance

here sample test case if you're using jersey test framwork:

@test public void testget(){          webresource webresource = resource();      clientresponse result = webresource         .path("pathtoresource")         .header("accept-encoding", "gzip")         .head();      assertequals(        "response header must contain gzip encoding",        "[gzip]",        result.getheaders().get("content-encoding").tostring()); } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -