-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
… class
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package er.extensions.appserver; | ||
|
||
import javax.servlet.ServletContext; | ||
|
||
import com.webobjects.appserver.WORequest; | ||
import com.webobjects.appserver.WOResponse; | ||
|
||
/** | ||
* <p>If you are deploying in a servlet container like Tomcat, this application class | ||
* allows you automatically serve static resources from the "static" directory using | ||
* the static resource servlet that is built into Tomcat and Jetty. | ||
* <p> | ||
* When building you need to copy the static resources into the "static" folder by | ||
* adding some lines to the end of the "ssdd" target in build.xml: | ||
* <ul> | ||
* <li>1) Change the WOAppMode to Deployment</li> | ||
* <li>2) Copy "WebServerResources/" to "/static/YourApp.woa/Contents/WebServerResources/" directly inside the root of the .war file</li> | ||
* <li>3) Copy "*.Framework/WebServerResources/" to "/static/Frameworks/*.Framework/WebServerResources/"</li> | ||
* </ul> | ||
* | ||
* @see <a href="http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/servlets/DefaultServlet.html">Tomcat 7.0 DefaultServlet Docs</a> | ||
* | ||
* @author john | ||
* | ||
*/ | ||
public class ERXServletApplication extends ERXApplication { | ||
|
||
private boolean didSetBaseUrl = false; | ||
|
||
@Override | ||
public WOResponse dispatchRequest(WORequest request) { | ||
if (!didSetBaseUrl) { | ||
didSetBaseUrl = true; | ||
ServletContext servletContext = (ServletContext) request.userInfo().get("ServletContext"); | ||
if (servletContext != null) { | ||
setApplicationBaseURL(servletContext.getContextPath() + "/static/"); // "static" is the built-in static resource servlet for Tomcat and Jetty | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
johnthuss
via email
Author
Member
|
||
setFrameworksBaseURL(servletContext.getContextPath() + "/static/Frameworks/"); | ||
} | ||
} | ||
|
||
return super.dispatchRequest(request); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// ERXAjaxContext.java | ||
// Project armehaut | ||
// | ||
// Created by ak on Mon Apr 01 2002 | ||
// | ||
package er.extensions.appserver.ajax; | ||
|
||
import com.webobjects.appserver.WOContext; | ||
import com.webobjects.appserver.WORequest; | ||
import com.webobjects.jspservlet.WOServletContext; | ||
|
||
/** | ||
* <span class="en"> | ||
* ERXAjaxContext provides the overrides necessary methods for partial form | ||
* submits to work. If you want to use the Ajax framework without using other | ||
* parts of Project Wonder (i.e. ERXSession or ERXApplication), you should steal | ||
* all of the code in ERXAjaxSession, ERXAjaxApplication, and ERXAjaxContext. | ||
* </span> | ||
* | ||
* <span class="ja"> | ||
* ERXAjaxContext は部分的なフォーム・サブミットの機能を提供します。 | ||
* </span> | ||
* | ||
* @author mschrag | ||
*/ | ||
public class ERXAjaxServletContext extends WOServletContext { | ||
|
||
public ERXAjaxServletContext(WORequest request) { | ||
super(request); | ||
} | ||
|
||
/* | ||
* NOTE: This class was copied directly from ERXAjaxContext. Keep it in sync with that. | ||
*/ | ||
@Override | ||
public boolean wasFormSubmitted() { | ||
boolean wasFormSubmitted = super.wasFormSubmitted(); | ||
if (wasFormSubmitted) { | ||
WORequest request = request(); | ||
String partialSubmitSenderID = ERXAjaxApplication.partialFormSenderID(request); | ||
if (partialSubmitSenderID != null) { | ||
// TODO When explicitly setting the "name" binding on an input, | ||
// the following will fail in the takeValuesFromRequest phase. | ||
String elementID = elementID(); | ||
if (!partialSubmitSenderID.equals(elementID) | ||
&& !partialSubmitSenderID.startsWith(elementID + ",") | ||
&& !partialSubmitSenderID.endsWith("," + elementID) | ||
&& !partialSubmitSenderID.contains("," + elementID + ",")) { | ||
String ajaxSubmitButtonID = ERXAjaxApplication.ajaxSubmitButtonName(request); | ||
if (ajaxSubmitButtonID == null || !ajaxSubmitButtonID.equals(elementID)) { | ||
wasFormSubmitted = false; | ||
} | ||
} | ||
} | ||
} | ||
return wasFormSubmitted; | ||
} | ||
|
||
} |
9 comments
on commit ad6a032
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Here the same error. Have comment it out for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is the JavaXML library from WebObjects. It has an old version of the Servlet API. I'm fixing this problem for the Maven build by removing the dependency to JavaXML. I'm not sure, however, how to solve it in the Ant build. Can you force the ERJars library before the JavaXML library in the classpath order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERJars is first, JavaXML is last.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERJars is already on top:
$ cat Frameworks/Core/ERExtensions/.classpath
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="Sources"/>
<classpathentry exported="true" kind="con" path="WOFramework/ERJars"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaWOExtensions"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaEOAccess"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaEOControl"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaEOProject"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaJDBCAdaptor"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaWebObjects"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaWOJSPServlet"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaXML"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaWebServicesSupport"/>
<classpathentry exported="true" kind="con" path="WOFramework/JavaFoundation"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
I've tried a clean John, it doesn't fix it. Are you saying that you don't see the errors flagged by Eclipse?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I knew you wouldn't commit them if you did. I meant what is the relevant difference with our environments? I am using Java 6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have the ERJars project open in Eclipse?
No, I didn't. And that's the fix. Thanks John.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Wonder 7.
John, Eclipse is flagging this line (and the next) as errors for me, claiming
ServletContext.getContextPath()
is undefined. I'm using Java 6. Should this compile under Java 6?