Re: [Snippet] Creating on-demand PDF using iText

2005-11-30 Thread Helge Staedtler
I wrap these JAR's usually in a very primitive Framework.
i just create a folder which ends with ".framework" and some dirs inside of
it like this path shows and then throw the .jar inside of it.

 MyNameForThisFramework.framework/Resources/Java/iText.jar

and put the whole stuff into

 /Library/Frameworks/


I then add the Framework to my app as i do with all other frameworks. this
way I also know what to deliver for deployment. is this a valid solution,
too?

regards,
helge


Am 01.12.2005 2:08 Uhr schrieb "Chuck Hill" unter
<[EMAIL PROTECTED]>:

> 
> On Nov 30, 2005, at 5:03 PM, Stefan Pantke wrote:
>> 
>> Don't forget to install the iText JAR found here
>> 
>> http://www.lowagie.com/iText/
>> 
>> in
>> 
>> /Library/Java/Extensions
>> 
>> or another JAVA-well known place.
>> 
> 
> Thanks for the example!
> 
> I would recommend /Library/WebObjects/Extensions as being generally a
> safer place for third party jars used with WebObjects.  Putting them
> in /Library/Java/Extensions can lead to class loader "issues" with
> security when classes from one loader try to instantiate those loaded
> in a later loader.  This results in the dreaded ClassDefNotFound
> exception. I keep /Library/Java/Extensions for JDBC extensions and
> other, similar additions to the core Java API.
> 
> Chuck
> 


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: [Snippet] Creating on-demand PDF using iText

2005-11-30 Thread Stefan Pantke


Am 01.12.2005 um 02:08 schrieb Chuck Hill:



On Nov 30, 2005, at 5:03 PM, Stefan Pantke wrote:


Don't forget to install the iText JAR found here

http://www.lowagie.com/iText/

in

/Library/Java/Extensions

or another JAVA-well known place.



Thanks for the example!

I would recommend /Library/WebObjects/Extensions as being generally  
a safer place for third party jars used with WebObjects.  Putting  
them in /Library/Java/Extensions can lead to class loader "issues"  
with security when classes from one loader try to instantiate those  
loaded in a later loader.  This results in the dreaded  
ClassDefNotFound exception. I keep /Library/Java/Extensions for  
JDBC extensions and other, similar additions to the core Java API.


Thx! Lesson learned and just moved the JAR!

Cheers,

Stefan
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: [Snippet] Creating on-demand PDF using iText

2005-11-30 Thread Chuck Hill


On Nov 30, 2005, at 5:03 PM, Stefan Pantke wrote:


Don't forget to install the iText JAR found here

http://www.lowagie.com/iText/

in

/Library/Java/Extensions

or another JAVA-well known place.



Thanks for the example!

I would recommend /Library/WebObjects/Extensions as being generally a  
safer place for third party jars used with WebObjects.  Putting them  
in /Library/Java/Extensions can lead to class loader "issues" with  
security when classes from one loader try to instantiate those loaded  
in a later loader.  This results in the dreaded ClassDefNotFound  
exception. I keep /Library/Java/Extensions for JDBC extensions and  
other, similar additions to the core Java API.


Chuck


--
Coming in 2006 - an introduction to web applications using WebObjects  
and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.http://www.global-village.net/products/practical_webobjects





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


[Snippet] Creating on-demand PDF using iText

2005-11-30 Thread Stefan Pantke


Am 30.11.2005 um 22:20 schrieb Stefan Pantke:


I need to compose PDF output based on certain input,


For anybody interested, here is a snippet for outputting PDF
using iText - probably not the nicest solution, but for a newbie,  
this might

be a nice starting point:

>>>
//
// Main.java: Class file for WO Component 'Main'
// Project dprint
//
// Created by sp on 30.11.05
//

import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;
import com.webobjects.foundation.NSData;

// for iText
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.*;
import java.util.Date;
import java.awt.Color;

