carlos sanchez

Ranch Hand
+ Follow
since Jan 29, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by carlos sanchez

hi, I guess this is a stupid question but it always is if you know the answer, and I'm a bit confused.

I'm using castor to parse xml (haha, didn' want to create my own parser). It's my first time (seriously workin') with Websphere (always used eclipse, that helps) and I want to read that damned mapping xml configuration file.

the constructor uses a FileInputStream that reads a file instance:

I've placed the xml in the WEB-INF, the classes and the app's root folder,
that's WebContent.

I want to have it deployed inside the ear or the war file. Any idea someone on how to include it.

thanks
15 years ago
Hi, I'm starting with websphere, very simple question. I want to load an file stored in my web app base folder.

If I type:



The systems tries to load it from my (user) Personal data file. I've been looking for a system property, the nearest I've found point to:

[13/07/05 10:39:20:054 CEST] 3b3514ed SystemOut O C:\TRABAJO\CSC\Desarrollo\WebSphere\.metadata\.plugins\com.ibm.etools.server.core\tmp2\repository\temp
[13/07/05 10:39:20:054 CEST] 3b3514ed SystemOut O C:\TRABAJO\CSC\Desarrollo\WebSphere\.metadata\.plugins\com.ibm.etools.server.core\tmp2\logs\startServer.log
[13/07/05 10:39:20:054 CEST] 3b3514ed SystemOut O C:\TRABAJO\CSC\Desarrollo\WebSphere\.metadata\.plugins\com.ibm.etools.server.core\tmp2\pathMaps.properties
[13/07/05 10:39:20:054 CEST] 3b3514ed SystemOut O C:\TRABAJO\CSC\Desarrollo\WebSphere\.metadata\.plugins\com.ibm.etools.server.core\tmp2\repository
[13/07/05 10:39:20:054 CEST] 3b3514ed SystemOut O C:\Archivos de programa\IBM\WebSphere Studio\Site Developer\v5.1.2\runtimes\base_v5\bin
[13/07/05 10:39:20:054 CEST] 3b3514ed SystemOut O C:\TRABAJO\CSC\Desarrollo\WebSphere\.metadata\.plugins\com.ibm.etools.server.core\tmp2\repository
[13/07/05 10:39:20:054 CEST] 3b3514ed SystemOut O C:\TRABAJO\CSC\Desarrollo\WebSphere\.metadata\.plugins\com.ibm.etools.server.core\tmp2\repository\backup
[13/07/05 10:39:20:054 CEST] 3b3514ed SystemOut O C:\TRABAJO\CSC\Desarrollo\WebSphere\.metadata\.plugins\com.ibm.etools.server.core\tmp2\cache
[13/07/05 10:39:20:054 CEST] 3b3514ed SystemOut O C:\TRABAJO\CSC\Desarrollo\WebSphere\.metadata\.plugins\com.ibm.etools.server.core\tmp2\wstemp

I don't want to hard-code the location (It would be dumb because I've to migrate to another machine the code)

Any ideas?
15 years ago
this is the code 4 getUserNamespaces in IMAPStore


/**
* Using the IMAP NAMESPACE command (RFC 2342), return a set
* of folders representing the User's namespaces.
*/
public Folder[] getUserNamespaces(String user)
throws MessagingException {
Namespaces ns = getNamespaces();
if (ns == null || ns.otherUsers == null)
return super.getUserNamespaces(user);
return namespaceToFolders(ns.otherUsers, user);
}
15 years ago
Hi, I've got the same problem. the Store method returns a Folder[0] by default, the method is abstract so you (we) should implement it. I haven't checked the IMAPStore yet.

I've also found what's suposed to be a bug in the exchange server (thanks to the people in the javamail-list).

http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b311468

I'll keep on looking. Be sure to post if you find out something.
15 years ago
You're right. I thought that it would initialize the array with "blank" objects (I mean the blank constructor).

I thought I did this before with an array of Files, but didn't have to initialize like



thank u all
15 years ago
Works this way.....

MailMessage mail = new MailMessage();
MailMessage[] mails = (MailMessage[])Array.newInstance(MailMessage.class, message.length);

...................
...................

Array.set(mails,i,mail);


But I'm sure I've used it somewhere the other way. Does anyone know why?
15 years ago
1 more thing, when I debugg it I get :

com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array.

when trying to access it in eclipse.
15 years ago
Hi, I've created an object called MailMessage(dealing with javamail)
with 4 attributes and a getter/setter method 4 each.

