Tagged: server Toggle Comment Threads | Keyboard Shortcuts

  • Subinkrishna Gopi 11:44 am on December 14, 2010 Permalink |
    Tags: crash, , , putty, server,   

    Today’s read: What to do when your website goes down? 

    Smashin Magazine

    What to do when your website goes down? is an awesome post, trust me. Perhaps one of the most useful one, that can help anyone.

    Have you ever heard a colleague answer the phone like this: “Good afterno… Yes… What? Completely?… When did it go down?… Really, that long?… We’ll look into it right away… Yes, I understand… Of course… Okay, speak to you soon… Bye.” The call may have been followed by some cheesy ’80s rock ballad coming from the speaker phone, interrupted by “Thank you for holding. You are now caller number 126 in the queue.” That’s your boss calling the hosting company’s 24 hour “technical support” line.

    An important website has gone down, and sooner or later, heads will turn to the Web development corner of the office, where you are sitting quietly, minding your own business, regretting that you ever mentioned “Linux” on your CV. You need to take action. Your company needs you. Your client needs you. Here’s what to do.

    Source: Smashing Magazine

    Read the original post

    Advertisements
     
  • Subinkrishna Gopi 8:17 pm on August 2, 2009 Permalink |
    Tags: app engine, , free, , hosting, , , server,   

    An interesting find ! Google App Engine with Java support 

    image

    I was just going through code.google.com, and just find a link titled “App Engine”. I was not at all surprised as they do this every time. With Google something is new every time. I went on reading. Oh God! Free J2EE app engine where we can host our archives ! This is one of the coolest things I was waiting to happen. The server where I hosted (and I’m still with them) my website does not have Java support and I spend many hours in writing Php codes after many hours of searching and testing, which I could have done in minutes with Java. And most importantly it’s almost FREE ! We have to pay them only if we are crossing the specified bandwidth & page view limits.

    We can write code with Google’s Eclipse plug-in (with GWT support !), test them with in Eclipse and deploy them from Eclipse! Isn’t that cool? All you need is to have a Google account and just get it done. We can have up to nine applications each with a unique URL to access and we can even link them with our Google Apps too.

    Check this video: Get an overview of App Engine’s new Java runtime and see a demo of a sample app from creation to deployment.

    URL: http://www.youtube.com/watch?v=P3GT4-m_6RQ

    • For me this is nicest offer from Google in the recent times. I don’t know whether all of you are going to agree with this. But at least I’m happy. Hope all of you will find it nice.

    Google App Engine: http://code.google.com/appengine/
    FAQ: http://code.google.com/appengine/kb/
    App Engine Blog: http://googleappengine.blogspot.com/
    Getting started: http://code.google.com/appengine/docs/java/gettingstarted/

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

    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 10:31 am on February 12, 2009 Permalink |
    Tags: , , , server, , ,   

    How-To: Create a WAR file using ANT 

    In one of my previous posts I mentioned about building a JAR using ANT.  This post – building a WAR (Web Application Archive) – is just an add-on to that.

    Structure of a WAR file

    Application.war
    |-- META-INF
    |  |-- manifest.mf
    |-- WEB-INF
    |  |-- web.xml   - deployment descriptor
    |  |-- classes   - class files organized in packages
    |  |-- lib       - other libraries
    |
    |-- <other files, directories etc.>

    Deployment descriptor
    This is a sample deployment descriptor from Java Servlet Specification version 2.4. Get the descriptor (.pdf)

    Build file

    <project name="my.enterprise.project" default="build.my.war">
    <property name="deploy.dir" value="/my/deploy/dir" />
    <property name="file.name" value="Application.war" />
      <target name="build.my.war">
        <fileset dir="contents">
          <include name="**/*"/>
        </fileset>
        <war destfile="${file.name}" webxml="conf/web.xml">
          <classes dir="bin" />
        </war>
        <echo>Copying ${file.name}...</echo>
        <copy file="${file.name}" todir="${deploy.dir}" />
        <delete file="${file.name}" />
      </target>
    </project>
    

    The above build file assumes that all the non-java resources and JSPs are within the “contents” directory. The build file will pick the class files from the “bin” directory within the base. Here the build file is not compiling existing source files. To compile Java files there is another ANT task –  javac.

    <javac srcdir="src" destdir="bin" classpathref="application.classpath"/>
    

    Add the javac task before the war task in the build file.

    Defining the class path

    <path id="application.classpath">
       <fileset dir="/path/to/my/lib">
          <include name="javax.servlet.jar"/>
       </fileset>
    </path>
    

    Define the path before the target – build.my.war.

    Read more
    http://ant.apache.org/manual/CoreTasks/war.html
    http://ant.apache.org/manual/CoreTasks/javac.html
    http://ant.apache.org/manual/dirtasks.html

     
  • Subinkrishna Gopi 4:22 pm on February 11, 2009 Permalink |
    Tags: , , , , migration, server, , ,   

    Another JBoss 5 hack by Venu 

    jbosscorp_logo

    Venu had another JBoss hack and he was able to fix one more issue that may bubble up during the migration from JBoss 4.x to 5. This time found out how solve “Adding multiple last resources is disallowed. Current resource is ….” exception which happens while trying to access an EJB from a different EAR with in a transaction and trying to commit that transaction.

    Read the article here

     
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