Web.xml:welcome file displayed incorrectly - file

Welcome file is not displayed correctly on hosting.
web.xml:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
on local Tomcat:
http://localhost:8099/Teal-0.1-BETA/ is OK
equals to
http://localhost:8099/Teal-0.1-BETA/index.html is OK
on hosting:
http://domain/index.html is OK
http://domain/ is displayed non correctly
As I observed this is displayed not correctly too:
http://domain/index.xhtml
I suspect web.xml config. Looks like problem in .html vs .xhtml extension.
Real file name is index.xhtml

I think that the problem is that you use JSF, but Tomcat renders welcome-file only with JSP engine. That might have been adressed in newer tomcat (7.x) which you have locally, but server uses older Tomcat.
But that's just my guess. Still I don't have much info.
Either case, try setting a welcome page to a plain file with immediate redirection to /index.html . Or better, handle it in Apache (or whatever you have in front of Tomcat).

Related

Does RemoteApiOption method useServiceAccountCredential works with P12 file?

Does useServiceAccountCredential works with P12 file. I am trying to use it in Java and get error com.google.appengine.repackaged.com.google.api.client.http.HttpResponseException‌​: 302 Found
Yes it does. You need to have an AppEngine app serving the remote API. E.g., you would have a python app, with the following lines in app.yaml:
- url: /remoteapi.*
script: google.appengine.ext.remote_api.handler.application
Or java app with the following in web.xml:
<servlet>
<display-name>Remote API Servlet</display-name>
<servlet-name>RemoteApiServlet</servlet-name>
<servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>RemoteApiServlet</servlet-name>
<url-pattern>/remote_api</url-pattern>
</servlet-mapping>
Please note that depending on your client, it might call a bit different url, e.g. /remote_api
Also, if you have deployed the AppEngine app in a module, take that into account in the client code, you would have:
RemoteApiOptions raoptions = new RemoteApiOptions()
.server("my-module-dot-my-project.appspot.com", 443)
.useServiceAccountCredential("my-service-account-id", "my-p12-file.p12");
RemoteApiInstaller installer = new RemoteApiInstaller();
installer.install(raoptions);
Hope that helps!

Ajax Proxy in WebSphere Portal

