Updates from April, 2009 Toggle Comment Threads | Keyboard Shortcuts

  • Subinkrishna Gopi 11:10 pm on April 27, 2009 Permalink |
    Tags: ,   

    Today’s read: Why we prefer Mac 

    Today I read an interesting article – “Five Reasons Why Designers Developers are Switching to Mac”. Even I’m a big fan of Mac since we started using it in our project. Hope this is a nice read. You can read the article here.

    Designers and developers have many choices to make when it comes to getting work done, from what frameworks, languages, and image editing software to use, to what platform to run. The latter is an oft debated and controversial topic and the mere mention of it risks setting off flame wars of epic proportions, so in the interest of sanity, we’ll try to avoid any direct comparisons to other operating systems.

    Article: http://www.smashingmagazine.com/2009/04/26/five-reasons-why-designers-are-switching-to-mac/

    Advertisements
     
  • Subinkrishna Gopi 11:12 am on April 21, 2009 Permalink |
    Tags: , filter, , , ,   

    Code: ByteStreamResponseWrapper 

    Maxi was asking for the source code of ByteStreamResponseWrapper. This is related to this post (How to: write a servlet filter).

    package subin.rnd.enterprise.servlet.wrapper;
    
    import java.io.ByteArrayOutputStream;
    import java.io.PrintWriter;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpServletResponseWrapper;
    import subin.rnd.enterprise.servlet.io.ServletOutputStreamImpl;
    
    public class ByteStreamResponseWrapper
    extends HttpServletResponseWrapper
    {
        private ByteArrayOutputStream byteStream;
    
        public ByteStreamResponseWrapper(HttpServletResponse response)
        {
            super(response);
        }
    
        @Override
        public ServletOutputStream getOutputStream()
        {
            ServletOutputStreamImpl outputStream = null;
    
            this.byteStream =  (null == this.byteStream)
                ? new ByteArrayOutputStream() : this.byteStream;
            outputStream = new ServletOutputStreamImpl(this.byteStream);
    
            return (outputStream);
        }
    
        @Override
        public PrintWriter getWriter()
        {
            PrintWriter printWriter = null;
    
            this.byteStream =  (null == this.byteStream)
                ? new ByteArrayOutputStream() : this.byteStream;
            printWriter = new PrintWriter(this.byteStream);
    
            return (printWriter);
        }
    
        @Override
        public String toString()
        {
            return ((null == this.byteStream)
                    ? null : new String(this.byteStream.toByteArray()));
        }
    
        public byte[] toBytes()
        {
            return ((null == this.byteStream)
                    ? null : this.byteStream.toByteArray());
        }
    }
    

    Then there is ServletUtility & ServletOutputStreamImpl.

    Code: ServletUtility

    package subin.rnd.enterprise.servlet.util;
    
    import java.io.OutputStream;
    import javax.servlet.ServletResponse;
    
    public class ServletUtility
    {
        /**
         * Writes the bytes to the {@link OutputStream}
         *
         * @param response
         * @param bytes
         */
        public static void write(ServletResponse response, byte[] bytes)
        {
            int contentLength = -1;
            OutputStream outputStream = null;
    
            if ((null != response) &&
                (null != bytes) &&
                (bytes.length > 0))
            {
                contentLength = bytes.length;
    
                try
                {
                    response.setContentLength(contentLength);
                    outputStream = response.getOutputStream();
                    outputStream.write(bytes);
                }
                catch (Exception exception)
                {
                    outputStream = null;
                }
                finally
                {
                    try
                    {
                        if (null != outputStream) outputStream.close();
                    }
                    catch (Exception e){}
                }
            }
        }
    }
    

    ServletOutputStreamImpl is an implementation of ServletOutputStream. I think I don’t need to put the source code of it.

     
    • spablos 7:50 pm on August 13, 2012 Permalink

      ServletOutputStreamImpl is an implementation of ServletOutputStream. I think I don’t need to put the source code of it.

      Can you please this (ServletOutputStreamImpl) implementation too?

  • Subinkrishna Gopi 11:10 am on April 8, 2009 Permalink |
    Tags: , , ,   

    Today’s Read: 15 Essential Checks Before Launching Your Website 

    Smashing Magazine

    15 Essential Checks Before Launching Your Website” – is a very good article. I recommend it to all web designers/developers.

    Your website is designed, the CMS works, content has been added and the client is happy. It’s time to take the website live. Or is it? When launching a website, you can often forget a number of things in your eagerness to make it live, so it’s useful to have a checklist to look through as you make your final touches and before you announce your website to the world.

    This article reviews some important and necessary checks that web-sites should be checked against before the official launch — little details are often forgotten or ignored, but – if done in time – may sum up to an overall greater user experience and avoid unnecessary costs after the official site release.

    Read it here: http://www.smashingmagazine.com/2009/04/07/15-essential-checks-before-launching-your-website/

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel