View Javadoc

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one
    3    * or more contributor license agreements.  See the NOTICE file
    4    * distributed with this work for additional information
    5    * regarding copyright ownership.  The ASF licenses this file
    6    * to you under the Apache License, Version 2.0 (the
    7    * "License"); you may not use this file except in compliance
    8    * with the License.  You may obtain a copy of the License at
    9    *
    10   *   http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing,
    13   * software distributed under the License is distributed on an
    14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15   * KIND, either express or implied.  See the License for the
    16   * specific language governing permissions and limitations
    17   * under the License.
    18   */
    19  package org.apache.myfaces.shared_orchestra.util;
    20
    21  import java.io.IOException;
    22  import java.io.InputStream;
    23  import java.io.ObjectInputStream;
    24  import java.io.ObjectStreamClass;
    25
    26  /**
    27   * Tried to deploy v0.4.2 on JBoss 3.2.1 and had a classloading problem again.
    28   * The problem seemed to be with JspInfo, line 98. We are using an
    29   * ObjectInputStream Class, which then cannot find the classes to deserialize
    30   * the input stream.  The solution appears to be to subclass ObjectInputStream
    31   * (eg. CustomInputStream), and specify a different class-loading mechanism.
    32   *
    33   * @author Robert Gothan <robert@funkyjazz.net> (latest modification by $Author: schof $)
    34   * @version $Revision: 382015 $ $Date: 2006-03-01 08:47:11 -0500 (Wed, 01 Mar 2006) $
    35   */
    36  public class MyFacesObjectInputStream
    37      extends ObjectInputStream
    38  {
    39      public MyFacesObjectInputStream(InputStream in) throws IOException
    40      {
    41          super(in);
    42      }
    43
    44      protected Class resolveClass(ObjectStreamClass desc)
    45          throws ClassNotFoundException, IOException
    46      {
    47          try
    48          {
    49              return ClassUtils.classForName(desc.getName());
    50          }
    51          catch (ClassNotFoundException e)
    52          {
    53              return super.resolveClass(desc);
    54          }
    55      }
    56  }