import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;

 class TAPDFComponent extends WOComponent {
private String _contentType = "application/pdf";

public TAPDFComponent(WOContext context) {
super(context);
}
public void setContentType(String aType) {
_contentType = aType;
}

public String contentType() {
return _contentType;
}

public void appendToResponse(WOResponse response, WOContext context) {
// Voir page suivante …

// Document document = new Document(PageSize.A4.rotate());
Document document = new Document( PageSize.A4 );

ByteArrayOutputStream oBuffer = new ByteArrayOutputStream();
try {
PdfWriter.getInstance( document, oBuffer );

try {

// step 2:
// we create a writer that listens to the 
document
// and directs a PDF-stream to a file

// step 3: we open the document
document.open();

// step 4: we add some content
document.add(new Paragraph("To create a document in landscape  
format, just make the height smaller than the width. For instance by  
rotating the PageSize Rectangle: PageSize.A4.rotate()"));

document.setPageSize(PageSize.A4);
document.newPage();
document.add(new Paragraph("This is portrait 
again"));
document.add(new Paragraph("Hello World"));
document.add(new Paragraph(new Date().toString()));

Chunk c;
c = new Chunk("background");
c.setBackground(new Color(0xC0, 0xC0, 0xC0));
document.add(c);


// the 14 standard fonts in PDF: do not use this Font 
constructor!
// this is for demonstration purposes only, use 
FontFactory!
Font[] fonts = new Font[14];
fonts[0] = new Font(Font.COURIER, Font.DEFAULTSIZE, 
Font.NORMAL);
fonts[1] = new Font(Font.COURIER, Font.DEFAULTSIZE, 
Font.ITALIC);
fonts[2] = new Font(Font.COURIER, Font.DEFAULTSIZE, 
Font.BOLD);
			fonts[3] = new Font(Font.COURIER, Font.DEFAULTSIZE, Font.BOLD |  
Font.ITALIC);

fonts[4] = new Font(Font.HELVETICA, Font.DEFAULTSIZE, 
Font.NORMAL);
fonts[5] = new Font(Font.HELVETICA, Font.DEFAULTSIZE, 
Font.ITALIC);
fonts[6] = new Font(Font.HELVETICA, Font.DEFAULTSIZE, 
Font.BOLD);
			fonts[7] = new Font(Font.HELVETICA, Font.DEFAULTSIZE,  
Font.BOLDITALIC);

fonts[8] = new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, 
Font.NORMAL);
fonts[9] = new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, 
Font.ITALIC);
fonts[10] = new Font(Font.TIMES_ROMAN, 
Font.DEFAULTSIZE, Font.BOLD);
			fonts[11] = new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE,  
Font.BOLDITALIC);

fonts[12] = new Font(Font.SYMBOL);
fonts[13] = new Font(Font.ZAPFDINGBATS);
// add the content
for (int i = 0; i < 14; i++) {
document.add(new Paragraph("quick brown fox jumps over the lazy  
dog", fonts[i]));

}



}
catch(DocumentException de) {
System.err.println("Document problem: " + 
de.getMessage());
} catch ( Exception ex) {
System.err.println("Document problem 2: " + 
ex.getMessage());
}

// step 5: we close the document
document.close();


Useful list of WO sites

2005-11-30 Thread Ryan Poling
I've been having fun going through these - a nice list of WebObjects  
sites people have bookmarked.  May be of use to some of you as well.


http://del.icio.us/tag/webobjects

-Ryan

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: NSProperties order of priority (app/framework/command line)?

2005-11-30 Thread Lachlan Deck

Hi there,

On 29/11/2005, at 9:55 PM, Wolfram Stebel wrote:

I'm not sure about the above, but there is still a way to merge  
additional

properties into the already loaded properties via
NSProperties.setPropertiesFromArgv ( String args [] );
as i showed in my PropDemo WOApp, dowloadable from
http://www.bugs-and-errors.de/
This allows also updating of properties at runtime.

If this helps.. :-)


Thanks for the demo.

It still leaves the question, however, about the order of the other 3  
preferences...


with regards,
--

Lachlan Deck




smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Re: Xcode won't add a WebServer resource (jam warning

2005-11-30 Thread Baiss Eric Magnusson



Interesting, the <.js> extension does not exist in
 under text.

I'd say just add it but there doesn't seem to be a GUI to do so.


On 30. Nov 2005, at 18:45 Uhr, Sacha Michel Mallais wrote:



I'm desperately trying to add a JavaScript file to my
WebServerResources in Xcode 1.5 (OS X 10.3.9). When I build the
WebServer target, the file is not included in the build directory  
and

I'm pretty sure the following warning in the build log has something
to do with it:

jam: warning: no rule for file prototype.js



This problem has nothing to do with jam.  Seems like Xcode is passing
an invalid file reference to jam, so the problem is likely with  
Xcode.

 Have you tried rebuilding your index?



I did rebuild the index -- to no avail. Any idea how to track this  
down

(or work around it)? I'm totally clueless...

Thanks,
Andreas



Baiss Eric Magnusson




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: NSProperties order of priority (app/framework/command line)?

2005-11-30 Thread Lachlan Deck

Hi there,

On 30/11/2005, at 3:07 AM, Gavin Eadie wrote:


At 10:57 AM +1100 11/29/05, Lachlan Deck wrote:
My reading of the NSProperties API leads me to believe that the  
order of priority for preferences are as follows (but it's not  
explicitly stated)...


... what a coincidence!!  I just re-documented NSProperties  
(manually edited Javadoc enclosed) as an example of how far off  
target a lot of the WO Javadoc is.  The portion in question here  
says: "The application properties can come from four sources:  
argument parameters from the command line, the file  
WebObjects.properties in the user's home directory the  
application's Properties file, and the Properties files of any  
frameworks the application includes, in that order of precedence."


That is, in your numbering: 1, 4, 2, 3



Neither the online copy of the 5.2 or 5.3 docs, nor indeed my local  
copy, have the clarifying phrase "in that order of preference" - and  
you've changed the order of the sentence.


You have:
1) Command line args
4) ~/WebObjects.properties
2) Application Properties file
3) Framework Properties file

however, the online doc states:
The application properties can come from four sources: the command  
line, the application's Properties file, the Properties files of any  
frameworks the application includes, and the file  
WebObjects.properties in the user's home directory.


Which is:
1) Command line args
2) Application Properties file
3) Framework Properties file
4) ~/WebObjects.properties

