Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Branding with RAP 1.5(Branding with RAP 1.5, how to create required IRESOURCE)
Branding with RAP 1.5 [message #992379] Fri, 21 December 2012 14:04 Go to next message
Andrej Dimic is currently offline Andrej DimicFriend
Messages: 77
Registered: July 2009
Member
Hi

we wanted to migrate a RAP 1.4 application and planned to go to RAP 1.5.

But we did not manage to register the FAVICON resource in the configuration application.

So we tried with RAP 2.0 M3 and managed to register the ICON with the code shown below.

But how to we do that with RAP 1.5?
Particularly, i do not know how to create the IRESOURCE that must be passed to application.addResource().

Thanks
Andrej


public class KabeMainConfiguration implements ApplicationConfiguration {
private INIFileHandler iniFileHandler = new INIFileHandler(RAPConstants.rapIniFileName); // INI-Filehandler-Object

@Override
public void configure( Application application ) {
try
{
String favIcon = "file://localhost"+iniFileHandler.getEntry("imagePath") + "favIcon.ico";
Map<String, String> properties = new HashMap<String, String>();
properties.put(WebClient.PAGE_TITLE, "Produktecenter");
properties.put( WebClient.FAVICON, favIcon);
ResourceLoader rl = createResourceLoader(favIcon);
application.addResource(favIcon, rl);
application.addEntryPoint("/kabe", KabeMain.class, properties);
} catch (Exception ex)
{
System.out.println(ex.getMessage());
}
}

private ResourceLoader createResourceLoader(final String resourceName)
{
return new ResourceLoader()
{
@Override
public InputStream getResourceAsStream(String resourceName) throws IOException{
URL url = new URL(resourceName);
return (InputStream) url.getContent();
}
};
}

}
Re: Branding with RAP 1.5 [message #993101 is a reply to message #992379] Sun, 23 December 2012 11:31 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi,

On 12/21/2012 03:04 PM, adiinfo Mising name wrote:
> String favIcon = "file://localhost"+iniFileHandler.getEntry("imagePath")
> + "favIcon.ico";
> ...

You shouldn't use a file:// URL, because a client browser won't find the
image in its local filesystem. It should be an http URL to the favicon
that the browser can access. Instead of the entire URL, you can also use
a relative or absolute path.

You can find an example in the 1.5 branch of the examples demo [1].

HTH, Ralf


[1]
http://git.eclipse.org/c/rap/org.eclipse.rap.git/tree/bundles/org.eclipse.rap.examples/src/org/eclipse/rap/examples/internal/ExampleApplication.java?h=streams/1.5-maintenance

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Branding with RAP 1.5 [message #993520 is a reply to message #993101] Mon, 24 December 2012 17:46 Go to previous message
Andrej Dimic is currently offline Andrej DimicFriend
Messages: 77
Registered: July 2009
Member
Hi Ralf

that was the code i was looking for.

Thanks a lot.

Previous Topic:RAP vs SWT Selection Listener for singleton menus
Next Topic:[ANN] RAP 2.0 M4 published
Goto Forum:
  


Current Time: Thu Apr 25 21:53:04 GMT 2024

Powered by FUDForum. Page generated in 0.03269 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top