Erlang/OTP Forums

Author Message

<  Erlyweb mailing list  ~  wrong URL created by ErlyWeb

Guest
Posted: Sun Jan 06, 2008 2:32 am Reply with quote
Guest
I have build the blog based on the tutorial and downloaded the the
blog from google.
Both have the problem, that links on the homepage http://127.0.0.1:8000/blog/
have bad URLs:
http://127.0.0.1:8000/entry/view/my-cat-is-ill
SHOULD BE: http://127.0.0.1:8000/blog/entry/view/my-cat-is-ill

I use ErlyWeb 0.7 and YAWS 1.74.

yaws.conf: --------------------------------------
..
<server localhost>
port = 8000
listen = 127.0.0.1
docroot = "C:/Dokumente und Einstellungen/HeiAn/workspace/blog/www"
appmods = <"/blog", erlyweb>
<opaque>
appname = blog
</opaque>
</server>

-module(blog_app_controller).
-export([hook/1]).
------------------------------------------------------

blog_app_controller.erl --------------------
hook(A) ->
A1=case yaws_arg:appmoddata(A) of
Root when (Root =:= "") orelse (Root =:= "/") ->
yaws_arg:appmoddata(A, "/entry");
_ ->
A
end,
Ewc = erlyweb:get_initial_ewc({ewc, A1}),
case Ewc of
{data,_}=Data ->
Data;
_ ->
{phased, Ewc,
fun(_Ewc, Data,_PhasedVars) ->
{ewc, html_container, [A1, {data, Data}]}
end}
end.
----------------------------------------------------------

How can I sove the problem?

thanks
Andreas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
ketralnis
Posted: Sun Jan 06, 2008 3:03 am Reply with quote
User Joined: 20 Jul 2007 Posts: 151 Location: San Francisco, CA
> I have build the blog based on the tutorial and downloaded the the
> blog from google.
> Both have the problem, that links on the homepage http://127.0.0.1:8000/blog/
> have bad URLs:
> http://127.0.0.1:8000/entry/view/my-cat-is-ill
> SHOULD BE: http://127.0.0.1:8000/blog/entry/view/my-cat-is-ill

What code is creating those URLs? It's not below. Presumably it's part
of entry_controller:index or entry_view:index

By the way, this is also incorrect, then:

>> Root when (Root =:= "") orelse (Root =:= "/") ->
>> yaws_arg:appmoddata(A, "/entry");

It should be:

>> Root when (Root =:= "/blog") orelse (Root =:= "/blog/") ->
>> yaws_arg:appmoddata(A, "/blog/entry/");









>
>
> I use ErlyWeb 0.7 and YAWS 1.74.
>
> yaws.conf: --------------------------------------
> ..
> <server localhost>
> port = 8000
> listen = 127.0.0.1
> docroot = "C:/Dokumente und Einstellungen/HeiAn/workspace/blog/www"
> appmods = <"/blog", erlyweb>
> <opaque>
> appname = blog
> </opaque>
> </server>
>
> -module(blog_app_controller).
> -export([hook/1]).
> ------------------------------------------------------
>
> blog_app_controller.erl --------------------
> hook(A) ->
> A1=case yaws_arg:appmoddata(A) of
> Root when (Root =:= "") orelse (Root =:= "/") ->
> yaws_arg:appmoddata(A, "/entry");
> _ ->
> A
> end,
> Ewc = erlyweb:get_initial_ewc({ewc, A1}),
> case Ewc of
> {data,_}=Data ->
> Data;
> _ ->
> {phased, Ewc,
> fun(_Ewc, Data,_PhasedVars) ->
> {ewc, html_container, [A1, {data, Data}]}
> end}
> end.
> ----------------------------------------------------------
>
> How can I sove the problem?
>
> thanks
> Andreas
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
View user's profile Send private message AIM Address
Guest
Posted: Sun Jan 06, 2008 2:05 pm Reply with quote
Guest
Hi Andreas,

in my yaws.conf I have the appmods = <"/blog", erlyweb> set to appmods
= <"/", erlyweb>, that is why /blog/ in the urls dont work for you.

The blog application is made by a erlyweb-beginner, so please dont
trust the code in any way. Smile
I
Guest
Posted: Mon Jan 07, 2008 3:07 am Reply with quote
Guest
I created a new erlyweb app with one component called "test".
I did not modified any code created by erlyweb and still have the
problem Sad

yaws.conf
..
appmods = <"/objectstore", erlyweb>
<opaque>
appname = objectstore
</opaque>

If I type http://127.0.0.1:8000/objectstore/test/ in my bowser, it
will be forwarded to http://127.0.0.1:8000/objectstore//test/list/1
and I will recive the following error:
Internal error, yaws code crashed
--------------------------------------------------------------------------------
ERROR erlang code crashed:
File: appmod:0
Reason: {timeout,{gen_server,call,
[mysql_dispatcher,
{fetch,erlydb_mysql,
[[[[<<"SELECT ">>,<<"*">>],
<<" FROM ">>,
<<"test">>],
[]],
[<<" LIMIT ">>,<<"0">>,
44,<<"10">>]]},
5000]}}
Req: {http_request,'GET',{abs_path,"/objectstore//test/list/1"},{1,1}}

No Error with: http://127.0.0.1:8000/objectstore/test/list/1