So how are the former conclusions being made? Has someone actually  
tested this?


with regards,
--

Lachlan Deck




smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Creating PDF output on demand

2005-11-30 Thread Stefan Pantke

I need to compose PDF output based on certain input,

- partly based on XML   
... and apply styles for PDF output
- partly based on images and Text
... and apply 'simple' composition rules for PDF output

I know of FOP, but just found iText

http://www.lowagie.com/iText/

iText seems to be well documented and feature rich. At least for my
second task, this might be a good solution to further evaluate options.

My PDFs need to be high-resolution to be printed on high-resolution
imaging/printing machine.

But: Do we have a PDF lib, which especially integrates well with WO?


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: NSProperties order of priority (app/framework/command line)?

2005-11-30 Thread Gavin Eadie

At 10:57 AM +1100 11/29/05, Lachlan Deck wrote:
My reading of the NSProperties API leads me to believe that the 
order of priority for preferences are as follows (but it's not 
explicitly stated)...


... what a coincidence!!  I just re-documented NSProperties (manually 
edited Javadoc enclosed) as an example of how far off target a lot of 
the WO Javadoc is.  The portion in question here says: "The 
application properties can come from four sources: argument 
parameters from the command line, the file WebObjects.properties in 
the user's home directory the application's Properties file, and the 
Properties files of any frameworks the application includes, in that 
order of precedence."


That is, in your numbering: 1, 4, 2, 3

%NSProperties.html
Description: application/applefile







  com.webobjects.foundation 
	
	Class NSProperties 


	This class extends Java's properties
	mechanism to merges various
	properties from the application properties with the standard system
	properties so that they are all
	available using the java.lang.System.getProperties
	method. The application properties can come from four
	sources: argument parameters from
	the command line, the file
	WebObjects.properties in the user's home
	directory the application's Properties file,
	and the Properties
	files of any frameworks the application includes, in that order of precedence.and the file
	WebObjects.properties in the user's home
	directory


	This class has only static methods and cannot be instantiated.
	
This class would have benefitted from
inheriting key-value-coding for 'getProperty'.
The Properties File 

	The application and any
	framework can include a file named Properties in its
	Resources. The Properties file must be in the format
	specified by java.io.Properties.


	Boolean values, NSArrays, and NSDictionaries must be specified using
	the property list representation. See the
	NSPropertyListSerialization class description for more information
	on property lists.

