-
1. Re: Legacy code: Integrating with existing servlet
mirko27 Jan 20, 2008 11:55 AM (in response to tonylmai)You can Inject only to a seam component? And seam component is the one which declares @Name annotation. I dont see that on your servlet.
-
2. Re: Legacy code: Integrating with existing servlet
dhinojosa Jan 20, 2008 4:09 PM (in response to tonylmai)you can also use Component.getInstance("component Name"); and remove all @In annotations.
-
3. Re: Legacy code: Integrating with existing servlet
nickarls Jan 20, 2008 4:20 PM (in response to tonylmai)Are you using a web:context-filter as documented in 25.1.4.7?
-
4. Re: Legacy code: Integrating with existing servlet
tonylmai Jan 21, 2008 1:23 AM (in response to tonylmai)I only enabled the servlet filter suggested in the document.
<web:context-filter url-pattern="*" />
I must be missing something. The document mentioned that I need to pass along the conversationId but I am sure how to do that.
Any suggestion?
Thanks -
5. Re: Legacy code: Integrating with existing servlet
tonylmai Jan 21, 2008 1:34 AM (in response to tonylmai)BTW, cid is on the URL. Is that sufficient for the servlet filter or I need to do something more?
-
6. Re: Legacy code: Integrating with existing servlet
nickarls Jan 21, 2008 1:37 AM (in response to tonylmai)I think it's mostly using Conversation.getId() for returning new conversations, you shouldn't need to use it normally(?)
And Contexts.lookupInStatefulContexts("nameofthebean") still returns null? -
7. Re: Legacy code: Integrating with existing servlet
tonylmai Jan 21, 2008 1:38 AM (in response to tonylmai)Component.getInstance("component Name") threw the following exceptions:
java.lang.IllegalStateException: No application context active
:( -
8. Re: Legacy code: Integrating with existing servlet
nickarls Jan 21, 2008 1:50 AM (in response to tonylmai)not sure that mapping the "*" is a good idea, try to hit the URL where the servlet is mapped to...
-
9. Re: Legacy code: Integrating with existing servlet
pmuir Jan 21, 2008 5:25 AM (in response to tonylmai)You need to map a specific prefix or suffix as nickarls
says -
10. Re: Legacy code: Integrating with existing servlet
tonylmai Feb 8, 2008 1:58 PM (in response to tonylmai)I have put the specific prefix but I still can't get it to work.
<web:context-filter url-pattern="http://localhost:8080/trading/getchart/" />
My servlet is as followed:public class GetChart extends HttpServlet { private static final long serialVersionUID = -6087384050664740696L; @In("wcQuoteDS") private ChartDatasource quoteDS; protected void doGet(HttpServletRequest request, HttpServletResponse response) ..... try { try { quoteDS = (ChartDatasource) Component.getInstance("wcQuoteDS"); .... // Problematic } catch (Exception e) { e.printStackTrace(); } }
ChartDatasourcebean is as followed:@Scope(ScopeType.APPLICATION) @Name("wcQuoteDS") @Startup(depends={"wcClientMgr"}) public class QuoteDatasource implements .... { @In (required = true) private static ClientManager wcClientMgr; ... {
I can't figure out what is wrong with it. Can someone help?
Thanks
-Tony -
11. Re: Legacy code: Integrating with existing servlet
dustismo Feb 8, 2008 2:36 PM (in response to tonylmai)I sincerely doubt that this is valid:
url-pattern="http://localhost:8080/trading/getchart/"
try this instead:url-pattern="/trading/getchart/*"
also you probably want to create to create the Component if it doesnt already exist in the current convo. ala:quoteDS = (ChartDatasource) Component.getInstance("wcQuoteDS",true);
hope that helps,
Dustin -
12. Re: Legacy code: Integrating with existing servlet
tonylmai Feb 8, 2008 4:06 PM (in response to tonylmai)You were right on with the URL there Dustin. With that fix, the app is up and running now.
Thank you for your advice.
-Tony