Skip to content

Instantly share code, notes, and snippets.

@jsfeng
jsfeng / StrutsUpload.java
Created April 12, 2012 18:20
Struts upload files
import org.apache.struts.action.*;
import org.apache.struts.upload.FormFile;
/**
* Form bean for Struts File Upload.
*
*/
public class StrutsUploadForm extends ActionForm
{
private FormFile theFile;
@jsfeng
jsfeng / groovyCallService.groovy
Created April 6, 2012 17:28
Groovy Service Test Script
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.Method.POST
import static groovyx.net.http.ContentType.JSON
import java.util.Random
String[] inputs=[
'200',
'400',
'600',
'800',
@jsfeng
jsfeng / gistStyle.css
Created April 5, 2012 18:24
Customized style for embedded gist
.gist{
margin: 15px 0 !important;
}
.gist-file{
border: none !important;
}
.gist-meta{
border: 1px solid #D2d2d2 !important;
@jsfeng
jsfeng / streamingImageInRestService.java
Created April 5, 2012 18:10
Streaming images in JAX-RS REST service.
@Produces("image/jpeg")
@Path("/images")
public class ImageRestServiceImpl {
@Path("{id}")
public StreamingOutput getImage(@PathParam("id") int id) {
BufferedImage image = generateImage(id); //generate image using
return new StreamingImageOutput(image);
}
}