Command Line Properties 

	The
	setPropertiesFromArgv method parses the cFor command line arguments
	and recognizes
	to be recognized as
	properties, they must fit the property formats listed
	in the table below.


	
		
			Format
		
		
		
		
			Example
		
	
	
		
			-Dkey=value
		
		
			 
		
		
			-DWOPort=4321
		
	
	
		
			-key value
		
		
			 
		
		
			-WOAutoOpenInBrowser NO
		
	


	Properties specified in
	these formats will be available as System properties after you
	invoke setPropertiesFromArgv.


Accessing the Properties 

To access the application
properties you first need to merge the application and command line
properties with the System properties. AThe application properties are
automatically merged with the System properties when a
WebObjects application starts
up. automatically
performs this step for you. You can then access the property
as a string, and convert the string to the property's actual data
type.


	To obtain the application
	properties and merge them with the System properties you have to
	invoke setPropertiesFromArgv.


	Every property is a key-value pair. For example, on Mac OS X, the property value for the key
	"java.vendor" is "Apple Computer, Inc.". To access a
	property corresponding to a particular key, use the
	java.lang.System.getProperty method. This method which returns the property as a string.


	If the property string represents a value other than
	java.lang.String, for example, "TRUE" for a boolean value, the String value, "("San Francisco", "New York",
	"Seoul", "London", "Seattle", "Shanghai")" for an NSArray, or
	the String value, "{ user = wshakesp; birth
	= 1564; death = 1616; }" for an NSDictionary, you can convert
	it to the appropriate data type using the
	NSPropertyListSerialization's booleanForString,
	arrayForString, or dictionaryForString
	method, respectively. NSPropertyListSerialization also provides an
	intForString method to simplify converting a property
	string to an integer.


More on the representation of non-String properties as strings can
be found in the document: "Property List Programming Guide for Cocoa".






	

	 

	
		
			 Constructor Summary
		
	
	
		
			NSProperties() 
			
			   
		
	

  



 

	
		
			 Method Summary
		
	
	
		
			 static NSArray
		
		
			arrayForKey(String aKey) 
			
			  Deprecated. Instead, find the System property using System.getProperty and convert the property to a string using NSPropertyListSerialization.arrayForString.
		
	
	
		
			 static boolean
		
		
			booleanForKey(String aKey) 
			
			  Deprecated. Instead, find the System property using System.getProperty and convert it to a boolean using NSPropertyListSerialization.booleanForString.
		
	
	
		
			 static NSData
		
		
			dataForKey(String aKey) 
			
			  Deprecated. Instead, find the System property using System.getProperty, convert the property to a property list using NSPropertyListSerialization.propertyListFr

Re: WOSession and setStoresIDsInCookies method

2005-11-30 Thread Arturo Perez

Peteris Krisjanis wrote:
I want to store session and instance IDs in cookies, so I add two  
methods in my Session.java:


setStoresIDsInCookies(true);
setStoresIDsInURLs(false);

And I can browse my app without seeing rather large session ID.  And  
for example, my URL

looks like that:
http://dev-peteris.local:59359/cgi-bin/WebObjects/johaidi_server.woa/ 
wo/0.20.0


However, when I clean up url and go to
http://dev-peteris.local:59359/cgi-bin/WebObjects/ johaidi_server.woa/, 
session seems to be vanished.


What I should do that session id is left stored in cookies and I can  
still manipulate with URL?


Also is there any useful references (posts, emails) for "hiding"  
WebObjects url and creating good one? How url_rewrite works

with WebObjects sessions, etc?

Already thanks for any answers,
Peter.



Cookie storage is dependent upon the path and domain of the site serving 
the cookie.  If you can turn on cookie-prompting so you can see cookies 
as they are set then you'll be able to confirm that the cookie has the 
right path and domain.


Turn turn on cookie prompting
Firefox:  Tools->Options->Privacy->Cookies->Keep Cookies (set to ask 
every time).


IE:  Tools->Internet Options->Privacy->Settings->Advanced
Override cookie handling set first party cookies to prompt and set third 
party cookies to prompt.


When the prompt comes up check the details of the cookie.

-arturo
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Tomcat fails denies access to ADMIN/MANAGER app

2005-11-30 Thread Jeremy Matthews
FYI,

We roll our own version of Tomcat (5.5.12), assorted plugins and jars, scripts, 
etc, and offer it to all WO folks (really, the world!)
It works with the manager and admin apps...find it here:

http://www.versiontracker.com/dyn/moreinfo/macosx/27151
http://www.macupdate.com/info.php/id/18567
http://mac.softpedia.com/get/Development/Java/Tomcat-by-SW.shtml

