Weblogic POST requests and foreign characters
We have Ajax post requests that work correctly in the Tomcat/Eclpse development environment. When moving them to the Weblogic environmnent, the POST requests no longer correctly send the data.
A request object is created with a URL. The foreign character string is encoded using the Javascript encodeURIComponent.
The request is sent to the servlet.
When the servletbase class starts the parameter is printed and shows ????.
On the Tomcat environment the servletbase (which extends HttpServlet) class shows the parameter as what looks like a UTF-8 string.
Have you tried seeing what ServletRequest.getCharacterEncoding() returns on both Tomcat / WebLogic?
http://download.oracle.com/docs/cd/E17410_01/javaee/6/api/javax/servlet/ServletRequest.html#getCharacterEncoding()
Similar Messages
-
Getting weblogic.rjvm.PeerGoneException while posting request to foreign Q
Hi,
There are two application deployed on 2 different weblogic server .Say application A(EJB) is deployed on weblogic 9 and Application B (Oracle service Bus) is runing on Weblogic 10.3.
Application A sends request to a queue that is on applcation B server. Weblogic (app A) has foreign JMS server that exports the queue of app B. Configuration at Application A is :
<foreign-server name="JmsSyncServer">
<sub-deployment-name>SUBDEPLOYMENT_xyz</sub-deployment-name>
<foreign-destination name="Synchronous Request Queue">
<local-jndi-name>spain.queue.sebulasyncoutput</local-jndi-name>
<remote-jndi-name>osb.jms.queue.extern.service.request</remote-jndi-name>
</foreign-destination>
<foreign-connection-factory name="Sebula Synchronous QCF">
<local-jndi-name>spain.SebulaSyncQueueConnectionFactory</local-jndi-name>
<remote-jndi-name>osb.jms.cf.nonXA</remote-jndi-name>
</foreign-connection-factory>
<initial-context-factory>weblogic.jndi.WLInitialContextFactory</initial-context-factory>
<connection-url>t3://abcd.1.com:20001,abcd.2.com::20002</connection-url>
</foreign-server>
Now this cf and queue osb.jms.cf.nonXA and osb.jms.queue.extern.service.request are implemented on application B weblogic server. No authentication is given to this implementation. As soon as application A posts request to Application B following exception is thrown in application A logs :
2010.05.21 16:31:04,919 | ERROR | SyncEaiSebulaDelegate | <null|null|U289145226331099999430000> Failed to send JMS request: properties[{ClientID=SPAIN, Operation=MsisdnDetails, message_type=sebula.sync.out, RequestTag=U289145226331099999430000}].
com.o2.spain.jms.MessagingException: Failure during JMS setup: destination[sebula_sync_output].
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:85)
at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:426)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:382)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:367)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at weblogic.deployment.jms.ForeignOpaqueReference.getReferent(ForeignOpaqueReference.java:196)
at weblogic.jndi.internal.WLNamingManager.getObjectInstance(WLNamingManager.java:95)
at weblogic.jndi.internal.ServerNamingNode.resolveObject(ServerNamingNode.java:348)
at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:856)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:209)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:269)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:367)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.o2.spain.jms.ServiceLocator.lookupDestination(ServiceLocator.java:130)
at com.o2.spain.jms.ServiceLocator.getDestination(ServiceLocator.java:109)
at com.o2.spain.jms.MessageDestinationHandler.setup(MessageDestinationHandler.java:193)
at com.o2.spain.jms.MessageDestinationHandler.setupLazyAndAfterFailure(MessageDestinationHandler.java:165)
at com.o2.spain.jms.MessageDestinationHandler.getTemporaryReceiver(MessageDestinationHandler.java:543)
at com.o2.spain.jms.MessageDestination.getTemporaryReceiver(MessageDestination.java:318)
at com.o2.spain.jms.JmsClientImpl.doRequest(JmsClientImpl.java:147)
at com.o2.spain.jms.JmsClientImpl.request(JmsClientImpl.java:125)
at com.o2.spain.interfaces.sebula.sync.SyncEaiSebulaDelegate.executeRequest(SyncEaiSebulaDelegate.java:345)
at com.o2.spain.interfaces.sebula.sync.SyncEaiSebulaDelegate.getMsisdnDetails(SyncEaiSebulaDelegate.java:182)
at com.o2.spain.ejb.SynchronousEaiFacadeBean.getMsisdnDetails(SynchronousEaiFacadeBean.java:221)
at com.o2.spain.ejb.SynchronousEaiFacade_letkhg_ELOImpl.getMsisdnDetails(SynchronousEaiFacade_letkhg_ELOImpl.java:405)
at com.o2.spain.ejb.SpainWebFacadeBean.getMsisdnDetails(SpainWebFacadeBean.java:1084)
at com.o2.spain.ejb.SpainWebFacade_sesxly_ELOImpl.getMsisdnDetails(SpainWebFacade_sesxly_ELOImpl.java:1787)
at com.o2.spain.ejb.ws.SpainWebWSPortSoapBindingImpl.getMsisdnDetails(SpainWebWSPortSoapBindingImpl.java:379)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at com.o2.spain.ejb.ws.AxisServletFilter.doFilter(AxisServletFilter.java:29)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3242)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: com.o2.spain.jms.MessagingException: Failed looking up Destination [spain.queue.sebulasyncoutput].
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:215)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
at weblogic.jndi.internal.ServerNamingNode_923_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:379)
... 58 more
Caused by: javax.naming.CommunicationException [Root exception is weblogic.rjvm.PeerGoneException: ; nested exception is:
java.io.EOFException]
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:85)
at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:426)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:382)
... 58 more
Caused by: weblogic.rjvm.PeerGoneException: ; nested exception is:
java.io.EOFException
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:215)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
at weblogic.jndi.internal.ServerNamingNode_923_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:379)
... 58 more
Caused by: java.io.EOFException
at weblogic.rjvm.t3.MuxableSocketT3.endOfStream(MuxableSocketT3.java:383)
at weblogic.socket.SocketMuxer.deliverExceptionAndCleanup(SocketMuxer.java:737)
at weblogic.socket.SocketMuxer.deliverEndOfStream(SocketMuxer.java:684)
at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:845)
at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:802)
at weblogic.socket.DevPollSocketMuxer.processSockets(DevPollSocketMuxer.java:120)
at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:42)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
It will be great if someone helps in finding out the cause....waiting for reply..
thanks,
KshitijI had the exact same issue and found a solution here:
http://kr.forums.oracle.com/forums/thread.jspa?threadID=755132
"The root cause of the PGE in this instance was missing Principle classes in the remote JVM. An authenticated subject's (has our custom principles) security context is propagated to the remote JVM which throws a ClassNotFoundException, this is wrapped in the PGE." -
Plain HTTP sending Post Requests and Multipart Uploads
Hi,
I have a scenaio where I need to send an normal POST request
to the server. This request needs to have not the XML payload but
the same data in the form of a POST request.
Is there a way to transform the data out of the XML format into
the plain POST format prior to sending it?
Also, another scenario requires an file upload via HTTP (like a
file submitted by a web-form). Is this possible with PI and how?
Thanks for any pointers
Best regradsHi,
If you do not send any payload in the http request you are going to get a http error.
For your second requirement, There is no any problem, You can use any existent tool, or maybe develop you own program.
Http client.
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417600)ID1536482550DB10501227175138097442End?blog=/pub/wlg/15296
Regards
Ivan -
SQL Loader and foreign characters in the data file problem
Hello,
I have run into an issue which I can't find an answer for. When I run SQL Loader, one of my control files is used to get file content (LOBFILE) and one of the fields in the data file has a path to that file. The control file looks like:
LOAD DATA
INFILE 'PLACE_HOLDER.dat'
INTO TABLE iceberg.rpt_document_core APPEND
FIELDS TERMINATED BY ','
doc_core_id "iceberg.seq_rpt_document_core.nextval",
-- created_date POSITION(1) date "yyyy-mm-dd:hh24:mi:ss",
created_date date "yyyy-mm-dd:hh24:mi:ss",
document_size,
hash,
body_format,
is_generic_doc,
is_legacy_doc,
external_filename FILLER char(275) ENCLOSED by '"',
body LOBFILE(external_filename) terminated by EOF
A sample data file looks like:
0,2012-10-22:10:09:35,21,BB51344DD2127002118E286A197ECD4A,text,N,N,"E:\tmp\misc_files\index_testers\foreign\شیمیایی.txt"
0,2012-10-22:10:09:35,17,CF85BE76B1E20704180534E19D363CF8,text,N,N,"E:\tmp\misc_files\index_testers\foreign\ลอบวางระเบิด.txt"
0,2012-10-22:10:09:35,23552,47DB382558D69F170227AA18179FD0F0,binary,N,N,"E:\tmp\misc_files\index_testers\foreign\leesburgis_á_ñ_é_í_ó_ú_¿_¡_ü_99.doc"
0,2012-10-22:10:09:35,17,83FCA0377445B60CE422DE8994900A79,binary,N,N,"E:\tmp\misc_files\index_testers\foreign\làm thế nào bạn làm ngày hôm nay"
The problem is that whan I run this, SQL Loader throws an error that it can't find the file. It appears that it can't interpret the foreign characters in a way that allows it to find that path. I have tried adding a CHARACTERSET (using AL32UTF8 or UTF8) value in the control file but that only has some success with Western languages, not the ones listed above. Also, there is no set of defined languages that could be found in the data file. It essentaially could be any language.
Does anyone know if there is a way to somehow get SQL Loader to "understand" the file system paths when a folder and/or file name could be in some other langauge?
Thanks for any thoughts - PeterThanks for the reply Harry. If I try to open the file in various text editors like Wordpad, Notepad, GVIM, andTextpad, they all display the foreign characters differently. Only Notepad comes close to displaying the characters properly. I have a C# app that will read the file and display the contents and it renders it fine. If you look at the directory of files in Windows Explorer, they all are displayed properly. So it seems things like .Net and Windows have some mechanism to understand the characters in order to render them properly. Other applications, again like Wordpad, do not know how to render them properly. It would seem that whatever SQL Loader is using to "read" the data files also is not rendering the characters properly which prevents it from finding the directory path to the file. If I add "CHARACTERSET AL32UTF8" in the control file, all is fine when dealing with Western langauges (ex, German, Spanish) but not for the Eastern languages (ex. Thai, Chinese). So .... telling SQL Loader to use a characterset seems to work, but not in all cases. The AL32UTF8 is the characterset that the Oracle database was created with. I have not had any luck if I try to set the CHARACTERSET to whatever the Thai character set is, for example. There problem there though is that even if that did work, I can't target specific lagauages because the data could come from anywhere. It's like I need some sort of global "super set" characterset to use. It seems like the CHARACTERSET is the right track to follow but I am not sure, and even if it is, is there a way to handle all languages.
Thanks - Peter -
Hi all,
I encountered the following 2 servlet problems in WLS 6.0/ 6.1:
1. Processing concurrent POST requests
WLS seems to disallow concurrent executions of any servlet's doPost servlet method.
When two clients attempt to send a request to a servlet using POST, the socond
one
is blocked until the first customer is served. In essence, the servlet ends up
operating in
1-user mode. I just learned from Jervis Liu that the problem is solved in WLS6.0
if you disable http-keepalive.
For WLS 6.1 a partial workaround is to make the servlet work in a single-thread
mode (by implementing the javax.servlet.SingleThreadModel interface). In this
case,
WLS dispatches concurrent requests to different instances of the servlet.
This doesn't completely eliminate the problem - still only one customer can be
connected at a time. The improvement is that once the first customer is disconnects,
the second can be served even if the doPost method for the first has not finished
yet.
2. Flushing the response buffer in WLS 6.1
The servlet response buffer is not flushed automatically until doPost ends, unless
you
explicitly call response.flushBuffer(). Closing the output stream doesn't flush
the
buffer as per the documentation.
I see that other people are experiencing the same problems.
Has anyone found any solutions/workarounds or at least an explanation.
Any input would be highly appreciated.
Thanks in advance.
Samuel Kounev
Thanks for replying. Here my answers:
> Did you mark your doPost as synchronized?
No.
> Also, try testing w/ native i/o vs not ... is there a difference?
With native I/O turned off I get a little lower performance, but the
difference is not too big.
Best,
Samuel Kounev
> Peace,
>
> --
> Cameron Purdy
> Tangosol Inc.
> << Tangosol Server: How Weblogic applications are customized >>
> << Download now from http://www.tangosol.com/download.jsp >>
>
> "Samuel Kounev" <[email protected]> wrote in message
> news:[email protected]...
> >
> > Hi all,
> >
> > I encountered the following 2 servlet problems in WLS 6.0/ 6.1:
> >
> > 1. Processing concurrent POST requests
> >
> > WLS seems to disallow concurrent executions of any servlet's doPost
> servlet method.
> >
> > When two clients attempt to send a request to a servlet using POST, the
> socond
> > one
> > is blocked until the first customer is served. In essence, the servlet
> ends up
> > operating in
> > 1-user mode. I just learned from Jervis Liu that the problem is solved in
> WLS6.0
> >
> > if you disable http-keepalive.
> >
> > For WLS 6.1 a partial workaround is to make the servlet work in a
> single-thread
> >
> > mode (by implementing the javax.servlet.SingleThreadModel interface). In
> this
> > case,
> > WLS dispatches concurrent requests to different instances of the servlet.
> > This doesn't completely eliminate the problem - still only one customer
> can be
> >
> > connected at a time. The improvement is that once the first customer is
> disconnects,
> > the second can be served even if the doPost method for the first has not
> finished
> > yet.
> >
> > 2. Flushing the response buffer in WLS 6.1
> > The servlet response buffer is not flushed automatically until doPost
> ends, unless
> > you
> > explicitly call response.flushBuffer(). Closing the output stream doesn't
> flush
> > the
> > buffer as per the documentation.
> >
> > I see that other people are experiencing the same problems.
> >
> > Has anyone found any solutions/workarounds or at least an explanation.
> > Any input would be highly appreciated.
> >
> > Thanks in advance.
> >
> > Samuel Kounev
=====================================================
Samuel D. Kounev
Darmstadt University of Technology
Department of Computer Science
DVS1 - Databases & Distributed Systems Group
Tel: +49 (6151) 16-6231
Fax: +49 (6151) 16-6229
E-mail: mailto:[email protected]
http://www.dvs1.informatik.tu-darmstadt.de
http://skounev.cjb.net
=====================================================
[att1.html]
-
How can i upload file using ajax post request and jsp
Hi
this is my code files
addPhoto.jsp
<html>
<head>
<title>Add Photo</title>
<script>
var optionNo = 0;
var i=1;
var val=0;
var file = 0;
var exten = new Array(".jpg",".jpeg",".gif");
function addValues()
for(var i=0;i<5;i++)
optionNo += 1;
oNewOption = new Option();
oNewOption.text = optionNo;
oNewOption.value = optionNo;
addSelect.add(oNewOption);
function addBoxes()
var str = "";
var j=0;
val = document.getElementById('addSelect').value;
for(j=1; j<= val; j++)
str = str + '<font size=3>file:' + j + '</font>';
str = str + '<input type="file" id=filepath'+ j +' name=file'+ j + ' onchange="uploadFile(hidden'+ j + '.value)"><div id="result'+ j +'"></div>
str = str + '<input type="hidden" name="hidden' + j + '" value=' + j +'>';
document.getElementById('addPhoto').innerHTML = str;
function uploadFile(value)
var str = "filepath" + value;
file = value;
var param = document.getElementById(str).value;
var parameter = "filepath=" + param;
alert(parameter.length);
if(checkValidity(param))
var url = "uploadFile.jsp";
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
req.open("POST", url, true);
req.setRequestHeader("Content-type", "multipart/form-data");
//req.setRequestHeader("Content-length", parameter.length);
req.setRequestHeader("Connection", "close");
req.onreadystatechange = callback;
req.send(null);
else
document.getElementById("result" + file).innerHTML = "upload .jpeg,.jpg,.gif Files Only";
function callback() {
if (req.readyState == 4) {
updatepage(req.responseText);
function updatepage(str){
document.getElementById("result" + file).innerHTML = str;
function checkValidity(str)
var i=0;
var j=0;
var str1 = str.substring(str.lastIndexOf("."),str.length);
alert(str1);
for(i=0;i<exten.length;i++)
if(str1.search(exten) != -1)
j++;
break;
if(j>0)
return true;
else
return false;
</script>
</head>
<body onload="addValues()">
<h5>Add Photo(s)</h5>
<select id="addSelect" name="addSelect" onchange="addBoxes()">
<option id="select" selected>Select</option>
</select>
<div id="addPhoto"></div>
</body>
</html>
uploadFile.jsp
<%@page import="java.io.*"%>
<%
/*try
String contentType = request.getContentType();
System.out.println(request.getMethod());
System.out.println("Content type is :: " +contentType);
if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0))
DataInputStream in = new DataInputStream(request.getInputStream());
DataInputStream in1 = in;
int formDataLength = request.getContentLength();
System.out.println(formDataLength);
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead < formDataLength)
byteRead = in1.read(dataBytes, totalBytesRead, formDataLength);
totalBytesRead += byteRead;
out.println("<br>totalBytesRead : " + totalBytesRead + " : formDataLength = " + formDataLength);
} catch(Exception e) {
e.printStackTrace();
try
String filePath = request.getParameter("filepath");
System.out.println(filePath);
File f= new File(filePath);
String path = f.getName();
String contentType = request.getContentType();
System.out.println(contentType);
//InputStream in = new FileInputStream(filePath);
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
System.out.println(formDataLength);
byte[] buf = new byte[1024];
OutputStream out1 = new FileOutputStream("c:/docs/" + path);
int len;
while ((len = in.read(buf)) > 0) {
out1.write(buf, 0, len);
in.close();
out1.close();
out.write("File Uploaded SucssesFully");
catch(Exception e)
e.printStackTrace();
out.write("error while Writing File");
%>
the above code in request.getContentType() i am getting 0. I am not passing the content length. for the same application with out using Ajax i am
getting the size of file... it is very very urgent for me.. pls help me out on this...
Any one having the code on this pls mail me the code...
my mail id ... [email protected]
Regards
Ashok KumarSure, you can upload a file, using a form input element of type file. You pick this up with a servlet, though you need a special request wrapper to sort out the multi-part request you get back that way (there's a suitable package on jakarta.apache.org/commons)
The servlet decrypts the file and can pass the results to a JSP for display.
Don't try to do the complicated stuff in a JSP, it all gets incredibly messy, and that's not what JSPs are for. -
Dear folks
I have done NTLM authentication successfully and got the logged in username, but my POST request quits working after NTLM authentication.
I have logged the HTTP headers using RequestDumperValve, it shows that even though the user is authenticated the browser sends authorization header on every POST request and its content-length is zero.
Im not able to understand the problem.
This problem is already discussed in many groups but all replied JCIFS, but i don't want to use it.
My configuration Apache 1.3,Tomcat 4.0,Mod_JK
Why the POST Request is not working?
Any help will be appreciated.
Regards
GaneshYep, I am french so sorry for my english. I have maybe a solution, i have got the same problem with POST request after NTLM auth, they don't work with my ajax application.
I have search search and search, and i have write that :
You must place that in first place in your html file, before any tag ( so before <html> tag ).
I hope that this can help anyone...
<%
boolean isUserNameRecuperer = false;
boolean isAutorisationSend = (request.getHeader("Authorization") != null);
if (!isAutorisationSend)
response.setHeader("WWW-Authenticate", "NTLM");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
return;
else
String authorisationCode = request.getHeader("Authorization");
boolean isNTLMAutorisation = authorisationCode.substring(0, 4).equals("NTLM");
if (isNTLMAutorisation)
authorisationCode = authorisationCode.substring(5);
BASE64Decoder base_64decoder = new BASE64Decoder();
byte[] authorisationCode64 = base_64decoder.decodeBuffer(authorisationCode);
System.out.println("NTLM Flag " +authorisationCode64[8]);
if( authorisationCode64[8] == 1 )
if (authorisationCode64[13] == 178)
System.out.println("NTLM Flag Error");
//stop
String retAuth = "NTLMSSP"+Character.toString((char)0)+Character.toString((char)2)+Character.toString((char)0)+Character.toString((char)0)+Character.toString((char)0)+Character.toString((char)0)+Character.toString((char)0)+Character.toString((char)0);
retAuth += Character.toString((char)0)+Character.toString((char)40)+Character.toString((char)0)+Character.toString((char)0)+Character.toString((char)0)+Character.toString((char)001)+Character.toString((char)130)+Character.toString((char)000)+Character.toString((char)000);
retAuth += Character.toString((char)0)+Character.toString((char)2)+Character.toString((char)2)+Character.toString((char)2)+Character.toString((char)0)+Character.toString((char)000)+Character.toString((char)000)+Character.toString((char)000)+Character.toString((char)000);
retAuth += Character.toString((char)0)+Character.toString((char)0)+Character.toString((char)0)+Character.toString((char)0)+Character.toString((char)0)+Character.toString((char)000)+Character.toString((char)000);
BASE64Encoder base_64encoder = new BASE64Encoder();
String retAuth64 = base_64encoder.encode(retAuth.getBytes());
retAuth64.trim();
response.setHeader("WWW-Authenticate", "NTLM "+ retAuth64);
response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
return;
else if (authorisationCode64[8] == 3)
//le domaine
int lenght = (authorisationCode64[31]*256 + authorisationCode64[30]); // longueur du domain
int offset= (authorisationCode64[33]*256 + authorisationCode64[32]); // position du domain.
String codeATraiter = "";
for (int i=0; i < authorisationCode64.length; i++)
codeATraiter += (char) authorisationCode64;
String domain = codeATraiter.substring(offset, offset+lenght); // decoupage du du domain.
domain.replace("\0", "");
//le login
lenght = (authorisationCode64[39]*256 + authorisationCode64[38]); // longueur du domain
offset = (authorisationCode64[41]*256 + authorisationCode64[40]); // position du domain.
String username = codeATraiter.substring(offset, offset+lenght); // decoupage du du domain.
username = username.replaceAll("\0", "");
System.out.println(username);
isUserNameRecuperer = true;
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
%>
It's normal that the last status of my page is response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
in an other case that block any POST request.
Message was edited by:
BoBlepepeur -
Query regarding sending XML over HTTP Post request
Hello,
I am trying to send XML data from a server to client via HTTP Post request
And vice versa � receive the data by a client
Assume that the xml data looks something like
<?xml+version="1.0"?>
So my post query will look like
http://<IP Address>:<port>/
POST /MessageReceiver.jsp HTTP/1.0
Host: www.SomeHost.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 38
%3C%3Fxml%2Bversion%3D%221.0%22%3F%3E+
This information will be received by the client and converted back to xml data.
My query is - is there some library/open-source stuff that
does the process of transcoding the entity's non-ASCII characters
at the server side
and decoding the URL back to human-readable form at the client side?
i.e. I need a simple mechanism to convert
<?xml+version="1.0"?>
to
%3C%3Fxml%2Bversion%3D%221.0%22%3F%3E+
at the server side, while sending data
and do the opposite at the client side to get the xml back.
Also could some one confirm if JTidy is a right tool to check if the xml is well-formed?
Or is there any other standard tool that checks for well-formed properties of xml?
regards,
Deepak.java.net.URLEncoder / URLDecoder?
Also could some one confirm if JTidy is a right tool to check if the xml is well-formed?No, it's for parsing HTML. An XML parser is checking for well-formedness in any case. -
Truncated POST requests in IE 10 - In Response to NTLM Authentication
In Internet Explorer 10, the browser is incorrectly truncating HTTP POST requests and submitting unsolicited NTLM negotiate headers with a HTTP Content-Length of Zero Bytes. This results in HTTP POST parameters failing to be submitted to the
server.
Assume the following web application with a context root of:
https://w3.someapplication.net/webapplication/
Secure cookies for this site are established at the context root of this application.
To reproduce this issue, a secure session is established at a protection space deeper than the root context of the web app:
https://w3.someapplication.net/webapplication/secure/login
After establishing a secure session with the web application, some client side artifacts are retrieved from a web proxy at a higher protection space:
https://w3.someapplication.net/webapplication/somejs.js
Subsequent HTTP POST requests to a deeper protection space will result in IE incorrectly attempting to pass an unsolicited NTLM negotiate header to the server side, and the HTTP POST request will be truncated with a Zero Content-Length header:
https://w3.someapplicaiton.net/webapplication/submit/form
The result is that the HTTP POST parameters submitted to the last URL will be lost.
This is reproducible against IE6 and IE10. It does not reproduce against IE8, or any non-Microsoft browser which all behave in a sane manner.
My Questions:
Why is IE behaving this way?
What can I do to make IE behave properly? Please don't suggest that I change the entire structure of my company's website to overcome this kind of silly bug in IE.
Is there a planned fix to correct this behavior back to the proper implementation observed in IE8?
Additional details about this problem are documented by an IE Internals blogger at the following url:
http://blogs.msdn.com/b/ieinternals/archive/2010/11/22/internet-explorer-post-bodies-are-zero-bytes-in-length-when-authentication-challenges-are-expected.aspx
MichaelYes, I have read that blog post in detail. All of the comments from Microsoft on this issue suggest making intrusive changes to the web application side to work around this "optimization". This is not an acceptable answer. This
is clearly a bug in IE. Evidence to support that this is a bug is that the behavior within IE's own browsers is not consistent; IE6 and IE10 will reproduce this issue, IE7 and IE8 will not.
I don't understand your suggestion; "ensure all paths are configured to require authentication". This is not a reasonable expectation for any normal web app. Our application does require authentication on all paths. However, when the first
authentication request goes through, a HTTP Session is established. Any subsequent request to that domain will not and should not be re-authenticated. IE making assumptions about the authentication requirements of a server side application is incorrect.
Further, even if i did re-challenge the browser for credentials on every path, regardless of whether a session is established or not, how would I handle the requirement to serve client side artifacts from a web proxy within that secure domain? Am I expected
to force my web proxy to require an NTLM header to serve up a CSS file? That is just silly.
You also suggested that my application might be incorrectly returning a 401. I can assure you, that is not the case. The flow is this:
Perform a signon to the application and retrieve some client side artifacts required by the splash page
https://w3.myapp.com/some/app/path?query=string
401 + www-negotiate response header
https://w3.myapp.com/some/app/path?query=string
browser provides a ntlm token, user is logged in, session is started
https://w3.myapp.com/some/file.js 200 response code, no challenge from the server side
Splash page is loaded; user submits a POST request
https://w3.myapp.com/some/app/path POST request fails because IE truncates the request and attaches an NTLM negotiate header with Zero Byte content length. This is an unsolicited negotiate header from IE.
Honestly, it really irritates me when people suggest we should change our entire application structure to accommodate IE bugs or "features" that are completely outside of the HTTP spec. I understand RFC4559 states that a browser MAY initiate a request
to a server which includes an unsolicited negotiate header, but it doesn't say anything about truncating the contents of that request.
No other browsers exhibit this behavior, and even the behavior within Microsoft's own product is not consistent. It is insanely frustrating as a web developer trying to deal with all of IE's little nuances.
Is there anyway this can be turned off via a registry entry? Is there any plan to fix this in a future release? -
Page should open on Post Request
How can i make a jsp page that it always open on a POST request ,,,,, if somebody try to open it directly it should go toooooo an error page.
You could use request.getMethod() .equals("POST") to see if it is a post request and redirect otherwise.
-
FF4 hanging badly, so used IE6 & Opera 10.63 to register with & access Mozilla support site. Some words on those pages displayed in a foreign language (Arabic script?? )-- example, বাংলা (বাংলাদেশ)
Foreign characters on initial Support registration page, were in lieu of English words asking to select UserID & Password. (Page not entirely in foreign language--only parts. Request to repeat password choice, enter email, were in English).
I registered (guessing what to enter). Went to Support page [support.mozilla.com/bn-BD/kb/ask]. Greeted by statement: "Our volunteers haven't translated this article into বাংলা (বাংলাদেশ) yet."
No idea what language that is, or why u think I can read it. Presently logged in from U.S.That is Bengali ([http://www.mozilla.com/en-US/firefox/all.html]). Firefox 4 no longer has the language setting in the user agent and in your case it doesn't seem to work to detect the language.
You can change the bn-BD in the link(s) to en-US on the Mozilla sites. -
Problem with WebLogic 10.1 and SOAP request
I have some relatively simple code that is making a SOAP request and trying to parse the response. The code works fine in Tomcat 6, but fails when running under WebLogic 10.1. At first, the problem was with the implementations of MessageFactory and SOAPConnectionFactory. After some research, I added the following to the startWebLogic.sh file
-Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
-Djavax.xml.soap.SOAPConnectionFactory=weblogic.wsee.saaj.SOAPConnectionFactoryImpl
That resolved the initial problems, but now I get the following error when making a call to the getTextContent() method of an instantiation of the org.w3c.dom.Node class.
java.lang.AssertionError: UNIMPLEMENTED
at weblogic.xml.domimpl.NodeImpl.getTextContent(NodeImpl.java:198)
In my research, it seems that the "-Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl " option should have resolved that issue, but it does not. I am including the relevant section of code below for reference. If anyone has a suggestion as to how to fix this issue, I would be very grateful. Thanks in advance!
fis = new FileInputStream(_outputFileName);
MimeHeaders hd = new MimeHeaders();
hd.addHeader("Content-Type", "text/xml;charset=UTF-8");
hd.addHeader("SOAPAction", "/service/doCallAPI");
MessageFactory factory = MessageFactory.newInstance();
SOAPMessage request = factory.createMessage(hd, fis);
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnectionFactory.createConnection();
SOAPMessage response = connection.call(request, new URL(_pdfHostUrl));
NodeList documents = response.getSOAPBody().getElementsByTagName("FileProp");
Node node = documents.item(0);
String textContent = node.getTextContent();
-----------------------------------------------------------------Hi Else,
We'd really like to reproduce this problem and get to the bottom of what is causing it, so that you could upgrade in the future. Would you be willing to send me a data set consisting of your TDM, TDX, TDV, and video file? You can either post here or send it directly to my email at:
[email protected]
Thanks,
Brad Turpin
DIAdem Product Support Engineer
National Instruments -
When typing in gmail (firefox) or thunderbird, randomly foreign characters will be produced like the keyboard has been set to spanish or french, but it is set to english, and the character encoding is set to what it is supposed to be. Web pages appear correctly.
Application Basics
Name
Firefox
Version
10.0.12
User Agent
Mozilla/5.0 (Windows NT 5.1; rv:10.0.12) Gecko/20100101 Firefox/10.0.12
Profile Directory
Open Containing Folder
Enabled Plugins
about:plugins
Build Configuration
about:buildconfig
Crash Reports
about:crashes
Memory Use
about:memory
Extensions
Name
Version
Enabled
ID
F5 Networks Host Plugin
7000.2011.0910.0354
true
{DBBB3167-6E81-400f-BBFD-BD8921726F52}
IE Tab 2 (FF 3.6+)
4.12.22.2
true
{1BC9BA34-1EED-42ca-A505-6D2F1A935BBB}
Microsoft .NET Framework Assistant
0.0.0
false
{20a82645-c095-46ed-80e3-08825760534b}
Skype Click to Call
6.5.0.11422
false
{82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}
Modified Preferences
Name
Value
accessibility.typeaheadfind.flashBar
0
browser.places.smartBookmarksVersion
2
browser.startup.homepage
http://ca.search.yahoo.com?type=386496&fr=spigot-yhp-ff
browser.startup.homepage_override.buildID
20130103094221
browser.startup.homepage_override.mstone
rv:10.0.12
browser.tabs.warnOnClose
false
dom.ipc.plugins.enabled.npietab2.dll
true
extensions.lastAppVersion
10.0.12
gfx.blacklist.layers.direct3d9
2
keyword.URL
http://search.yahoo.com/search?fr=greentree_ff1&ei=utf-8&ilc=12&type=386496&p=
network.cookie.prefsMigrated
true
places.database.lastMaintenance
1358793548
places.history.expiration.transient_current_max_pages
51968
privacy.cpd.siteSettings
true
privacy.sanitize.migrateFx3Prefs
true
privacy.sanitize.timeSpan
0
security.warn_viewing_mixed
false
Graphics
Adapter Description
NVIDIA GeForce 6150 LE
Vendor ID
10de
Device ID
0241
Adapter RAM
Unknown
Adapter Drivers
nv4_disp
Driver Version
9.1.4.8
Driver Date
8-16-2006
Vendor ID (GPU #2)
00ad
Device ID (GPU #2)
00ad
Adapter RAM (GPU #2)
Unknown
Adapter Drivers (GPU #2)
Unknown
Driver Version (GPU #2)
2.1.3.0
Driver Date (GPU #2)
1-1-2007
WebGL Renderer
Google Inc. -- ANGLE (NVIDIA GeForce 6150 LE) -- OpenGL ES 2.0 (ANGLE 0.0.0.809)
GPU Accelerated Windows
0/1. Blocked for your graphics driver version.It is possible that you have switched the keyboard layout by accident.
* http://support.microsoft.com/kb/258824 - How to change your keyboard layout
Windows remembers the keyboard layout setting per application and you may have changed the keyboard layout by accident via a keyboard shortcut.
* http://support.microsoft.com/kb/306993 - HOW TO: Use the Language Bar in Windows XP
* Make sure that you have the Language bar visible on the Windows Taskbar
* You can do that via the right-click context menu of the Taskbar: Toolbars > Language Bar
* Check the keyboard language (keyboard layout) setting for the application that has focus via the icon on the Language bar
* You need to do that while Firefox has focus because Windows remembers the keyboard layout setting per application
* The default key combination to rotate the layout is the Ctrl+Shift or Alt+Shift combination that Firefox uses for some menu items
* To avoid an unintentional switch, assign a specific key sequence (Alt/Ctrl+Shift+number) to select keyboard layouts and remove the key combination to rotate layouts (Alt+Shift or Ctrl+Shift)
* Control Panel > Regional and Language Options > Languages > Text services and input languages > Details > Key Settings > Change Key Sequence -
Hi,I am using Essbase at 6.5.3 level and Analyzer Enterprice edition at 6.5.0 level. The java plug-in is at level 1.3.0_02.Foreign characters are corectly dispalyed in Analyzer java web client, but when I try to print the report the foreign characters are not printed correctly.I have changed the contents of the font.properties file all code pages from 1252 to 1250. The characters are still not printed correctly.How to "force" the Analyzer print the foreign characters to print?Thanks,Grofaty
* "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
* "Remove the Cookies" from sites that cause problems: Tools > Options > Privacy > Cookies: "Show Cookies"
Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]] -
How to Record HTTP Requests and POST data
Hai all..
Can anyone help me to solve this issue..
How to Record HTTP Requests and POST data by using java..
regards
Ranjith NairYou should read about TCP and splitting data stream into packets and learn how to understand packet header to assemble stream from packets.
Actually there are few different stages:
1. detect handshake to start new empty stream within your code;
2. detect subsequent packets and assemble stream (there are counters within packet header and they will help).
After creating start of TCP stream (usually 1KB is enough) you'll be able to detect is it HTTP request/header or no and start logging or ignoring packets for this connection.
Maybe you are looking for
-
How do i set up a separate itunes library for my wife so her synch doesn't pick up my library
I want to set up a separate library so that my wife's ipod doesn't try to synch with my existing library. Can it be done or is it possible to install two versions of itunes on the same PC?
-
Why can't I enter single user mode on my Mac Mini for an admin password reset?
Hi, I recently created a new user account for my mac and deleted the old one, not realising that this was the only account with admin priveleges. As such, I no longer have access to administrator priveleges, and cannot grant them to my new user accou
-
Jam pack folders no longer show up in Loop browser?
Hello everyone, I had to move my apple loops from my system drive onto an external drive (needed the room on my system drive). To do this I deleted the logs for the loops, moved the loops folder to my external drive, and drug the folder back into the
-
Need advice on replacing Toshiba hard drive
I have other manufacturers laptop with a Toshiba 60GB MK6021GAS hard drive. I believe the hard drive is on its way out and I want to pull everything off of the disk for restoring to another new one. I need everything from the drive because the OS ima
-
Hi, How transaction line items be maintained under sub asset. We want to maintain a hierarchy in assets as follows: Account determination-Asset Class-Group asset-Main asset-Sub asset-Transaction line item. It will help us in reporting. Please suggest