I am not able to make the ajax proxy work in WebSphere Portal 8. I tried using the Application specific ajax proxy method.
Below are my proxy config xml and web.xml
<?xml version="1.0" encoding="UTF-8"?>
<proxy:proxy-rules
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:proxy="http://www.ibm.com/xmlns/prod/sw/ajax/proxy-config/1.1">
<proxy:mapping url="http://api.wunderground.com/api/<key>/conditions/q/CA/San_Francisco.json" contextpath="/get/weatherData" />
<proxy:policy url="http://api.wunderground.com/api/<key>/conditions/q/CA/San_Francisco.json" acf="none">
<proxy:actions>
<proxy:method>GET</proxy:method>
</proxy:actions>
<proxy:headers></proxy:headers>
<proxy:mime-types></proxy:mime-types>
<proxy:cookies></proxy:cookies>
<proxy:users></proxy:users>
</proxy:policy>
<proxy:ipfilter></proxy:ipfilter>
</proxy:proxy-rules>
web.xml
<servlet>
<servlet-name>ProxyServlet</servlet-name>
<servlet-class>com.ibm.wps.proxy.servlet.ProxyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ProxyServlet</servlet-name>
<url-pattern>/get/weatherData</url-pattern>
</servlet-mapping>
The issue need to be inside of the ajax proxy xml you copied. the is corrupting the xml syntax of the document.
An XML validator (like https://www.xmlvalidation.com/ ) shows this error
The value of attribute "url" associated with an element type "proxy:mapping" must not contain the '<' character.
You could use the following mapping config to correct the problem then all information appended to get/weatherData will be attached to /api/.
<proxy:mapping
url="http://api.wunderground.com/api/"
contextpath="/get/weatherData" />
As I do not know what means in your application maybe it would be as simple as replacing with the real value

Deploying CXF webservices in Tomcat

I am trying to deploy a web service in Tomcat7 using maven.
Below I provide some configuration info:
web.xml
...
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
...
pom.xml
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/services/userinfo</path>
...
Given the <url-pattern>/services/*</url-pattern> and <path>/services/userinfo</path> configuration, the URL http://localhost:8080/services/userinfo shows 404.
If using instead <url-pattern>/*</url-pattern> everything works as expected (i.e. http://localhost:8080/services/userinfo shows the list of available methods).
The question:
Why /services/* doesn't work in my case?
The path in your tomcat-maven-plugin configuration
<path>/services/userinfo</path>
defines where you are deploying the webapp (the context root). In this case, you are deploying it to
http://localhost:8080/services/userinfo
Check out the webapps directory in your Tomcat installation.
Since you are defining the CXFServlet mapping as /services/*, the CXF service list would show at
http://localhost:8080/services/userinfo/services/
When you re-defined the mapping to /*, it just appeared to work as expected, but that was only because the context root you used and the service listing path you expected were the same.

Jboss webservice error using topdown approach

I started creating a sample webservice using top-down approach in jboss4.2.2 GA.
From the wsdl, i generated stubs using wsconsume
I created a new java class: SalesTaxImpl implementing the interface in the generated stub. Configured #WebService with endpointInterface, portname, wsdllocation.
My war application has the following:
WEB-INF/classes/
WEB-INF/wsdl/SalesTaxService.wsdl
WEB-INF/web.xml
In web.xml i have,
<web-app>
<servlet>
<servlet-name>SalesTax</servlet-name>
<servlet-class>com.hp.np.ws.SalesTaxImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SalesTax</servlet-name>
<url-pattern>/tax</url-pattern>
</servlet-mapping>
</web-app>
After placing the war in <JBOSS_HOME>/server/default/deploy path, i am getting the following error:
19:25:05,046 INFO [DefaultEndpointRegistry] register: jboss.ws:context=JbossWST
opDown,endpoint=SalesTax
19:25:05,078 INFO [TomcatDeployer] deploy, ctxPath=/JbossWSTopDown, warUrl=.../
tmp/deploy/tmp13893JbossWSTopDown-exp.war/
19:25:05,171 ERROR [MainDeployer] Could not start deployment: file:/C:/jboss-4.2
.2.GA/server/default/deploy/JbossWSTopDown.war
org.jboss.ws.WSException: Cannot build meta data: Cannot get URL for: WEB-INF/ws
dl/SalesTaxService.wsdl
at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.bu
ildWebServiceMetaData(JAXWSWebServiceMetaDataBuilder.java:207)
at org.jboss.ws.metadata.builder.jaxws.JAXWSServerMetaDataBuilder.setupP
roviderOrWebService(JAXWSServerMetaDataBuilder.java:50)
I tried giving different combination, but no luck

Sessions enabled - do we have to clean them up ourselves?

When we turn sessions on in google app engine like:
// appengine-web.xml
<sessions-enabled>true</sessions-enabled>
does app engine automatically clean up expired sessions, or do we have to do it ourselves? After turning them on, I see in the datastore that some entries are being generated like _ah_session, I'm wondering if those are them?
Thanks
Yes those are the session entries. Google's app engine documentation includes the following:
The implementation creates datastore entities of the kind _ah_SESSION, and memcache entries using keys with a prefix of _ahs.
(http://code.google.com/appengine/docs/java/config/appconfig.html)
As for cleaning up session data. I found the following 2 discussions:
http://groups.google.com/group/google-appengine-java/browse_thread/thread/4f0d9af1c633d39a
http://www.mail-archive.com/google-appengine-java#googlegroups.com/msg01372.html
HTH,
Steve
From Cleaning Up Expired Sessions From App Engine Datastore:
You need to configure the cleanup servlet provided by Google to be run regularly. Note: the servlet cleans at most 100 entries at time. Be sure to decide how often do you need this to be called and determine the interval as appropriate to you.
In web.xml:
<web-app...>
<servlet>
<servlet-name>_ah_sessioncleanup</servlet-name>
<servlet-class>com.google.apphosting.utils.servlet.SessionCleanupServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>_ah_sessioncleanup</servlet-name>
<url-pattern>/_ah/sessioncleanup</url;-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>session-cleanup</web-resource-name>
<url-pattern>/_ah/sessioncleanup</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
...
</web-app>
And in cron.xml:
<cronentries>
<cron>
<url>/_ah/sessioncleanup?clear</url>
<description>Clean up sessions</description>
<schedule>every 15 minutes</schedule>
</cron>
...
</cronentries>

Resources