Questions?
Let me know.

Thanks,
jeremy
SISU Works
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


TCPMonitor shows initial wsdl lookup but not invoke calls

2005-11-30 Thread Cara MacNish


Hi, I have a basic web service example working and am trying to use  
TCPMonitor to view the SOAP messages for the method invocations. With  
the help of a googled websphere document (the apple doc only gives  
instuctions for using it with D2WS and makes no sense otherwise) I  
worked out how it works. Its now catching messages that appear to  
contain the whole wsdl spec of all the methods and data types, but I  
cannot get it to catch an invoke call - ie the SOAP package of an  
actual method invocation - despite the fact that the methods are  
working fine.


The only conjecture I can think of is that, while I point the client  
to the TCPMonitor listen port, when it first looks up the wsdl, it  
passes through the TCPMonitor (the message I get) but that then  
rather than using the port I've pointed it to (the listen port) for  
subsequent requests, it gets the port published in the wsdl and uses  
that for all subsequent requests, thus bypassing the monitor. Does  
that make sense? If so, then I could get around this if I edited the  
wsdl, but I assume this only exists "in the server's memory" as I  
can't find any file for it.


Am I missing something?

Cheers
Cara

ps. Thanks for the humour Wolfram :)

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Finding out client IP.

2005-11-30 Thread Gennady Kushnir
I know, i have Apache.but i don't have WO Server installod. and thus NO WOMonitor also.And please give me more info how to"can set the WOPort to the port which monitor has and the WOMonitorEnabled Yes" Thanks in advanceGennady On 30.11.2005, at 17:26, Seejo Pylappan wrote:by webserver I mean Apache. It should already be installed on the Mac box, start it. Configure one instance (without autorecover) in monitor. Then from Xcode,  you can set the WOPort to the port which monitor has and the WOMonitorEnabled Yes and then you should be able to hit the app by http://hostname/cgi-bin/WebObjects/appnameOn Nov 30, 2005, at 8:18 AM, Gennady Kushnir wrote:Thank you.But how do I deploy it locally using WebServer, while developing (just to test)?Should I install WO server on my developer machine? Thanks in advanceGennady ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Re: Java Bridge for beginners

2005-11-30 Thread Robert Walker
I believe that the Java Bridge is still being used extensively for  
Cocoa Java.  If you visit the Reference Library for Cocoa there is  
section dedicated to Java.  There are a number of documents and some  
example code showing how to integrate Obj-C and Java.


http://developer.apple.com/referencelibrary/Cocoa/index.html

On Nov 30, 2005, at 6:20 AM, Alexander Kholodovitch wrote:


Hello, All!
Excuse, who can help me? I write on Java. But I should cause the  
classes written on Objective-C (Objective-C++). Tried to read about  
Java Bridge. But could understand not all. Some materials have  
become outdated. For example, about Java Wrapper.


Somebody can send the reference to a simple example of use  
Objective-C of classes from Java (the best variant - source codes  
of the project)? Or on step-by-step instructions, for achievement  
of similar result.


Alexandr Kholodovitch
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/robertwalker1% 
40mac.com


This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: what are the limitations of the JNDIAdapter?

2005-11-30 Thread Benjamin J Doherty

Friends,

I've pushed ahead with the JNDIAdapter and settled on a paradigm of  
mapping LDAP-style objects to Java-style objects. Some problems and  
questions still remain, especially with respect to relationships  
between JNDI objects and anything that involves reading or writing  
the relativeDistinguishedName attribute.


However, I believe I'm closer to my goal of being able to use  
auxiliary classes. Here's my method:


