Home » Eclipse Projects » Remote Application Platform (RAP) » Redirect url Issue
Redirect url Issue [message #79564] |
Fri, 28 March 2008 01:34  |
Eclipse User |
|
|
|
Originally posted by: dnise.hotmail.com
Hi all:
I met a strange problem.In my application, there is a button Or imageLink ,
it'll be directed to new url ( as http://www.eclipse.org/rap") when i click
it. But i got the error which is requestfailed,http status 302
my code as follows:
Button btn=new Button(cp,SWT.NONE);
btn.addSelectionListener(new SelectionAdatper()){
public void widgetSelected(SelectionEvent e) {
try{
RWT.getResponse().sendRedirect("http://www.eclipse.org/rap");
}catch(Exception ex){
ex.printStackTrace();
}
}
}
what's wrong with it ?
can any one tell me ??
Thanks in advance
Dnise
2008-03-28
|
|
| | | |
Re: Redirect url Issue [message #80463 is a reply to message #80170] |
Mon, 31 March 2008 23:43   |
Eclipse User |
|
|
|
Originally posted by: dnise.hotmail.com
Frank Appel wrote:
> Hi,
>
> I think here's what your're looking for:
>
> http://www.eclipse.org/equinox/server/http_writing_applicati on.php
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: dnise [mailto:dnise@hotmail.com]
> Bereitgestellt: Montag, 31. März 2008 05:20
> Bereitgestellt in: eclipse.technology.rap
> Unterhaltung: Redirect url Issue
> Betreff: Re: Redirect url Issue
>
>
> Frank Appel wrote:
>
>> Hi,
>>
>> I'm not sure whether this problem belongs to RAP or the underlying
>> http service. You could try to register a standalone servlet at the
>> osgi service and test a redirect. If the same problem occures this
>> belongs to equinox.
>>
>>
>> Ciao
>> Frank
>>
>> -----Ursprüngliche Nachricht-----
>> Von: dnise [mailto:dnise@hotmail.com]
>> Bereitgestellt: Freitag, 28. März 2008 06:35 Bereitgestellt in:
>> eclipse.technology.rap
>> Unterhaltung: Redirect url Issue
>> Betreff: Redirect url Issue
>>
>>
>> Hi all:
>> I met a strange problem.In my application, there is a button Or
>> imageLink , it'll be directed to new url ( as
>> http://www.eclipse.org/rap") when i click it. But i got the error
>> which is requestfailed,http status 302 my code as follows:
>> Button btn=new Button(cp,SWT.NONE);
>> btn.addSelectionListener(new SelectionAdatper()){
>> public void widgetSelected(SelectionEvent e) {
>> try{
>>
>> RWT.getResponse().sendRedirect("http://www.eclipse.org/rap");
>> }catch(Exception ex){
>> ex.printStackTrace();
>> }
>> }
>> }
>>
>> what's wrong with it ?
>>
>> can any one tell me ??
>>
>> Thanks in advance
>>
>> Dnise
>>
>> 2008-03-28
> Hi Frank:
> Thanks for you idea. But I don't know how to register a standalone
> servlet to osgi? could you give me a example?
Hi Frank:
According to your advice,I have create a new Servlet, registered it in
Plugin.xml file. The configuration code as follows:
<extension
point="org.eclipse.equinox.http.registry.servlets">
<servlet
alias="/test"
class="rapdemo.servlets.MyServlet"/>
</extension>
After it .
I added some codes in Button SelectionEvent . I have used two methods.
First:
String application = RWT.getRequest().getContextPath();
if (application.trim().equals(""))
application = "http://127.0.0.1:8080/test";
try {
RequestDispatcher rdis=RWT.getRequest().getRequestDispatcher("application");
rdis.forward(RWT.getRequest(),RWT.getResponse());
} catch (Exception e1) {
e1.printStackTrace();
}
Second :
String application = RWT.getRequest().getContextPath();
if (application.trim().equals(""))
application = "http://127.0.0.1:8080/test";
try {
RWT.getResponse().sendRedirect(application)
} catch (Exception e1) {
e1.printStackTrace();
}
MyServlet code as follows:
public class MyServlet extends HttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.sendRedirect("http://ww.eclipse.com");
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doPost(req, resp);
}
}
I got the error is requestFailed, code=302.
can i implement this in RAP??
Thanks for you help in advance.
Dnise
2008-04-01
|
|
|
Re: Redirect url Issue [message #80662 is a reply to message #80463] |
Tue, 01 April 2008 08:34   |
Eclipse User |
|
|
|
Originally posted by: fappel.innoopract.com
Hi,
I think you got me wrong on what to do with the servlet. Please point your
browser directly to http://127.0.0.1:8080/test after launching the app. If
the redirect doesn't work here either this would probably point to a
problem in the equinox layer, since no RAP stuff is involved. In that case
you should look at the equinox forums. If the redirect works properly we
have to investigate further how the problem occurs in RAP.
Ciao
Frank
-----Ursprüngliche Nachricht-----
Von: dnise [mailto:dnise@hotmail.com]
Bereitgestellt: Dienstag, 1. April 2008 05:44
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Redirect url Issue
Betreff: Re: Redirect url Issue
Frank Appel wrote:
> Hi,
>
> I think here's what your're looking for:
>
> http://www.eclipse.org/equinox/server/http_writing_applicati on.php
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: dnise [mailto:dnise@hotmail.com]
> Bereitgestellt: Montag, 31. März 2008 05:20 Bereitgestellt in:
> eclipse.technology.rap
> Unterhaltung: Redirect url Issue
> Betreff: Re: Redirect url Issue
>
>
> Frank Appel wrote:
>
>> Hi,
>>
>> I'm not sure whether this problem belongs to RAP or the underlying
>> http service. You could try to register a standalone servlet at the
>> osgi service and test a redirect. If the same problem occures this
>> belongs to equinox.
>>
>>
>> Ciao
>> Frank
>>
>> -----Ursprüngliche Nachricht-----
>> Von: dnise [mailto:dnise@hotmail.com]
>> Bereitgestellt: Freitag, 28. März 2008 06:35 Bereitgestellt in:
>> eclipse.technology.rap
>> Unterhaltung: Redirect url Issue
>> Betreff: Redirect url Issue
>>
>>
>> Hi all:
>> I met a strange problem.In my application, there is a button Or
>> imageLink , it'll be directed to new url ( as
>> http://www.eclipse.org/rap") when i click it. But i got the error
>> which is requestfailed,http status 302 my code as follows:
>> Button btn=new Button(cp,SWT.NONE);
>> btn.addSelectionListener(new SelectionAdatper()){
>> public void widgetSelected(SelectionEvent e) {
>> try{
>>
>> RWT.getResponse().sendRedirect("http://www.eclipse.org/rap");
>> }catch(Exception ex){
>> ex.printStackTrace();
>> }
>> }
>> }
>>
>> what's wrong with it ?
>>
>> can any one tell me ??
>>
>> Thanks in advance
>>
>> Dnise
>>
>> 2008-03-28
> Hi Frank:
> Thanks for you idea. But I don't know how to register a standalone
> servlet to osgi? could you give me a example?
Hi Frank:
According to your advice,I have create a new Servlet, registered it in
Plugin.xml file. The configuration code as follows:
<extension
point="org.eclipse.equinox.http.registry.servlets">
<servlet
alias="/test"
class="rapdemo.servlets.MyServlet"/>
</extension>
After it .
I added some codes in Button SelectionEvent . I have used two methods.
First:
String application = RWT.getRequest().getContextPath();
if (application.trim().equals(""))
application =
"http://127.0.0.1:8080/test";
try {
RequestDispatcher
rdis=RWT.getRequest().getRequestDispatcher("application");
rdis.forward(RWT.getRequest(),RWT.getResponse());
} catch (Exception e1) {
e1.printStackTrace();
}
Second :
String application = RWT.getRequest().getContextPath();
if (application.trim().equals(""))
application =
"http://127.0.0.1:8080/test";
try {
RWT.getResponse().sendRedirect(application)
} catch (Exception e1) {
e1.printStackTrace();
}
MyServlet code as follows:
public class MyServlet extends HttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse
resp)
throws ServletException, IOException {
resp.sendRedirect("http://ww.eclipse.com");
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse
resp)
throws ServletException, IOException {
doPost(req, resp);
}
}
I got the error is requestFailed, code=302.
can i implement this in RAP??
Thanks for you help in advance.
Dnise
2008-04-01
|
|
| |
Re: Redirect url Issue [message #80810 is a reply to message #80782] |
Wed, 02 April 2008 04:03  |
Eclipse User |
|
|
|
Originally posted by: fappel.innoopract.com
Hi,
maybe that's a problem with AJAX-Request mechanism. But that's just a
wild guess. I propose to file a bug for it, in the meanwhile something
similar than the solution I proposed in the 'Redirect user to another
page after closing application' thread will maybe work for you too.
Ciao
Frank
-----Ursprüngliche Nachricht-----
Von: dnise [mailto:dnise@hotmail.com]
Bereitgestellt: Mittwoch, 2. April 2008 03:33
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Redirect url Issue
Betreff: Re: Redirect url Issue
Hi:
First Thanks for your reply. It can be navigated to
Http://127.0.0.1:8080/test when I pointed it directory in browser.
But I don't known why it happens in Rap?
best regards
Dnise
2008-04-02
|
|
|
Goto Forum:
Current Time: Thu May 08 11:42:48 EDT 2025
Powered by FUDForum. Page generated in 0.04020 seconds
|