Johan Rylander

2011-12-22

Se till att IntelliJ känner igen typer i Velocity-filer

Postat i: java, Programming — Johan Rylander @ 11:25

Du kan lägga in kommentarer i Velocity-filer för att låta IntelliJ förstå vilken typ de har och därmed få completion etc.

En dylik kommentar ser ut så här:

#* @vtlvariable name="fields" type="java.util.List<example.MyClass.MyInnerClass>" *#

Se: http://www.jetbrains.com/idea/features/freemarker_velocity.html

2011-12-21

Velocity i Polopoly output templates i IntelliJ

Postat i: java, Polopoly, Programming — Johan Rylander @ 15:08

IntelliJ kan som bekant förstå språk injectade i andra språk såsom t ex att använda regexp i en sträng-parameter till en Java-metod.

För att låta IntelliJ förstå Velocity inuti Polopoly output templates, lägg till en ”language injection” under Project Settings->Language Injections och ställ in:

  • ID: VTL
  • Prefix: <![CDATA[
  • Suffix: ]]>
  • Local Name: component
  • Namespace: http://www.polopoly.com/polopoly/cm/app/xml
  • XPath Condition: @group=”output/renderer/selected/default” and @name=”value”

Nu känns Velocity igen som språk:

2011-10-03

Getting to the response object in Atex Polopoly SiteEngine/Live Layout Manager

Postat i: java, Polopoly, Programming — Johan Rylander @ 15:47
private HttpServletResponse getWrappedRenderResponse(RenderRequest renderRequest) {
    RenderResponseCollectorHttp responseCollector = (RenderResponseCollectorHttp) renderRequest.getAttribute("p.request.wrapresponsestack");
    return (HttpServletResponse) responseCollector.getWrappedRenderResponse();
}

2011-08-22

Java encoding i maven 2.x

Postat i: java, Programming — Johan Rylander @ 13:45

Lägg till i pom.xml, antingen direkt i build eller i profile/build

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
 <configuration>
 <encoding>ISO-8859-1</encoding>
 </configuration>
</plugin>

2011-06-14

Blatant copy: Using Subclipse on OS/X with Homebrew

Postat i: java, Programming — Johan Rylander @ 13:09

From: http://tedwise.com/2010/06/21/micro-tip-using-subclipse-on-osx-with-homebrew/

 
brew install --universal --java subversion
sudo ln -s /usr/local/lib/libsvnjavahl-1.dylib /Library/Java/Extensions

2010-10-07

ant completion in bash

Postat i: Computers, java, Programming — Johan Rylander @ 14:32

Originally from http://matthew.mceachen.us/blog/ant-bash-completion-on-mac-os-x-43.html

  1. sudo brew install bash-completion
  2. Add to .profile or .bash_profile:
    if [ -f `brew --prefix`/etc/bash_completion ]; then  . `brew –prefix`/etc/bash_completionficomplete -C /usr/share/ant/bin/complete-ant-cmd.pl ant

2010-05-03

”no xml was provided” in axis 1.4 call

Postat i: java, Programming — Johan Rylander @ 16:09

When using axis 1.4 to call a legacy web service we got the not so explaing error ”no xml was provided”. The fault was found (after some wireshark fun) to be that the call was done using chunked encoding.

Now then, setting the chunked encoding would normally be done by overriding the createCall method in org.apache.axis.client.service by using call.setProperty(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED, false); but doing that changed nothing. What did work was doing:

Map<String, Object> headers = (Hashtable<String, Object>) call.getProperty(HTTPConstants.REQUEST_HEADERS);
if (headers == null) {
headers = new Hashtable<String, Object>();
}
headers.put(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED, false);
call.setProperty(HTTPConstants.REQUEST_HEADERS, headers);

Tema: Silver is the New Black. Blogga med WordPress.com.

Follow

Get every new post delivered to your Inbox.