• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Obtaining a request
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obtaining a request


  • Subject: Re: Obtaining a request
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 14 Feb 2006 14:39:56 -0800


On Feb 14, 2006, at 11:20 AM, Ian Coleman wrote:

Chuck Hill wrote:


On Feb 14, 2006, at 6:56 AM, Ian Coleman wrote:

We are trying to get information from a protal that is hosting the WO app, this is what I am using to try to do so.

public Main(WOContext context) {
super(context);
WORequest request = context.request();
WOServletContext wosc = new WOServletContext (request); //this is where I get a java.lang.NullPointerException


What is the stack trace?

java.lang.NullPointerException
at com.webobjects.jspservlet.WOServletContext.<init> (WOServletContext.java:40)
at Main.<init>(Main.java:44)

Hard to say what is causing the NPE. context.request() should be returning a valid object. Have you tried printing it out before trying to use it? Is is null?



Isn't context already a WOServletContext (which is a subclass of WOContext)? Can you just do:
WOServletContext wosc = (WOServletContext) context;

When I tried that it throws java.lang.ClassCastException

at Main.<init>(Main.java:45)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:39)

That seems odd. This WOApp is deployed in a servlet container?



Chuck


IPortletContext newFact = PortletContextFactory.createPortletContext (wosc.httpServletRequest (), wosc.httpServletResponse());
IPortletContext newFact = PortletContextFactory.createPortletContext (wosc.httpServletRequest (), wosc.httpServletResponse());
IPortletRequest newReq = newFact.getRequest();
IPortletUser portletUser = newFact.getUser();
String uName = portletUser.getUserName();


I thought that the context would have a request. Am I wrong? Do I need to create a request?




--
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 (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Obtaining a request (From: Ian Coleman <email@hidden>)
 >Re: Obtaining a request (From: Chuck Hill <email@hidden>)
 >Re: Obtaining a request (From: Ian Coleman <email@hidden>)

  • Prev by Date: Re: Quick Image scale down
  • Next by Date: Re: EOGenerator & Inheritance (on Inheritance vs Status pattern)
  • Previous by thread: Re: Obtaining a request
  • Next by thread: Quick Image scale down
  • Index(es):
    • Date
    • Thread