KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > util > MyFacesObjectInputStream


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.myfaces.util;
17
18 import java.io.IOException JavaDoc;
19 import java.io.InputStream JavaDoc;
20 import java.io.ObjectInputStream JavaDoc;
21 import java.io.ObjectStreamClass JavaDoc;
22
23 /**
24  * Tried to deploy v0.4.2 on JBoss 3.2.1 and had a classloading problem again.
25  * The problem seemed to be with JspInfo, line 98. We are using an
26  * ObjectInputStream Class, which then cannot find the classes to deserialize
27  * the input stream. The solution appears to be to subclass ObjectInputStream
28  * (eg. CustomInputStream), and specify a different class-loading mechanism.
29  *
30  * @author Robert Gothan <robert@funkyjazz.net> (latest modification by $Author: matze $)
31  * @version $Revision: 1.9 $ $Date: 2004/10/13 11:51:01 $
32  */

33 public class MyFacesObjectInputStream
34     extends ObjectInputStream JavaDoc
35 {
36     public MyFacesObjectInputStream(InputStream JavaDoc in) throws IOException JavaDoc
37     {
38         super(in);
39     }
40
41     protected Class JavaDoc resolveClass(ObjectStreamClass JavaDoc desc)
42         throws ClassNotFoundException JavaDoc, IOException JavaDoc
43     {
44         try
45         {
46             return ClassUtils.classForName(desc.getName());
47         }
48         catch (ClassNotFoundException JavaDoc e)
49         {
50             return super.resolveClass(desc);
51         }
52     }
53 }
54
Popular Tags