1

I want to serve html pages in ServiceStack without the .html extension appearing on url. Is that possible with ServiceStack?

I don't want to use the Razor of ServiceStack for achieving extension-less url, I can't get its Razor to work with WebStorm Live Edit. Only the HTML works on WebStorm Live Edit

Hao
  • 8,047
  • 18
  • 63
  • 92
  • @SergeyBerezovskiy undeleted http://stackoverflow.com/questions/20852190/unit-testing-rich-domain-model – Hao Dec 31 '13 at 13:35

3 Answers3

1

It seems WebStorm Live Edit should be fixed, is there existing bug in JetBrains issue tracker (http://youtrack.jetbrains.com)? May be you can create issue about problem?

develar
  • 955
  • 3
  • 12
  • 16
0

This isn't supported by default but there are lots of hooks in ServiceStack that gives you the opportunity to do this. I'd AppHostBase.CatchAllHandler:

appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) => {
    var relativePath = "{0}.html".Fmt(pathInfo);
    var fileExists = appHost.VirtualPathProvider.FileExists(relativePath);
    return fileExists ? new MyStaticFileHttpHandler(pathInfo) : null;
});

Look at StaticFileHandler for an optimal implementation of downloading a file contents that works reliably on .NET and Mono ASP.NET/HttpListener hosts.

mythz
  • 141,670
  • 29
  • 246
  • 390
  • StaticFileHandler is internal though https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/WebHost.Endpoints/Support/StaticFileHandler.cs How to use StaticFileHandler? – Hao Feb 05 '13 at 15:55
  • I tried it now, but my limited knowledge of how HttpHandler works, impedes me on knowing where to slot the above functionality – Hao Feb 05 '13 at 23:10
0

may use this for a while

t := "Google"
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force
;hardBackup 

;clipboard:=""
;~ MsgBox,%A_LineNumber%


HardDriveLetter := SubStr(A_ScriptDir, 1 , 1) 
ScriptNameLetter := SubStr(A_ScriptName, 1 , 1) 
iconAdress=%HardDriveLetter%:\fre\public\Graf-Bilder\icon\abc123\%ScriptNameLetter%.ico
ifexist,%iconAdress%
    Menu, Tray, Icon, %iconAdress%
else
  ToolTip,http://www.branchenbuch-weltweit.dk/img/abc/a.png

IfWinNotExist,%t%
{
    ToolTip,%t% `n does not exist.
    MsgBox,%t% `n does not exist.
    Sleep,5000
    ExitApp
}
; aAa
SetTitleMatchMode,2
#IfWinActive,PhpStorm 7.1 ahk_class SunAwtFrame
 ~A::
    SingleKeyInput("dummy")
  return 

 ~B::
    SingleKeyInput("dummy")
  return 

 ~C::
    SingleKeyInput("dummy")
  return 

 ~D::
    SingleKeyInput("dummy")
  return 

 ~E::
    SingleKeyInput("dummy")
  return 

 ~F::
    SingleKeyInput("dummy")
  return 

 ~G::
    SingleKeyInput("dummy")
  return 

 ~H::
    SingleKeyInput("dummy")
  return 

 ~I::
    SingleKeyInput("dummy")
  return 

 ~J::
    SingleKeyInput("dummy")
  return 

 ~K::
    SingleKeyInput("dummy")
  return 

 ~L::
    SingleKeyInput("dummy")
  return 

 ~M::
    SingleKeyInput("dummy")
  return 

 ~N::
    SingleKeyInput("dummy")
  return 

 ~O::
    SingleKeyInput("dummy")
  return 

 ~P::
    SingleKeyInput("dummy")
  return 

 ~Q::
    SingleKeyInput("dummy")
  return 

 ~R::
    SingleKeyInput("dummy")
  return 

 ~S::
    SingleKeyInput("dummy")
  return 

 ~T::
    SingleKeyInput("dummy")
  return 

 ~U::
    SingleKeyInput("dummy")
  return 

 ~V::
    SingleKeyInput("dummy")
  return 

 ~W::
    SingleKeyInput("dummy")
  return 

 ~X::
    SingleKeyInput("dummy")
  return 

 ~Y::
    SingleKeyInput("dummy")
  return 

 ~Z::
    SingleKeyInput("dummy")
  return

 ~Enter::
    SingleKeyInput("activate")
  return


SingleKeyInput(m)
{
    global t
    ;~ MsgBox,ControlSend f5 %t%
    ; /develop/ConverterIni2awl/php/www/ConverterIni2awl.class.php - Google Chrome ahk_class Chrome_WidgetWin_1
    if( StrLen(t)<1 )
        MsgBox, :( len(t)<1
    SetTitleMatchMode,2
    IfWinActive,PhpStorm
    {
        WinGetActiveTitle,at
        ;~ Suspend,on
        Sleep,1000
        if(m = "activate")
        {
            ; this works more often then the alternative method
            WinActivate,%t%
            WinWaitActive,%t%,,1
            IfWinActive,%t%
            {
            send,{f5}
            WinActivate,%at%
            Sleep,1100
            Reload ; sometimes reloading helps faster developing thte ahk script.
            }
        }

        IfWinNotActive,%t%
            ControlSend,,{f5},%t%
        ToolTip, f5
        Sleep,1000
        ToolTip, 
        ;~ Suspend,off
    }
    return
}
SL5net
  • 2,282
  • 4
  • 28
  • 44