On 6 Jan., 15:04, maddiin <madd...@googlemail.com> wrote:
> Hi Andreas,
>
> in my yaws.conf I have the appmods = <"/blog", erlyweb> set to appmods
> = <"/", erlyweb>, that is why /blog/ in the urls dont work for you.
>
> The blog application is made by a erlyweb-beginner, so please dont
> trust the code in any way. Smile
> I
Guest
Posted: Thu Jan 10, 2008 7:50 am Reply with quote
Guest
It looks like the error you're getting is because ErlyDB hasn't been
started. Did you call erlydb:start()?

On Jan 6, 2008 7:06 PM, Andreas <andreas.heissenberger@gmail.com> wrote:
>
> I created a new erlyweb app with one component called "test".
> I did not modified any code created by erlyweb and still have the
> problem Sad
>
> yaws.conf
> ..
> appmods = <"/objectstore", erlyweb>
> <opaque>
> appname = objectstore
> </opaque>
>
> If I type http://127.0.0.1:8000/objectstore/test/ in my bowser, it
> will be forwarded to http://127.0.0.1:8000/objectstore//test/list/1
> and I will recive the following error:
> Internal error, yaws code crashed
> --------------------------------------------------------------------------------
> ERROR erlang code crashed:
> File: appmod:0
> Reason: {timeout,{gen_server,call,
> [mysql_dispatcher,
> {fetch,erlydb_mysql,
> [[[[<<"SELECT ">>,<<"*">>],
> <<" FROM ">>,
> <<"test">>],
> []],
> [<<" LIMIT ">>,<<"0">>,
> 44,<<"10">>]]},
> 5000]}}
> Req: {http_request,'GET',{abs_path,"/objectstore//test/list/1"},{1,1}}
>
> No Error with: http://127.0.0.1:8000/objectstore/test/list/1
>
>
>
> On 6 Jan., 15:04, maddiin <madd...@googlemail.com> wrote:
> > Hi Andreas,
> >
> > in my yaws.conf I have the appmods = <"/blog", erlyweb> set to appmods
> > = <"/", erlyweb>, that is why /blog/ in the urls dont work for you.
> >
> > The blog application is made by a erlyweb-beginner, so please dont
> > trust the code in any way. Smile
> > I
Guest
Posted: Thu Jan 10, 2008 12:47 pm Reply with quote
Guest
You are right - this was something in coming from the cache Sad
It does work now without any errors but I still have this extra "/" in
my URLs between objectstore//test:
http://127.0.0.1:8000/objectstore//test/new

this is the code of the generated objectstore_app_controller:
-module(objectstore_app_controller).
-export([hook/1]).

hook(A) ->
{phased, {ewc, A},
fun(_Ewc, Data, _PhasedVars) ->
{ewc, html_container, index, [A, {data, Data}]}
end}.

On 10 Jan., 08:38, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> It looks like the error you're getting is because ErlyDB hasn't been
> started. Did you call erlydb:start()?
>
> On Jan 6, 2008 7:06 PM, Andreas <andreas.heissenber...@gmail.com> wrote:
>
>
>
>
>
> > I created a new erlyweb app with one component called "test".
> > I did not modified any code created by erlyweb and still have the
> > problem Sad
>
> > yaws.conf
> > ..
> >
Guest
Posted: Fri Jan 11, 2008 2:35 am Reply with quote
Guest
I'll look into the extra "/". It's probably a bug.

On Jan 10, 2008 4:47 AM, Andreas <andreas.heissenberger@gmail.com> wrote:
>
> You are right - this was something in coming from the cache Sad
> It does work now without any errors but I still have this extra "/" in
> my URLs between objectstore//test:
> http://127.0.0.1:8000/objectstore//test/new
>
> this is the code of the generated objectstore_app_controller:
> -module(objectstore_app_controller).
> -export([hook/1]).
>
> hook(A) ->
> {phased, {ewc, A},
> fun(_Ewc, Data, _PhasedVars) ->
> {ewc, html_container, index, [A, {data, Data}]}
> end}.
>
> On 10 Jan., 08:38, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> > It looks like the error you're getting is because ErlyDB hasn't been
> > started. Did you call erlydb:start()?
> >
> > On Jan 6, 2008 7:06 PM, Andreas <andreas.heissenber...@gmail.com> wrote:
> >
> >
> >
> >
> >
> > > I created a new erlyweb app with one component called "test".
> > > I did not modified any code created by erlyweb and still have the
> > > problem Sad
> >
> > > yaws.conf
> > > ..
> > > appmods = <"/objectstore", erlyweb>
> > > <opaque>
> > > appname = objectstore
> > > </opaque>
> >
> > > If I typehttp://127.0.0.1:8000/objectstore/test/in my bowser, it
> > > will be forwarded tohttp://127.0.0.1:8000/objectstore//test/list/1
>
> > > and I will recive the following error:
> > > Internal error, yaws code crashed
> > > ---------------------------------------------------------------------------
dmitriid
Posted: Sat Jan 12, 2008 12:43 pm Reply with quote
User Joined: 17 Aug 2006 Posts: 213
Yariv Sadan wrote:
> I'll look into the extra "/". It's probably a bug.
>
>
It is. When calling
erlyweb:create_component("page", path_to_app),
the view that is automagically generated contains links like this:
<a href="//page/new">create new</a>
instead of
<a href="/page/new">create new</a>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum