wink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paulo Borges <abuda...@hotmail.com>
Subject RE: Custom Request Handler - Amber
Date Tue, 13 Mar 2012 13:42:39 GMT


Make sure you have the path to your property file set properly in your web.xml. Mine looks
like below:

    <init-param>
            <param-name>propertiesLocation</param-name>
            <param-value>/WEB-INF/classes/com/swg/srms/jaxrs/handler.properties</param-value>
        </init-param>

It took me a while to figure it out but my handler now works
Date: Wed, 7 Mar 2012 19:20:49 -0500
Subject: Re: Custom Request Handler - Amber
From: chris@influen.se
To: wink-user@incubator.apache.org

I believe I am past the compilation errors but I am unable to have the customer handler actually
be functional.
Here is the Handler Factory Class I created:








public class OauthHandlersFactory extends org.apache.wink.server.handlers.HandlersFactory
{
	
	final private static Logger  logger  = LoggerFactory.getLogger(DeploymentConfiguration.class);

	
	public OauthHandlersFactory() {
        /* This constructor must exist because it is the only one called.*/
    }


    public List<? extends RequestHandler> getRequestHandlers() {
    	logger.debug("Oauth Handler Factory Loaded");
       return Arrays.asList(new OauthRequestHandler());
    }
}Then I have the OauthRequestHandler class:







public class OauthRequestHandler implements RequestHandlerwhich I have the handleRequest method
in the class:








   public void handleRequest(MessageContext context, HandlersChain chain)Inside the RequestHandle
I have tried to throwing an exception and logging information but nothing is working.  
Also, I have a wink-properties.properties file with the following line:







wink.handlersFactoryClass=se.influen.wink.handler.OauthHandlersFactoryand in my web.xml file
I have added:







 <init-param>
			<param-name>propertiesLocation</param-name>

			<param-value>wink-properties.properties</param-value>

		</init-param>Any thoughts on anything I am missing?  It doesn't seem to generate any
errors.
On Wed, Mar 7, 2012 at 1:51 PM, Raymond Feng <enjoyjava@gmail.com> wrote:

Hi,
It seems that your code has compilation errors.
Thanks,Raymond
On Mar 4, 2012, at 8:53 PM, Chris Comstock wrote:




I am working to try and incorporate Amber into Wink for Oauth and running

into an error on the custom Handler.  I have created a HandlerFactory,

RequestHandler, and added the wink-properities.properties configuration as

well as modified the web.xml with the properties file location.



The error is related to my HandlerFactory class to load the RequestHandler:



    public List<? extends org.apache.wink.server.handlers.RequestHandler>

getRequestHandlers() {



        return Arrays.asList(se.influen.wink.handler.OauthRequestHandler);



    }



Here is the error:



wink/handler/OauthHandlersFactory.java:[15,44] cannot find symbol



[ERROR] symbol  : class handler





Is there something I am missing to get this custom handler to work? Or is

there a better way to incorporate Amber into a Wink application?  At the

current time I am doing nothing more than attempting to get the handler to

generate a response.





 		 	   		  
Mime
View raw message