I created a set of base classes for every objectClass in the schemas  
on my LDAP server all in a single EOModel. The base of my searches is  
just the nameless root (""), so I also have needed to create  
additional EOModels for any functional instance of my EOF classes.  
All the base classes are functionally abstract in that they're never  
instantiated in my application, but I'm not declaring them abstract.  
What's important here is that I've implemented inheritance from Top  
down for each class. So almost every class has a parent. (A few  
auxiliary classes don't even inherit from Top.) I also start creating  
custom business logic for these classes, so for example inetOrgPerson  
has some special methods that automatically generate a cn attribute  
to be used in the relativeDistinguishedName, etc. Here's the  
description of my generic inetOrgPerson class:


className = "org.mygroup.directory.InetOrgPerson";
name = inetOrgPerson;
parent = OrganizationalPerson;

Then I create another EOModel for parts of the LDAP tree where I'm  
going to actually be creating entries. I named them after their RDN,  
but that's not important. Here my concrete instances of classes are  
just copied and pasted from the base model:


className = "org.mygroup.directory.Staff"; name = Staff;

It's important to know that org.mygroup.directory.Staff inherits from  
org.mygroup.directory.InetOrgPerson. I copied the inetOrgPerson  
entity from my base classes and pasted that into the new EOModel with  
a new name. You can't give the new class a parent, because EOF  
considers the two classes to be in separate "databases," so it can't  
do a deep fetch, so it complains and dies.


For me, all my Staff are inetOrgPerson-classed and posixAccount- 
classed. Because posixAccount is auxiliary, I've interpreted that as  
an interface. I got EOGenerator to give me a _posixAccount class  
which I modified into an interface named posixAccount. Now I can  
paste the grubby details from the _posixAccount class into my classes  
which implement the posixAccount interface. There's really nothing  
magical going on here. It's just a cheap and easy way to always get  
good methods for my interface by pasting the generated ones into my  
superclass.


This allows me to edit existing entries in the LDAP database. I can  
edit all the attributes for my Staff records, not just those from  
either inetOrgPerson or posixAccount classes.


How do I create records with both objectClasses inetOrgPerson and  
posixAccount? This is speculative now, and I will report more later.  
If you've got cautionary tales, please tell me so I don't repeat your  
mistakes. I've discovered that I can make the objectClass property in  
EOF visible to the server side. It's type also needs to be NSArray  
instead of String. What I can say is that THIS DOES NOT CAUSE MY APP  
TO CRASH. Yay! But now EOF won't generate the objectClass  
automatically, so I need to create it myself in the business logic.


What have I learned so far?

1.  When confronted with multiple inheritance, choose the parent  
class that will bring in the most custom logic.
2.  Just like in LDAP, you should build around structural classes.  
Map auxiliary LDAP classes onto java interfaces.
3.  It's not harmful to cast multi-valued LDAP attributes as NSArray,  
but then you need to deal with some special situations. I believe  
Chuck Hill posted some code about dealing with multi-valued  
attributes on the list a few years ago, and that's useful. Basically  
you need classes to handle actual multi-valued attributes and those  
multi-valued attributes that may only hold a single value in a  
particular instance and so EOF hands off a String instead of a NSArray.


What am I gonna do now? I must write a method which checks for the  
existence of the appropriate object classes (somewhere around  
awakeFromInsert probably) and sets them if necessary. If that works,  
I'll use inheritance to my advantage and make all superclasses  
provide their type.


If that doesn't work, I'm going to have to create some structural  
subclasses that inherit from multiple places. So MyorgStaff would  
inherit from inetOrgPerson and posixAccount. Not elegant but it will  
work.


Cheers,

Benjamin in Chicago



smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubs

Re: Finding out client IP.

2005-11-30 Thread Gennady Kushnir
Thank you.But how do I deploy it locally using WebServer, while developing (just to test)?Should I install WO server on my developer machine? Thanks in advanceGennady On 30.11.2005, at 15:44, Seejo Pylappan wrote:You need to disable DirectConnect mode and then deploy the application using a WebServer to get those headers.-SeejoOn Nov 30, 2005, at 7:38 AM, Gennady Kushnir wrote:Hello, List.Can WO somehow realize, from what IP the request is received?I need to restrict some functions of my app to be available from internal LAN only.The method proposed in "Practical WebObjects" does not work.And I can't find any WORequest's header containing client IP.I made all headers (public NSDictionary headers()) to show up on the screen - and client IP was not mentioned there.Perhaps it is because I test my app running it to Direct Connect?But I successfully connected to it from another comp on the net - ant still no client IP in headers. Thanks in advanceGennady  ___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:http://lists.apple.com/mailman/options/webobjects-dev/radwar%40mac.comThis email sent to [EMAIL PROTECTED]  ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Re: Finding out client IP.

2005-11-30 Thread Tanmoy Roy
Hi Gennady,
Please find below a code piece that we use for getting the client IP.

public String getIpFromWOContext (WOContext iContext) {
String  aUserIP = null;

if (iContext != null) {
if (iContext.request() != null )
aUserIP = iContext.request().headerForKey("remote_addr");
}
return aUserIP;
}

Thanks,
Tanmoy

On 11/30/05, Gennady Kushnir <[EMAIL PROTECTED]> wrote:
> Hello, List.
>
> Can WO somehow realize, from what IP the request is received?
> I need to restrict some functions of my app to be available from internal
> LAN only.
>
> The method proposed in "Practical WebObjects" does not work.
> And I can't find any WORequest's header containing client IP.
> I made all headers (public NSDictionary headers()) to show up on the screen
> - and client IP was not mentioned there.
>
> Perhaps it is because I test my app running it to Direct Connect?
> But I successfully connected to it from another comp on the net - ant still
> no client IP in headers.
>
>
> Thanks in advance
> Gennady
>
>
>  ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/tanmoy.roy%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
>


--
Best,
Tanmoy
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Finding out client IP.

2005-11-30 Thread Stefan Klein




Hi,

take a look at 

http://wodev.spearway.com/cgi-bin/WebObjects/WODev.woa/wa/Main?wikiPage=BrowserIPAddress

Greetings 
Stefan

Gennady Kushnir schrieb:
Hello, List.
  
  
  Can WO somehow realize, from what IP the request is received?
  I need to restrict some functions of my app to be available from
internal LAN only.
  
  
  The method proposed in "Practical WebObjects" does not work.
  And I can't find any WORequest's header containing client IP.
  I made all headers (public
  NSDictionary headers()) to
show up on the screen - and client IP was not mentioned there.
  
  
  Perhaps it is because I test my app running it to Direct Connect?
  But I successfully connected to it from another comp on the net
- ant still no client IP in headers.
  
  
   
  Thanks in advance
  Gennady
  
   
  
  

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/stefan.klein%40kess-gmbh.de

This email sent to [EMAIL PROTECTED]



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Re: Finding out client IP.

2005-11-30 Thread Seejo Pylappan
You need to disable DirectConnect mode and then deploy the application using a WebServer to get those headers.-SeejoOn Nov 30, 2005, at 7:38 AM, Gennady Kushnir wrote:Hello, List.Can WO somehow realize, from what IP the request is received?I need to restrict some functions of my app to be available from internal LAN only.The method proposed in "Practical WebObjects" does not work.And I can't find any WORequest's header containing client IP.I made all headers (public NSDictionary headers()) to show up on the screen - and client IP was not mentioned there.Perhaps it is because I test my app running it to Direct Connect?But I successfully connected to it from another comp on the net - ant still no client IP in headers. Thanks in advanceGennady  ___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:http://lists.apple.com/mailman/options/webobjects-dev/radwar%40mac.comThis email sent to [EMAIL PROTECTED]  ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Finding out client IP.

2005-11-30 Thread Gennady Kushnir
Hello, List.Can WO somehow realize, from what IP the request is received?I need to restrict some functions of my app to be available from internal LAN only.The method proposed in "Practical WebObjects" does not work.And I can't find any WORequest's header containing client IP.I made all headers (public NSDictionary headers()) to show up on the screen - and client IP was not mentioned there.Perhaps it is because I test my app running it to Direct Connect?But I successfully connected to it from another comp on the net - ant still no client IP in headers. Thanks in advanceGennady  ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

You have backtracked too far problem

2005-11-30 Thread Peteris Krisjanis
I have app, which stays on Main WOComponent all the time. I use  
WOConditionals to show additional partial WOComponents which are made  
to be 'plugged in' in page. I have one such big partial WOComponent  
which holds many small partial WOComponents. I activate it when user  
log ins (with WOConditional). However, after that when try to click  
on links which are binded to actions to turn on another WOConditional  
and show another partial WOComponent. These links where created in  
the begining


Before I put in big WO custom object, other partial WOComponents with  
WOConditionals showed up perfectly. But _now_ (with that big one  
active) when I click on link, I get "You have backtracked too far"  
message. As far as I debuged, links to actions seems to be 'too old'.  
How to create so they would fefreshed each time I change page this way?


How to deal with such situation?

Peter.

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: Java Bridge for beginners

2005-11-30 Thread Helge Staedtler
Hi Alexandr,

there is some interesting example at www.wocode.com

http://WOCode.com/cgi-bin/WebObjects/WOCode.woa/wa/ShareCodeItem?itemId=430

which makes use of the objective-c classes/frameworks from apple through
native access via java. i tried it personally an also played a little with
the code to manipulate it in the one or the other direction. perhaps it
might be a starting point for you.

regards,
helge

p.s.: why do you cross-post this question to so many lists? people clicking
on "Anser to all..." won't have in every case rights to post to the other
lists. my response goes to the webobjects-dev-list only.


Am 30.11.2005 12:20 Uhr schrieb "Alexander Kholodovitch" unter
<[EMAIL PROTECTED]>:

> Hello, All!
> Excuse, who can help me? I write on Java. But I should cause the classes
> written on Objective-C (Objective-C++). Tried to read about Java Bridge. But
> could understand not all. Some materials have become outdated. For example,
> about Java Wrapper.
> 
> Somebody can send the reference to a simple example of use Objective-C of
> classes from Java (the best variant - source codes of the project)? Or on
> step-by-step instructions, for achievement of similar result.
> 
> Alexandr Kholodovitch
> 
>  ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/lgxxl%40web.de
> 
> This email sent to [EMAIL PROTECTED]

--
Helge Städtler

- Expect and Respect. 


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Java Bridge for beginners

2005-11-30 Thread Alexander Kholodovitch

Hello, All!
Excuse, who can help me? I write on Java. But I should cause the classes 
written on Objective-C (Objective-C++). Tried to read about Java Bridge. But 
could understand not all. Some materials have become outdated. For example, 
about Java Wrapper.


Somebody can send the reference to a simple example of use Objective-C of 
classes from Java (the best variant - source codes of the project)? Or on 
step-by-step instructions, for achievement of similar result.


Alexandr Kholodovitch 


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: WOSession and setStoresIDsInCookies method

2005-11-30 Thread Helge Staedtler
I always use the simple way of wrapping a frame around the application which
loads the webobjects-urls inside of it.
this way users always have a valid url to bookmark. only in apps with
direct-actions as default-startup-situation I leave away the frame.

you can also popup a modal window via javascript, that way people do not see
any url at all AND whats even better they do not have any backbutton any
more. ;-)