I'm creating another class that creates an array of objects:

MailMessage[] mail = MailMessage[messages.length];

the mail object contains null objects......
so a mail[i].toString() is a null pointer.

can I create this type of arrays? do I have to implement an interface? thanks.
15 years ago
Yup, problem is with threads.
I've wallked around using the java tutorial example with using the Progress Monitor dialog box. Just if someone is interested it uses a timer to check the task that's performing the operation and checks it's state.

Just as the one you've sent Craig, thank U.
15 years ago
Hi I'm diggin' into the search to find a complete answer for this.

I'm building an app with 4 different windows:

1.- Logon Window
2.- Select window.
3.- Data work window.
4.- Bye window.

Actually everyone is an extension of a JFrame, I create and set visible the new window and dispose the old one. Looks good untill I create the Data working window that doesn't display a progress bar (I imagine the task occupies all cpu time and it can't paint the progress bar).

Is this the correct way to structure the window changing. Is there a way to show my progress bar before the method that does the har work starts?
15 years ago
sorry, The exception pop's in the getInputStream() before casting to the DataInputStream.

Thanks in advance.
16 years ago
Hi, I'm transfering a file using the servlet/applet model.

when I ask directly from the url bar in the Iexplorer I get the file, but when I call it from the method init in my applet I get a 505 error:

this is the code



Any Ideas?
16 years ago
Hi, I'm developing a web service that has to send attachment's.
First Problem. java2WSDL when trying to generate the wsdl from a method like this:
<code>
public String check(DataHandler dh)
{
if(dh == null)
{
System.err.println("Attachment vacio");
return "error";
}
else
{
String filename = dh.getName();
System.out.println("nombre del archivo: " + filename);
try
{
int c;
File receivedfile = new File(filename);
FileOutputStream fos = new FileOutputStream("/apps/tomcat/Axis_Standalone/webapps/temp/"+filename);
FileInputStream fis = new FileInputStream(filename);
while ((c = fis.read()) != -1)
{
fos.write(c);
}
}
catch(Exception e)
{
e.printStackTrace();
return "error";
}
return "ok";
}
}
}
</code>
I get a : "The class javax.activation.DataHandler is defined in a java or javax package and cannot be converted into an xml schema type. An xml schema anyType will be used to define this class in the wsdl file."
-------------------------------------------------------------------------
So I went on (despite of this message) I've built the skeletons and casted the object I get. then I built the client:
<code>
DataHandler dhSource = new DataHandler(new FileDataSource("C:/dump.mp3"));
String endpoint = "http://tpid01:8500/axis/services/CheckAttachService";

Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://tpid01:8500/", "check"));
QName qnameAttachment = new QName("urn:CheckAttachmentService","DataHandler");
call.registerTypeMapping(dhSource.getClass(),qnameAttachment,JAFDataHandlerSerializerFactory.class,JAFDataHandlerDeserializerFactory.class);
call.addParameter("source",qnameAttachment,ParameterMode.IN);
call.setReturnType(new QName("urn:CheckAttachmentService","String"));
String respuesta = (String) call.invoke( new Object[] {dhSource} );

</code>
and got a:
FaultCode: Server.userException
FaultCode: ; nested exception is:
java.io.IOException: No support for attachments
--------------------------------------------------------------------------
So, im stuck, help apreciated..
16 years ago
Hi, first the code:
response.setContentType(mime);
response.setHeader("Content-Disposition", "attachment; filename=" + attFile.getName());
FileInputStream fis = new FileInputStream(ruta);
BufferedInputStream in = new BufferedInputStream(fis);
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
javax.servlet.ServletOutputStream sos = response.getOutputStream();
byte binaryByte[] = new byte[16384];
int readCount = 0;
for(readCount = in.read(binaryByte, 0, 16384); readCount >= 0; readCount = in.read(binaryByte, 0, 16384))
sos.write(binaryByte, 0, readCount);

reader.close();
sos.close();
this opens an open-save pop-up. I want to skip this & open it in the app, not the browser.
Any ideas?
Thanks!
16 years ago
Hi I'm trying to display an excel file inside the browser, I've set the content type to the right mime type. I've searched and found that the out writer is a java.io.Writer, so this is basically used to transfer ASCII characters, right? Can I somehow switch to a binary writer so I can show it in the browser?
Thanks.
16 years ago