Re: Servlet making HTTP requests
Hi,
We are using an application that uses a servlet to perform some JDBC calls
(which take about 30 minutes) and then make some HTTP requests (which takes
about 5 to 10 minutes) to another application.
Once the client has made the request to initiate this process it waits for
the complete process (40 minutes) to complete. I know this is not ideal but
its what we've got to live with.
After a minute or so after the servlet has started making the HTTP requests
the browser stops responding and has a blank frame displayed instead of the
response data. We have assumed that after the servlet makes the HTTP
requests the other application it is not interacting with the HTTP session
on the server the client is connected to and a timeout occurrs. This
termintes the request and is why we see a blank frame. Is this correct ? The
HTTP requests complete successfully in the background.
Any advice would be greatly appreciated.
Kev
Your application is really tough and interesting. Web browser usually has timeout
limit. Proxy server also has timeout limit (usually 30 seconds). If no communication
after such kind of timeout limit, your browser will stop.
When your code calls getWriter() or getOutputStream(), your servlet will flush
all HTTP response header data to your browser and your browser then will get the
response from your servlet. Beyond that, if you don't send any data from your
servlet to your browser before proxy or browser timeout, you can only get a blank
screen.
If you want to monitor how your servlet works, try to BUILD INTERCATION. At least,
send data from your servlet to your browser for each time interval which will
not be longer than browser/proxy timeout. You can send out any information you
like, if your browser understand it. NOTE YOU SHOULD EXPLICITLY CALL FLUSH() of
your OutputStream() or Writer() to flush() your data following each write(). This
way, you can keep the connection alive.
On the other hand, you can also try set content-length field of response to some
predefined number, and set Connection field as Keep-Alive, before you call getWriter()
or getOutputStream(). Then send some data to your browser, for example, one byte
at a time, until you have sent the number of bytes as specified.
"Kev" <[email protected]> wrote:
>Hi,
>
>We are using an application that uses a servlet to perform some JDBC
>calls
>(which take about 30 minutes) and then make some HTTP requests (which
>takes
>about 5 to 10 minutes) to another application.
>
>Once the client has made the request to initiate this process it waits
>for
>the complete process (40 minutes) to complete. I know this is not ideal
>but
>its what we've got to live with.
>
>After a minute or so after the servlet has started making the HTTP requests
>the browser stops responding and has a blank frame displayed instead
>of the
>response data. We have assumed that after the servlet makes the HTTP
>requests the other application it is not interacting with the HTTP session
>on the server the client is connected to and a timeout occurrs. This
>termintes the request and is why we see a blank frame. Is this correct
>? The
>HTTP requests complete successfully in the background.
>
>Any advice would be greatly appreciated.
>
>Kev
>
>
Similar Messages
-
IllegalArgumentException making HTTP request
My MIDlet works beautifully inside the Palm emulator. It makes an HTTP request to my servlet, and correclty handles the binary data it gets back, using HttpConnection.openInputStream().
However, when I run the same MIDlet from my Visor Neo (after first establishing an internet connection), the first "getXxx()" call I make results in an IllegalArgumentException. (I have confirmed that HTTP communications are working between the Visor and my servlet by browsing to my servlet from an HTML browser on the Visor and viewing the HTML sent by my servlet.)
I am still waiting on the Visor ROMs for the emulator from Handspring to see if the problem is with Handspring's version of PalmOS 3.5, but I'm hoping it isn't the Visor.
-kHello
Can someone tell me how to make the Palm Emulator network capable? I want to access a servlet through the palm emulator to test whether the network capability works fine.
Thanks
prasso -
NEED TO INTEGRATE WITH THIRD PARTY (ALPHATRUST) BY MAKING HTTPS REQUEST FRO
We have a custom OA-framework based project going live almost immediately. I am responsible for the piece that needs to
integrate with a service provider, Alphatrust, that we use for signatures. My
code worked fine in my local JDeveloper environment using a java.net.URL object
to get a URLConnection. It turns out that my local configuration is defaulting
to use Sun's http client that is included in the JDK/JRE, while the appserver
has the configuration java.proto .handler.pkgs=HTTPClient which makes it use
(I think) some version of the open source client at
http://www.innovation.ch/java/HTTPClient/. With this configuration my outbound
request sending xml post data fails with a ClassCast exception thrown from
HTTPClient.HTTPConnection.getSSLSocket(HTTPConnection.java:1933). I have two
candidate workarounds in mind.
(1) remove the configuration java.protocol.handler.pkgs=HTTPClient.
I have tested this option and it does fix the problem. However I am concerned that it may have unintended
consequences, such as possibly breaking our Verisign integration.
(2) place an alternate http client library on the classpath, such as Jakarta Commons
HttpClient, and use it. But (a) I don't know exactly how to place extra jar's
onto the classpath on the application server and (b) I don't know what the
support implications vis-a-vis Oracle would be.
Please advise. Would you recommond option (1), (2), or is there yet another option that I have not
thought of? Please treat this request as urgent.
Here is the java code, from my application module, that fails on the application server.
OutputStreamWriter wr = null;
BufferedReader rd = null;
URLConnection conn = null;
// System.getProperties().remove("java.proto .handler.pkgs");
// if I uncomment the above line, it works, but I am concerned about
// the impact on, for example, Verisign integration
URL url = new URL("https://pronto1.alphatrust.com/prontosvr2/prontoxml.asp");
conn =
url.openConnection();
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "text/xml");
Object outs = conn.getOutputStream();
// the last line above throws a ClassCastExceptionNot sure if you have seen oracle.apps.fnd.framework.webui.OAUrl and whether it fits your scenario.
OAUrl class is used for generating, modifying URL objects in OAF.
--Shiv -
Making HTTP requests with content-disposition
I need to write a Java app that can access a web server that returns most content as files (ie. using content-disposition).
Previously I have used something like this to make HTTP GET requests to return files on a web server.
��String strUrl = "http://www.yahoo.com/index.html";
��URL url = new URL( strUrl );
��URLConnection conn = url.openConnection();
��InputStream in = url.openConnection.getInputStream();
��byte[] buf = new byte[conn.getContentLength()];
��in.read( buf, 0, getContentLength() );
This doesn't seem to work when the HTTP header has "content-disposition". Here is the header returned by the web server.
��Server=Microsoft-IIS/4.0
��Date=Thu, 04 Jul 2002 13:18:53 GMT
��Content-Disposition=filename=file.xyz
��Content-Type=text/html
��Cache-control=private
��Transfer-Encoding=chunked
��content-length=30306
The number of bytes actually read (as returned by in.read()) is less than the number of bytes as indicated in the content-length.
How can I handle this?
MikeI have managed to discover that an incorrect content-type header is causing the problems that I have been encountering with file downloads from a web server.
As I mentioned in a previous post the content-length header was not a good indicator of file download success.
My program downloads pictures from the internet, almost always in .jpeg format. I have found that files are successfully downloaded only when the content-type header contains the words: image/jpeg. In some instances although I am trying to download a picture file the http content-type header is stated as being: text/html.
In those instances where text/html is given as the content-type file download fails in so far as the files are not acutally viewable on the native system (Windows varieties in my case).
To determine the error I used the following code:
URLConnection urlConnect = myURL.openConnection();
System.out.println("Http Header, Content-Type: "+urlConnect.getContentType());
System.out.println("Http Header, Content-Length: "+urlConnect.getContentLength());Even though content-length mostly corresponded with the downloaded files length, if the Conten-Type header was wrong then the file was all but useless.
Regards
Davo -
Facing problem while making http request?
Hi Friends,
I have made blackberry application. I am able to download the same using OTA successfully. With the help of this application I am trying to communicate to server using Httpconnection and want to get some response from server. It is working properly when am i trying Blackberry simulator...but whenever I try to Blackberry device(BB Curve 8900) it is not working and device got stuck. After that I have to restart the device. After restarting again application shows "Uncaught Exception" . So I am not able to find out what is exact problem. So if anybody faced this type of problem please suggest me.thanks in advance...
Regards,
hkhan_2005Just a thought. Create Calculated Key Figure. In the formula editor use a Formula Variable, say ZFV_TEST. Use Processing by > Replacement Path; Use Reference Characteristic > Charg..Date Date. In Replacement Path > Replace Variable With > InfoObject, Replace With > Key. Save your variable ZFV_TEST. Goto Dimensions > Date. Formula: Target Date = DATE(Charg..Date + DATE(270)). This works iff your values are just for a few records with same date data sans aggregation. Would suggest you to use constant selection on the selection; as the values may be aggregated. If it doesn't work, you may try using a Virtual KF for each line items. Last option, you may try customer exits. You may refer this [thread |Re: Date range for a variable from number of days enterd;for your reference.
Edited by: Arun Bala G on Oct 29, 2010 6:15 AM -
Plugin login appears after initial weblogic everytime applet makes http request
When I visit a page I get the initial login to the page via the realm followed
by a java plugin loging (shown in attached pictures) every time the applet makes
an http request. This stops the applet working, any idea how I can solve this?
[pictures.doc]Any idea how to do thisn not really sure what you mean. I already inclued the session
Id in the URL. Code we use to open connection is
URL url = new URL(serverProtocol + "://" + serverName + ":" + serverPort + "/"
+ servlet + ((sessionId==null)?"":"?sessionid=" + sessionId));
URLConnection uc = url.openConnection();
uc.setDoOutput(true);
uc.setDoInput(true);
uc.setUseCaches(false);
uc.setRequestProperty("Content-type", "java-internal/" + object.getClass().getName());
Robert Patrick <[email protected]> wrote:
If you are making HTTP requests from within an applet, you will need
to provide the
right HTTP headers to correctly identify that each subsequent request
is from the
previously logged-in user (e.g., the cookie that contains the WLS session
ID
attached to the response from logging in).
andrea bates wrote:
When I visit a page I get the initial login to the page via the realmfollowed
by a java plugin loging (shown in attached pictures) every time theapplet makes
an http request. This stops the applet working, any idea how I cansolve this?
Name: pictures.doc
pictures.doc Type: WINWORD File (application/msword)
Encoding: base64 -
How to send a HTTP request to servlet in java application
I'm new in Java. I need to send a HTTP request with parameters to servlet in a java aplication. Here is my code. It can be compiled but always threw an exceptions when I ran it. Can anyone help?
package coreservlets;
import java.io.*;
import java.net.*;
public class PostHTTP
public static void main(String args[])
throws IOException, UnknownHostException {
try
// URL and servlet
URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
URLConnection c = myURL.openConnection();
c.setUseCaches(false);
c.setDoOutput(true);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
PrintWriter out = new PrintWriter(byteStream, true);
//parameters
String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
out.print(postData);
out.flush();
String lengthString = String.valueOf(byteStream.size());
c.setRequestProperty("Content-Length", lengthString);
c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
byteStream.writeTo(c.getOutputStream());
BufferedReader in = new BufferedReader(new InputStreamReader
(c.getInputStream()));
String line;
//String linefeed = "\n";
//resultsArea.setText("");
while((line = in.readLine()) != null) {
System.out.println(line);
//resultsArea.append(linefeed);
catch(IOException ioe) {
// Print debug info in Java Console
System.out.println("IOException: " + ioe);here are some updates to your code I haven't tested it running
post again if you still have trouble
URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
HttpURLConnection c = (HttpURLConnection)myURL.openConnection();
c.setDoInput(true);
c.setDoOutput(true);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
String lengthString = String.valueOf(byteStream.size());
c.setRequestProperty("Content-Length", lengthString);
c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
PrintWriter out = new PrintWriter(byteStream, true);
//parameters
String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
out.print(postData);
out.flush();
byteStream.writeTo(c.getOutputStream());
// connect
c.connect();
BufferedReader in = new BufferedReader(new InputStreamReader
(c.getInputStream()));
String line;
while((line = in.readLine()) != null)
System.out.println(line); -
How to transfer the http request from applet to servlet/jsp
I use the JTree component to create a navigation of a website,but i don't
know how to connect the tree's nodes with the jsp/servlet.
I mean how to transfer the http request from the applet to a jsp.
I use the "<frameset>" mark which will divide the web browse into 2 blocks.
The left side is Applet,and the right side is the linked jsp page.
what I say is as the weblogic console layout.
who can help me!!!
Thank You!I use the JTree component to create a navigation of a website,but i don't
know how to connect the tree's nodes with the jsp/servlet.
I mean how to transfer the http request from the applet to a jsp.
I use the "<frameset>" mark which will divide the web browse into 2 blocks.
The left side is Applet,and the right side is the linked jsp page.
what I say is as the weblogic console layout.
who can help me!!!
Thank You! -
Doing an http request in servlet
What's the code to do an http request in a servlet? I mean I have my servlet printing out links, but if I want it to use those links instead and print out what is contained on the following pages, I would need to do some kind of request and parse the response myself correct?
What's the code to do an http request in a servlet?
I mean I have my servlet printing out links, but if I
want it to use those links instead and print out what
is contained on the following pages, I would need to
do some kind of request and parse the response myself
correct?Correct. Thought about something like this:
URL servletUrl = new URL("http://www.google.com/search?q=how+to+call+a+servlet+from+a+servlet");
InputStream in = servletUrl.getInputStream();Actual coding may vary. -
Hi all,
Now I can't open any new search help that use with the dialogservlet .
And the log have the following error message :
500 Internal Server Error is returned for HTTP request
[http://xxxx:xxxxxx/manufacturing/com/sap/me/system/common/client/ErrorPage.jsp]:
component [DialogServlet],
web module [manufacturing],
application [sap.com/me~ear],
DC name [sap.com/me~ear],
CSN
component[],
problem categorization [com.sap.ASJ.web.000137],
internal categorization [254340799].
[EXCEPTION]
java.lang.NullPointerException: while trying to invoke
the method java.lang.Throwable.printStackTrace(java.io.PrintWriter) of an object
loaded from local variable 'e'
at
com.sap.me.frame.Utils.getStackTrace(Utils.java:764)
at
JEE_jsp_com_sap_me_system_common_client_ErrorPage_1410450_1404183172000_1404185122991._jspService(JEE_jsp_com_sap_me_system_common_client_ErrorPage_1410450_1404183172000_1404185122991.java:137)
at
com.sap.engine.services.servlets_jsp.lib.jspruntime.JspBase.service(JspBase.java:102)
at
com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:152)
at
com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:428)
at
com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:147)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at
com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:152)
at
com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doCached(RequestDispatcherImpl.java:655)
at
com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:488)
at
com.vatti.mes.common.web.BaseServlet.doError(BaseServlet.java:61)
at
com.vatti.mes.common.dialog.web.DialogServlet.doPost(DialogServlet.java:125)
at
com.vatti.mes.common.dialog.web.DialogServlet.doGet(DialogServlet.java:53)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at
com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:152)
at
com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:38)
at
com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:457)
at
com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:210)
at
com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:441)
at
com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:430)
at
com.sap.engine.services.servlets_jsp.filters.DSRWebContainerFilter.process(DSRWebContainerFilter.java:38)
at
com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
at
com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:81)
at
com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
at
com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:276)
at
com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
at
com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:81)
at
com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
at
com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
at
com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
at
com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
at
com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
at
com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
at
com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
at
com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
at
com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
at
com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
at
com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
at
com.sap.engine.services.httpserver.filters.SessionSizeFilter.process(SessionSizeFilter.java:26)
at
com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
at
com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
at
com.sap.engine.services.httpserver.filters.MemoryStatisticFilter.process(MemoryStatisticFilter.java:57)
at
com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
at
com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
at
com.sap.engine.services.httpserver.filters.DSRHttpFilter.process(DSRHttpFilter.java:43)
at
com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
at
com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
at
com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:475)
at
com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.process(Processor.java:269)
at
com.sap.engine.services.httpserver.server.rcm.RequestProcessorThread.run(RequestProcessorThread.java:56)
at
com.sap.engine.core.thread.execution.Executable.run(Executable.java:122)
at
com.sap.engine.core.thread.execution.Executable.run(Executable.java:101)
at
com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:328)Hi Ivan!
The fact the this code worked fine yesterday or is working fine in Dev but not in another system proves nothing. On the contrary, the stack trace confirms that the problem stems from your custom code com.vatti.mes.common.web.BaseServlet.doError(BaseServlet.java:61). The obvious thing is that the method here is called "doError" that likely means you either face some error there or intentionally generate error message. After that the system tries to log the error message but it looks as if com.sap.me.frame.Utils.getStackTrace method gets null as an input parameter e. How does it get triggered and what is passed into - this is a question to your developers.
Regards,
Sergiy -
Hi All
l am working on a Wcem 3.0 with Trex with ERP and WAS 7.3.
When I logon to http://<host>:<port>/wcb/index.html url I am able to see wcbuilder_erp & wcbuilder_erp_ume application ids.
But suddenly I am getting The website cannot display the page error message when I access the above mentioned URL.
When I verify the developer log trace it showing as 500 Internal sever error issue.[EXCEPTION] java.lang.VerifyError: Bad return type
In defaultTrace.trc file it is showing as Cannot process an HTTP request to servlet [Faces Servlet] in [wcb] web application exception.
09 10 18:08:56:098#+0530#Error#com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl#
com.sap.ASJ.web.000137#WEC-APP-BF#sap.com/wec~comm~wcb~leanapp#C0000A229CA7094A0000000000001188#2392750000000004#sap.com/wec~comm~wcb~leanapp#com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl#Guest#0##CFAFBF4C38E411E4B4750000002482AE#ffbcbcdd38e611e49d020000002482ae#ffbcbcdd38e611e49d020000002482ae#0#Thread[HTTP Worker [@455349581],5,Dedicated_Application_Thread]#Plain##
Cannot process an HTTP request to servlet [Faces Servlet] in [wcb] web application.
[EXCEPTION] java.lang.VerifyError: Bad return type
Exception Details:
Location: com/sap/wec/tc/core/runtime/jsf/resource/WecExternalContextFactory.getExternalContext(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljavax/faces/context/ExternalContext; @17: areturn
Reason: Type 'com/sap/wec/tc/core/runtime/jsf/resource/WecExternalContext' (current frame, stack[0]) is not assignable to 'javax/faces/context/ExternalContext' (from method signature)
Current Frame:
locals: { 'com/sap/wec/tc/core/runtime/jsf/resource/WecExternalContextFactory', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object' }
stack: { 'com/sap/wec/tc/core/runtime/jsf/resource/WecExternalContext' }
Bytecode:
0000000: bb00 0359 2ab6 0004 2b2c 2db6 0005 b700
0000010: 06b0
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2446)
at java.lang.Class.getConstructor0(Class.java:2756)
at java.lang.Class.getConstructor(Class.java:1693)
Any help?
Regards
Rami ReddyHi Steffen,
Thanks for promt response.
But when I checked with Basis team as of now there are not yet configured TREX, only WCEM components has been configured in WAS 7.3. When they are configuring WCEM components HTTPS protocol not configured.
But for past 2 weeks I am able to see the below screen using http://<host>:<port>/wcb/index.html url.
But now I am getting The website cannot display the page error.
Please clarify me if anything is wrong from my side. And also pl let us know which configurations I have to check for fixing the issue.
Regards,
Rami Reddy -
Can a servlet handle other than HTTP request..?
I was asked this question in a interview. Can anyone clear me this.
Can a servlet handle other than HTTP request..?
If yes, please give me a working example.Can anyone guide me to achieve this.?
Note: If anyone worked with servlet responding ftp request, please send me the code.
Yes, a servlet can handle requests in other protocols
like FTP.
To achieve this, your Servlet ought to inherit from
javax.servlet.GenericServlet or implement the
javax.servlet.Servlet interface. To code the Servlet,
you should have a working knowledge of ftp protocol.
When your servlet extends
javax.servlet.http.HttpServlet, it can process http
requests only.
Cheers,
ram. -
How to construct a faces request from a http request?
I wonder how FacesServlet.service determines whether it should be calling LifecycleImpl.execute in oppose to calling LifecycleImpl.render?
Basically, I'm trying to construct a http request that would go through the decode method of my UIComponent. However, it seems that my request has always been treated as a non-faces request, where it goes to the render face directly.
Does anyone know how do I need to construct my http request so that it'll be recgonized as a faces request?
Anyone knows where i can download the source code for FacesServlet?
thanks!Sorry, are you saying that FacesServlet ALWAYS call execute before render even if it's the first request?
What I experienced is that for the first request, execute isn't called, and it goes directly to render.
And if I use the html form submit on the 2nd request, it does go to execute, then render.
However, if i construct another http request, it'll act like a first request, where it doesn't go through the execute, but striaght to render.
This is what I set in web.xml:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
I call my jsp using http://server:8080/faces/my.jsp, and I'm using tomcat 5. Any help would be appreciated. -
How to pass a HTTP request from a simple java class
Is it possible to pass an HTTP request from a simple java class.if yes how?
Is it possible to pass an HTTP request from a simple
java class.if yes how?If you're talking about creating a HttpRequest object and passing it to a servlet, that would be a red flag to me that your design is flawed. You shouldn't have to do that - the application server (Tomcat, Weblogic, etc) should be the only thing that has to worry about creating that kind of object and passing it to you. -
Problems by getting info out of XML file with a HTTP request
Hi,
I have a litte question. I'm working on an application that works together with google maps. In my java code, I get general information about address out of one database table, and I want to add some geographic information like coordinates that I want to retrieve from Google Maps through HTTP:
Right now my code is like:
while (resultSet.next())
title = resultSet.getString("title").replaceAll("'","''").toUpperCase();
author = resultSet.getString("author").replaceAll("'","''").toUpperCase();
location = resultSet.getString("location").replaceAll("'","''").toUpperCase();
straatnaam = resultSet.getString("straatnaam").replaceAll("'","''").toUpperCase();
nummer = resultSet.getString("nummer");
landcode = resultSet.getString("landcode").replaceAll("'","''").toUpperCase();
address = straatnaam + " " + nummer + " , " + location + " " + landcode;
url = "http://maps.google.com/maps/geo?q=" + address + "&output=xml&key=+key+";
String query = "INSERT INTO data2 VALUES ('" + i + "','" + title + "','" + author + "','" + resultSet.getString("date1") + "','" + resultSet.getString("date2") + "','" + location + "','" + resultSet.getString("postcode") + "','" + straatnaam + "','" + resultSet.getString("nummer") + "','" + landcode + "','+something like url.getCoordX+','something like url.getCoordY')";
success = sql2.executeUpdate(query);
i++;
Now I don't know how I can handle that. Is it possible to do an HTTP request in Java without using Java Script of servlets? I just want to get the X and Y coordinates out of the XML file.
The XML file will be something like:
<kml xmlns="http://earth.google.com/kml/2.0">
<Response>
<name>1600 amphitheatre mountain view ca</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark>
<address>
1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA
</address>
<AddressDetails Accuracy="8">
<Country>
<CountryNameCode>US</CountryNameCode>
<AdministrativeArea>
<AdministrativeAreaName>CA</AdministrativeAreaName>
<SubAdministrativeArea>
<SubAdministrativeAreaName>Santa Clara</SubAdministrativeAreaName>
<Locality>
<LocalityName>Mountain View</LocalityName>
<Thoroughfare>
<ThoroughfareName>1600 Amphitheatre Pkwy</ThoroughfareName>
</Thoroughfare>
<PostalCode>
<PostalCodeNumber>94043</PostalCodeNumber>
</PostalCode>
</Locality>
</SubAdministrativeArea>
</AdministrativeArea>
</Country>
</AddressDetails>
<Point>
<coordinates>-122.083739,37.423021,0</coordinates>
</Point>
</Placemark>
</Response>
</kml>
many greetings and thanks in advance
MathiasHi, sorry for being not so clear. My question was actually if it is possible to do a HTTP request in Java without using servlets or being in Java Script. Actually my question was more specific for Google maps, because it didn't seem to work. It was my mistake, and already solved, to forget to make the webservice-call "URL-encoded". Because of that, I always received a HTTP 400 error, and that's why I thought it wouldn't be possible.
But now I have another, perhaps for you guys stupid question. The result I get from the webservice URL is of the form:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Response>
<name>nieuwelaan 38, Hamme</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>Nieuwelaan 38, 9220 Hamme, Hamme, Belgium</address>
<AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<Country>
<CountryNameCode>BE</CountryNameCode>
<AdministrativeArea>
<AdministrativeAreaName>Vlaams Gewest</AdministrativeAreaName>
<SubAdministrativeArea>
<SubAdministrativeAreaName>Oost-Vlaanderen</SubAdministrativeAreaName>
<Locality>
<LocalityName>Hamme</LocalityName>
<DependentLocality>
<DependentLocalityName>Hamme</DependentLocalityName>
<Thoroughfare>
<ThoroughfareName>Nieuwelaan 38</ThoroughfareName>
</Thoroughfare>
<PostalCode>
<PostalCodeNumber>9220</PostalCodeNumber>
</PostalCode>
</DependentLocality>
</Locality>
</SubAdministrativeArea>
</AdministrativeArea>
</Country>
</AddressDetails>
<Point>
<coordinates>4.126295,51.097724,0</coordinates>
</Point>
</Placemark>
</Response>
</kml> Now I want to get the value of the coordinates field.
This is my code:
address = URLEncoder.encode(address, "UTF-8");
urlString = "http://maps.google.com/maps/geo?q=" + address + "&output=xml&key=ABQIAAAA9fEXNK-q6vKpPU0JCmPPkxQjbVBpjtblJJYkDfbMo0e51afwehRmujfvBtJqx1Qehg6e6QgCRY8poA";
url = new URL(urlString);
XPath xPath = XPathFactory.newInstance().newXPath();
Document domDoc = processData(url);
path = "/kml/Response/Placemark/Point/coordinates";
coord = xPath.evaluate(path, domDoc);
System.out.println("coord : " + coord);Now, in the last line, by writing out the value of coord to my screen, I get the value "1", instead of "4.126295,51.097724,0" I would expect, anyone knows what I'm doing wrong?
greetings
Mathias
Maybe you are looking for
-
I create an itunes store account to conect my appletv But says isnt valid I dont have credit card I jus want to start using my appletv
-
hi, I'm having a problem opening CS4 from bridge. Right clicking a thumbnail in Bridge does NOT give me the option of opening the image in CS4,I have to open it in ACR and from there open it in CS4. OS system is 32bit Vista,and I have tried the reset
-
Restrict text id determination after material change
Hi All I've a request from business. When they create sales order ( va01) they enter material and then item number gets assigned to material. they usually enter lot of text in line item level in various text id's. But sometimes they change the mat
-
Waiting for user logon...
Hi, we're currently experiencing issues with random applications refusing to install with the message 'Waiting for user logon'. I'm seeing this in Software Center so obviously someone is logged on. It doesn't seem to matter if I'm logged in via RDP o
-
Could someone tell me how to import bookmarks from Safari? Thanks!
I know how to export the Safari bookmarks to, say, the desktop, but how do you then import them into Firefox? Thanks ....