using rewrites you can shorten the url cutting down the base-url i think,
but you will still have the "number.number.number" following the base-url
because thats how webobjects stores the state.

if there does exist something to eliminate even this part of the url through
cookies and rewrites I would be interested in it, too.

regards,
helge


Am 30.11.2005 10:00 Uhr schrieb "Peteris Krisjanis" unter
<[EMAIL PROTECTED]>:

> I want to store session and instance IDs in cookies, so I add two
> methods in my Session.java:
> 
> setStoresIDsInCookies(true);
> setStoresIDsInURLs(false);
> 
> And I can browse my app without seeing rather large session ID.  And
> for example, my URL
> looks like that:
> http://dev-peteris.local:59359/cgi-bin/WebObjects/johaidi_server.woa/
> wo/0.20.0
> 
> However, when I clean up url and go to
> http://dev-peteris.local:59359/cgi-bin/WebObjects/
> johaidi_server.woa/, session seems to be vanished.
> 
> What I should do that session id is left stored in cookies and I can
> still manipulate with URL?
> 
> Also is there any useful references (posts, emails) for "hiding"
> WebObjects url and creating good one? How url_rewrite works
> with WebObjects sessions, etc?
> 
> Already thanks for any answers,
> Peter.
>  ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/lgxxl%40web.de
> 
> This email sent to [EMAIL PROTECTED]


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


WOSession and setStoresIDsInCookies method

2005-11-30 Thread Peteris Krisjanis
I want to store session and instance IDs in cookies, so I add two  
methods in my Session.java:


setStoresIDsInCookies(true);
setStoresIDsInURLs(false);

And I can browse my app without seeing rather large session ID.  And  
for example, my URL

looks like that:
http://dev-peteris.local:59359/cgi-bin/WebObjects/johaidi_server.woa/ 
wo/0.20.0


However, when I clean up url and go to
http://dev-peteris.local:59359/cgi-bin/WebObjects/ 
johaidi_server.woa/, session seems to be vanished.


What I should do that session id is left stored in cookies and I can  
still manipulate with URL?


Also is there any useful references (posts, emails) for "hiding"  
WebObjects url and creating good one? How url_rewrite works

with WebObjects sessions, etc?

Already thanks for any answers,
Peter.
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com